firebirdberlin / nightdream

an Android desk clock
https://firebirdberlin.github.io/nightdream
GNU General Public License v3.0
21 stars 13 forks source link

Daydream mode interferes with Android's automatic screen locking #164

Open scruloose opened 5 years ago

scruloose commented 5 years ago

Background

Expected Result

When I use the stock clock daydream, dismissing the daydream (ie waking the device) takes me to the lock screen as expected, in both the case of turning off the screen manually and the case of timeout → screen blank → auto-lock.

Nightdream should behave the same way.

Current Result

When using Nightdream as a daydream screensaver, if I turn off the screen using the power button, it behaves as expected. But if I let the screen time out and blank automatically, dismissing the daydream takes me immediately back to whatever screen was open before the screen blanking kicked in—no lock screen! This happens regardless of how long the daydream has been running, long after the auto-lock interval has elapsed. Also, notifications that use "peeking" will appear on top of Nightdream's display in this instance. I believe this indicates that Nightdream is taking over before the screen has even blanked (thus preventing the screen blank→auto-lock timeout) and is essentially running as a full-screen app instead of waiting to be called by Android's daydream mechanism like a well-behaved screensaver.

Given that this results in the user's device being left unlocked indefinitely when they expect it to be locked and there is no indication that it's not, this is a serious flaw with obvious privacy and security implications.

Suggested Solution

When Nightdream is set as daydream screensaver, it should respect Android's sequence of OS blanks screen → OS calls screensaver through daydream mechanism → OS continues to handle device locking the way other daydream screensavers do, not step in and prevent Android from blanking and locking the screen.

Given that the app's autostart functionality and the daydream screensaver functionality are mutually exclusive, would it make sense to split the project into two packages? That way, users who simply want a more configurable clock daydream screensaver could install the Nightdream-screensaver package and get a well-behaved screensaver with only the options that make sense for that use-case. Users who want the full-fledged auto-starting app could install the Nightdream-app package and it would not show up in the daydream screensaver list (so there would be no need for the whole "gray out the autostart settings and show a reminder to turn off daydream" workaround).

Additional Details

firebirdberlin commented 5 years ago

Confirmed. Technically I do stop daydreaming immediately after our is started. As a fast solution I could offer to wait for 5 seconds before doing that. With a 5s delay before the screen lock is activated it works. This is not a real solution though.

scruloose commented 5 years ago

Well, I agree that your fast solution is a hack, not the real solution. But for right now, if it will allow me to continue using Nightdream without constantly having to wonder whether my device has been inadvertently left unlocked, I'll take it.

gwww commented 5 years ago

I still see the problem when the phone is not locked and daydream kicks in that the phone will not lock.