Remote screen control doesn't work well when it's cold.

Vyacheslav Rotko shared this problem 8 months ago
Solved

I currently have two remote control devices. I found that these devices work differently when you press and release a key. A single device generates only one "KeyDown action=0" event when a key is pressed and one "KeyUp action=1" event when a key is released. The second device can generate multiple "KeyDown action=0" events when the key is pressed and one "KeyUp action=1" event when the key is released. And this is a problem when controlling the screen. If you press the button for a long time to turn off the screen, it will immediately turn on and off. In practice, you can turn on the screen only on the fifth attempt. This happens most often when cycling in winter at temperatures below -10°C. The device is probably freezing and the key is slowly released. I think the screen is controlled when the "KeyDown action=0" event is received. Please change this and control the screen when you get the command "KeyUp action=1", if of course my guess is correct. :-)

Replies (8)

photo
1

Hello,

this is quite interesting. I'm checking how app handle key events and a) it should really handle screen on/off no matter if the app is visible or not (as we discussed in different topic).

And handling is done with following code

/ac50c86d88a9eef963136c68def3973b

so the app already handles only "ACTION_UP" event. ACTION_DOWN is currently ignoring. Interesting.

Only what we may improve here, is to limit the number of execution for certain actions to some logical value ... hmm

photo
1

Device 1 works like this: When I press and hold the button, nothing happens. When I release the button, two events "KeyDown action = 0" and "KeyUp action = 1" appear.

Device 2 works differently: when I press and hold the button, a lot of "KeyDown action = 0" events appear, and they don't stop until I release the button. When I release the button, one "KeyUp action = 1" event appears.

Perhaps this clarification will help you determine the reason for this behavior.

photo
1

If you press and hold the button on device 1, the screen will turn on or off "correctly" when you release the button. If you press and hold the button on device 2 when the screen is off, the screen will turn on, because it is not the Locus that turns it on, but the Macrodroid macro. When I release the button, the screen is already turned off by the Locus. It turns out that the problem is that the locus itself can't turn on the screen.

photo
1

Hmm, not sure now where is the problem.

As I've double-checked in the code, Locus Map should really react only on the mentioned "ACTION_UP" event. "ACTION_DOWN" should be consumed, but ignored. Information that Locus Map is currently on your device unable to turn the screen on is a fact, I have no idea what to do with it for now, sorry.

You also wrote that you use the MacroDroid app, so it looks to me, there is some mess in handling events by MacroDroid and Locus Map. Isn't then better, to use only MacroDroid for turning the screen on/off?

photo
1

Thank you for the discussion. I will try your advice to turn the screen on and off only using the macrodroid. Too bad you can't do this with a Locus. But sometimes it is enough to let go of the problem, and after a while it will resolve itself. Will wait. :-)

photo
1

Yes, this sometimes helps :).

As I know, there exists methods to handle media keys even when app is in the background (this was made to allow control of media players). So maybe this is a "hack" used by MacroDroid and others. For me it's anyway weird that it works on my Pixel 2 (Android 11) without any problem. But this is different story, different topic. Let me know, if control only over MacroDroid helps here, because as I wrote, I currently does not see any possible problem on the side of Locus Map.

Have a nice day!

Jiří M. aka Menion

photo
1

Yes, the macrodroid controls the screen well. The following macro is written. Trigger (Media button V2 provided that the Locus is in the foreground and this macro has not been called for one second). Action (if the screen is off, turn on the screen, otherwise turn off the screen)

photo
1

Friends!

This is a question for those who use a remote card management device.

Can you turn ON the screen with ANY button from a remote device?

If SO, on which version of Android?


Please note that there are remote devices that have a special button to turn on the screen. I'm not interested in such a button.


I'm still using Android 7, and turning on the screen at the Locus doesn't work for me. But recently I got an old phone in my hands. I installed Android 10 on it and found that turning on the screen there does not work either. I also have three different remote controls.


The author writes that this works on Android 11. I can't install Android 11 yet to test it.

Leave a Comment
 
Attach a file