LibreShift / red-moon

Android screen filter app for night time phone use.
GNU General Public License v3.0
650 stars 81 forks source link

Notification behavior is inconsistent #138

Closed di72nn closed 7 years ago

di72nn commented 7 years ago

The notification sometimes disappears when I press "Turn off". It seems the notification disappears only if the app was automatically launched on startup, but it doesn't disappear, if the app was manually started (not sure about it).

I'm using 2.10.2 from F-Droid. I don't remember noticing that behavior in the previous (recent) versions. I have the "Times from sun" option enabled.

Sometimes I need to install APKs, so I need to temporarily disable filtering. I used to press the pause/stop button in the notification, and then when I finished with installing APKs, I used the notification to enable Red Moon again. In the version 2.10.2 the notification disappears when I turn the filter off, so I have to launch the Red Moon app and then enable filter from the app UI. After that the notification does not disappear even if I turn it off.

smichel17 commented 7 years ago

The intended behavior is that the notification will disappear when Red Moon is turned off via the app ui, the widget, and the quick settings tile (on android 7.0+), but not the notification itself.

The bug happened because I made a performance improvement. Red Moon handles filtering in a service, which always running if the UI is open or when Red Moon is on. Previously, when you turned Red Moon off, the service would remain running until Android needed more memory for other apps. I changed it so the service will stop itself right away; that had the unintended side effect of dismissing the notification.

I'm pretty sure I fixed it already in the repo. I periodically post debug builds here; you can grab the latest one (currently April 7th) from there if you don't want to wait for a release (Also, you can try out the latest changes and report any other bugs you find, to help get it ready for release more quickly :smile:). It will install alongside the release version.

Sometimes I need to install APKs, so I need to temporarily disable filtering.

FYI, Red Moon can do this automatically, if you enable Pause in secure apps :)

di72nn commented 7 years ago

Thanks for the details.

I've built and installed the latest version from master (3a4ec5c), it seems I can reproduce the problem. I can provide logs if needed.

FYI, Red Moon can do this automatically, if you enable Pause in secure apps :)

Yeah, thank, I'm aware of it, but I don't want to use that feature.

smichel17 commented 7 years ago

I've built and installed the latest version from master (3a4ec5c), it seems I can reproduce the problem. I can provide logs if needed.

Let me run through and see if I want to add any more logging first. Then, that would be great, since I can't reproduce on my device or an emulator (there are some bugs I can reproduce, but they are about not dismissing the notification when we should, not the other way around).

Yeah, thank, I'm aware of it, but I don't want to use that feature.

Because of permissions, or a different reason?

di72nn commented 7 years ago

Because of permissions, or a different reason?

I don't need Red Moon to perform extra checks - I don't install APKs very often.

I also noticed that if I remove Red Moon from the "recent apps" list, the notification disappears the next time I press "Turn off".

BTW, I use Android 4.4.4.

smichel17 commented 7 years ago

BTW, I use Android 4.4.4.

I definitely should have asked this. I can reproduce it in an emulator; no need for logs :)

smichel17 commented 7 years ago

I know how to fix this. I'm done coding for tonight but I should have time to make a fix tomorrow.

smichel17 commented 7 years ago

@di72nn Could you try 8cced8b and see if that fixes the issue? I think it should, but I ran into an issue with debug builds in the older emulator that prevented me from testing it fully.

(The bug is related to the package name changes that allow installing the debug build alongside release. It causes the notification actions not to work in the debug version; I'm not sure if it affects physical devices, too. I'll fix it in the future, it's just more time than I have right now.)

di72nn commented 7 years ago

Seems to work fine now. Thank you.

smichel17 commented 7 years ago

Great! I'll leave this open until 3.0 is released, in case anyone else runs into the issue.