Pocket mode not working on edge case
Description
Pocket mode seems to break under some very specific circumstances. This was actually reported in this other issue but I am creating this new one to keep it a little cleaner.
Steps to reproduce
Conversation with @paulie-g:
Covering the sensor, waiting for the device to lock, then quickly uncovering it again results in no unlock at that time and, presumably, some sort of inconsistent internal state that prevents sensor uncovering working to unlock again. I can unlock by other means, which fixes internal state presumably, and everything works from then on.
I haven't been able to reproduce this, but I'll keep on trying. Does WaveUp lock the device for you or is it Android's natural timeout doing that?
Did this not happen on older versions? It's a little weird that this appeared now.
This may have happened on older versions, I couldn't swear that it didn't - it's an edge case triggered by actually testing rather than normal usage. I care that it locks properly much more than I care about the unlock since I have double tap to wake, so a transient error like this wouldn't bother me.
To reproduce, set wave mode to off, pocket mode on, lock screen on, lock in landscape off, cover time to 1s, vibrate to on, workaround to off. Cover the sensor, wait for the second vibration + click from lock, uncover right away. This breaks pocket mode. I seem to recall from when I initially went through the code that there's a timeout there somewhere after it registers an event from the sensor, does something and before another event can be triggered. These are the settings I use with my flip cover. If I turn wave mode on, it allows me to bypass this - opening the cover again quickly after lock won't work, but closing/opening cover the second time unlocks successfully.