Androidacy / MagiskModuleManager

Previously known as Fox's Magisk Module Manager (FoxMMM), this app helps users find, install "Magisk Modules" - powerful little zips/apps for your device that plug into the Magisk framework.
https://www.androidacy.com
GNU Lesser General Public License v3.0
894 stars 32 forks source link

[BUG] AMM asks for root in the background even when both `Automatic modules update check` and `Check for app updates` are disabled. #94

Closed pheki closed 8 months ago

pheki commented 8 months ago

Describe the bug AMM asks for root in the background even when both Automatic modules update check and Check for app updates are disabled. It happens on reboot and also every once in a while (I believe it's at least once a day).

To Reproduce Steps to reproduce the behavior:

  1. Go to AMM -> Settings - Updates
  2. Disable Automatic modules update check and Check for app updates
  3. Go to Magisk -> Superuser
  4. Click on Androidacy Module Manager -> Revoke, Confirm on the popup
  5. Reboot phone
  6. Magisk popup appears (twice): "Superuser Request" "Androidacy Module Manager"
  7. Wait for some time (in my case it was a few hours)
  8. Magisk popup appears (twice again): "Superuser Request" "Androidacy Module Manager"

Expected behavior No background activity if automatic updates are disabled, especially no requests for root access.

Screenshots image

Device info:

androidacy-user commented 8 months ago

This is a side effect of how WorkManager works. We request root in the Application class, to have it available ASAP, and although we're not actually performing the update checks, our app still starts to run the schedule, thereby requesting root access.

However, the app will exit without executing anything else once it determines automatic update checks are shut off.

androidacy-user commented 8 months ago

Also, please note the latest version is 2.3.6, and fdroid may have outdated builds currently

pheki commented 8 months ago

Hey, thanks for maintaining this!

Also, please note the latest version is 2.3.6, and fdroid may have outdated builds currently

That's interesting, the badge on README.md shows 2.3.4 and that's also the latest git tag / Github Release

although we're not actually performing the update checks, our app still starts to run the schedule, thereby requesting root access

What other apps seem to do is to cancel the schedule when the user disables periodic checking, and re-enable it if the user enables it again.

Where the periodic checking is enabled: BackgroundUpdateChecker.kt#L476 API to cancel: WorkManager.cancelUniqueWork API to re-enable (already used to schedule): WorkManager.enqueueUniqueWork