Page 1 of 2
Use front flash instead of led notification
Posted: 20 Jan 2019 17:33
by wfrcrd
I'm trying to build a flow to blink repeatly the front camera flash using the script mentioned in this post from Desmanto (thank you!)
http://automagic4android.com/forum/view ... 287#p11664
but I'm a bit worried about the battery drain:
the only action that I know to pause the flow between one blink and another one is "sleep".
There is some less expensive action to use to perform it?
Thank you !
Re: Use front flash instead of led notification
Posted: 20 Jan 2019 18:33
by Desmanto
It seems sleep() is the only way to make it blink. Maybe you can make it blink faster at first and then reduce the blink speed after 10 blinks, by making the sleep much longer.
I hope we can have the blink option directly built-in into the flashlight action, including option to choose the front/back flash.
Re: Use front flash instead of led notification
Posted: 20 Jan 2019 18:49
by wfrcrd
I've started with long time between the blinks beacuse the flashlight it's strong and a bit bothering.
I'm not worried about the battery drain when the flash is on, but I'm worried when it's off and the flows
continues.
I should find some way to "pause" the blinking flow triggering the proximity sensor ,
and restart the blink flow when there's nothing near the phone.
Re: Use front flash instead of led notification
Posted: 21 Jan 2019 12:36
by wfrcrd
So I've made a set of flows to use the front flashlight as a led indicator.
I've tried to stop the blink when something cover the phone using the proximity sensor
and restart it automatically when it's not covered anymore.
It seems working with no huge battery drain but when the phone is covered
for long time and then the cover has been taken off again the blink don't start anymore.
It seems that the proximity sensor is stopped, maybe due to a "deep sleep" or something like that.
I will try to manage it setting a periodic time to keep the proximity sensor awaken,
but it's a uncougth solution, I will let you know.
Re: Use front flash instead of led notification
Posted: 21 Jan 2019 17:23
by Desmanto
What is the actual usage of the flow? Do you use it to replace the notification LED? Or you simply let it blink just like a beacon to locate your phone?
Without knowing the main purpose, sometimes we can't determine which is the best solution.
If you use it for notification, I would think about a short burst blink at beginning and slowly become less frequent until it takes to long for a single blink. When any notif arrived, the blink return to the more frequent speed; and slowly become less frequent again after some time.
Re: Use front flash instead of led notification
Posted: 21 Jan 2019 19:00
by wfrcrd
thank you for the answer Desmanto,
the main pourpose is to sobsitute the led notification wich is weak on my phone.
Yes, the blink pattern do someting similar to waht you said, more frequently at the beginning.
But I have another problem: I've combined the blink with the proximity sensor to avoid the blink
when the phone is in the pocket.
And it works just if the phone stays covered for less than one hour (approx) ,
if it is covered for longer time, when it's discovered the blink don't start again.
I think the proximity sensor go to sleep after a while and don't recognize anymore
the change (covered/unceovered) status of the phone, which should start the blink pattern.
I'm working on it ...
(edit)
maybe this action may solve :Exit Device Idle/Doze Mode
but my phone is not rooted yet , so I must wait
Re: Use front flash instead of led notification
Posted: 22 Jan 2019 18:14
by Desmanto
That is probably the best way to achieve it already. For proximity sensor sleep, have you exclude automagic from all battery optimization? Some ROM have the sensor timer block, you have to disable this too. Actually the sensor consume so small battery life that blocking it is not worth it. (but at some phone it may have significant difference).
Re: Use front flash instead of led notification
Posted: 25 Feb 2019 16:31
by wfrcrd
I'm keep trying, before the "deep sleep" problem I've found another one (now the phone is rooted) :
the blinking should stop when "ui present" it's triggered but I've noticed that it stops just when the screen turns on.
The log says that another CAM user is present and cannot perform the torch action (the flash blinkin).
I was asking myself who is this another cam user and finally I think it's the face recognition which starts
when the screen turns on.
Do you know how to avoid this issue, keeping the face recognition on?
Thanks!
Re: Use front flash instead of led notification
Posted: 25 Feb 2019 17:08
by Desmanto
There is no way to steal the camera usage from the face recognition function. So the only way to avoid the issue is to pause the flow when the face recognition is active. Probaly the combination of display state on until the user present is triggered. Or you can design your blinking action, add exception connection to it with sleep 10 seconds and loop back to the same action. This means if the blinking part is stopped by any error (face recognition forcefully take the camera access), it will sleep for 10 seconds before trying it again.
Re: Use front flash instead of led notification
Posted: 26 Feb 2019 14:45
by wfrcrd
Thank you Desmanto,
I've tried to "disable pm" camera during the blink process but the system re-anable it by itself.
So I prefer to pause the flow instaed of change the blink flow, wich is more complicated to me.
How can I pause and resume the flow?
Thank you!