Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically pause filter in some apps (APK Installer) #64

Closed
raatmarien opened this issue Jul 2, 2016 · 4 comments
Closed

Automatically pause filter in some apps (APK Installer) #64

raatmarien opened this issue Jul 2, 2016 · 4 comments
Labels
good first issue These issues are relatively simple and self-contained.

Comments

@raatmarien
Copy link
Member

Originally discussed in #61.

  • Automatically pause when installing APKs
    Darker detects when an APK is attempting to install and temporarily pauses.

This would indeed be very useful, and I've been looking into how to accomplish this. It seems that up to Android Lollipop (API 21) it was fairly easy to get the info of the foreground app with ActivityManager.getRunningTasks, however as of API 21+ this only returns 'non sensitive' tasks, making it unusable for this purpose.

According to this StackOverflow answer a workaround on later versions of Android is using android UsageStatsManager and filter out the last used application. A problem with this approach is that UsageStatsManager isn't implemented on Samsung phones according to the comments on that question.

Lastly I'm not sure how Red Moon would register changes to the foreground activity. There doesn't seem to be a listener framework for the UsageStats or the ActivityManager and constantly polling for changes may be a drain on the battery life of a phone.

That said, I'm quite a fan of this feature. I think it would be a huge usability improvement (especially for F-Droid users). However it seems that it would be quite complex and time consuming to implement this correctly, which I don't have right now. If someone else is willing to implement this, I would love to see a pull request 😄.

@raatmarien raatmarien added enhancement good first issue These issues are relatively simple and self-contained. labels Jul 2, 2016
@smichel17
Copy link
Member

Here's an idea, albeit one that makes me a little uncomfortable.

We could allow users to set red moon as the default application for installing apks, rather than the package installer. Then red moon disables the filter, calls the package installer so the user can install the apk. When the package installer completes, red moon will automatically return to the foreground. Then it can re-enable the filter and close itself. There's an Antivirus app that comes with the galaxy S7 that does this.

@pylerSM
Copy link
Contributor

pylerSM commented Aug 5, 2016

^^ this is best idea. I maybe try to implement it :D

@raatmarien
Copy link
Member Author

I've implemented a solution to this in v2.9.0. If you enable "Automatic suspend" in this version, Red Moon polls the current package every second that the filter is active and the screen is on and suspends the filter when a 'protected' app is detected. See: efa1e05.

@pylerSM
Copy link
Contributor

pylerSM commented Aug 13, 2016

fine :) When you open "grant permissions dialog", is it suspended? not sure how these APIs handle current app, since "grant permissions dialog" is started by some app, but dialog comes from Package Installer.

I will test new APK :)

Yes- fine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue These issues are relatively simple and self-contained.
Development

No branches or pull requests

3 participants