[Feature Request] Make usage access and battery-optimization exemption optional
Guidelines
- [x] I have read the FAQ and it doesn't cover my request.
- [x] I have searched the issue tracker for open and closed issues that are similar to the feature request I want to file, without success.
- [x] I'm on the latest version.
- [x] I'm not using a test build (alpha/beta/release-candidate).
- [x] This issue contains only one feature request.
Problem Description
Neo Backup will not leave onboarding or load the main UI unless every flag in Context.allPermissionsGranted is true. That includes permissions that are not required to create or restore an APK + app-data backup via root.
On first launch the app currently forces all of these before the home screen:
- Storage / all-files access (
MANAGE_EXTERNAL_STORAGEon API 30+) — acceptable. - A backup folder (SAF persistable URI) — acceptable.
- Ignore battery optimizations (
REQUEST_IGNORE_BATTERY_OPTIMIZATIONS) — not acceptable as a hard requirement. - Usage access (
PACKAGE_USAGE_STATS) — not acceptable as a hard requirement. I do not need app-size / cache stats.
The result is a full lock-out. Dismissing the usage-access or battery dialogs does not skip them. OnboardingPermsPage only calls onNext() when permissionsList is empty, and NeoActivity.resumeMain() only launches Main when allPermissionsGranted && persist_pageOnboarded > 2.
That is unlike Titanium Backup: a user-initiated foreground backup should work after root + a place to write files. Usage stats and a Doze whitelist are extras.
What each optional permission actually does:
- Usage access is used for
StorageStatsManager.queryStatsForPackage()so the UI can show APK / data / cache sizes. Root already reads/data/data,/data/app, and/system/app. Without this permission, size chips can show "—" or be hidden. Backup and restore still work. On some LineageOS 20+ builds the permission cannot even be granted from Settings (#941, #978), which currently blocks the entire app. - Battery-optimization exemption only helps scheduled / boot / exact-alarm / WorkManager jobs survive Doze and OEM killers. A backup started in the foreground does not need it. The code already has
persist.ignoreBatteryOptimization, used when the OEM has no battery-opt activity, but onboarding does not offer that as a user Skip.
SMS / call-log / contacts are already treated as granted unless special backups are enabled. Usage access and battery exemption should follow that same pattern.
Proposed Solution
Do not treat every onboarding permission as compulsory. Keep storage + backup folder required. Make usage access and battery exemption optional.
- Split the launch check:
- Required: storage access + backup directory set (root remains mandatory as today).
- Optional: usage access, ignore battery optimizations.
- Gate
resumeMain()/OnboardingPermsPage.onNext()on the required set only. - On the usage-stats and battery cards, add a secondary Skip / “Continue without this” action:
- Battery skip → set existing
persist.ignoreBatteryOptimization = true. - Usage-stats skip → new persist flag (e.g.
persist.ignoreUsageStats).
- Battery skip → set existing
- When skipped:
- Show "—" or hide size / cache UI.
- Warn or disable Scheduler (“unattended schedules need battery exemption”).
- Do not send the user back to onboarding on later launches if those two are still denied.
- Keep the same prompts in Settings so the user can grant them later.
This matches how special-backup permissions are already optional in PermissionUtils.kt.
Alternatives Considered
- Granting everything just to enter the app. Works, but forces a privacy-sensitive AppOps permission and a Doze whitelist for features I do not use.
- Leaving the app and using another backup tool. Possible, but NB already does the core job via root; only the permission gate is in the way.
- Workarounds such as
pm grant … PACKAGE_USAGE_STATSor disabling NB receivers / using IFW so the battery check is skipped. Fragile, ROM-specific, and should not be required. - Computing sizes via root (
duon/data/data/<pkg>) instead ofStorageStatsManager. Possible later, but not needed if sizes are simply optional.
Relevant information
- Device: Samsung A50, Redmi 4A
- Android Version: 11
- ROM: OneUI 3.1, LOS 18.1
- App's Version: 8.3.18
Code refs (main):
- src/main/java/com/machiav3lli/backup/utils/PermissionUtils.kt
- src/main/java/com/machiav3lli/backup/ui/pages/OnboardingPermsPage.kt
- src/main/java/com/machiav3lli/backup/ui/activities/NeoActivity.kt (resumeMain)
Related (grant failures, not this request): #941, #978
支持!!!作者虽然开源了软件,但是在有些机型上电源设置为无限制不可以实现的!建议将这些权限设置为可选项目。
支持!!!作者虽然开源了软件,但是在有些机型上电源设置为无限制不可以实现的!建议将这些权限设置为可选项目。
Don't know if the developer will consider or not but what I've done is to download the APK and modded it's dex to make the app believe that battery and usage access permission is granted , so now it works even without granting them the actual permissions.
支持!!!作者虽然开源了软件,但是在有些机型上电源设置为无限制不可以实现的!建议将这些权限设置为可选项目。
Don't know if the developer will consider or not but what I've done is to download the APK and modded it's dex to make the app believe that battery and usage access permission is granted , so now it works even without granting them the actual permissions.
我给开发者反馈了一个功能请求,#1062,开发者回复说已经给了一个可以跳过权限使用的按键,但是我确实没找到有这么一个按键可以不赋予电池无限制权限使用这个 APP。 I submitted feature request #1062 to the developers. The developer replied that they had already provided a button that lets you bypass the permission requirement, but I really couldn't find any such button that would let me use this app without granting it unrestricted battery permission.
Usage access is used for StorageStatsManager.queryStatsForPackage() so the UI can show APK / data / cache sizes. Root already reads /data/data, /data/app, and /system/app. Without this permission, size chips can show "—" or be hidden. Backup and restore still work. On some LineageOS 20+ builds the permission cannot even be granted from Settings (https://github.com/NeoApplications/Neo-Backup/issues/941, https://github.com/NeoApplications/Neo-Backup/issues/978), which currently blocks the entire app.
Using root to read files is far slower and energy-inefficient than reading system-reported properties (we already had intensive tests on a more important feature concerning detecting apps with data changed since last backup). So no, it's nothing close to be the same. On the blocked-permission issue, as @larsson5 noted in one of the issues you linked (and as already communicated multiple times in the community groups), since Android 15, there's a restriction on "restricted permissions" for apps not installed from Play Store. Here's the steps to solve it as larsson5 provided it:
The following workaround fixed it for me:
- Go to Settings → Apps → See all apps → Neo Backup.
- Tap the three-dot menu in the top-right corner.
- Select Allow restricted settings and confirm with your PIN/fingerprint.
- Then go to Settings → Apps → Special app access → Usage access → Neo Backup.
- Enable Usage access.
Battery-optimization exemption only helps scheduled / boot / exact-alarm / WorkManager jobs survive Doze and OEM killers. A backup started in the foreground does not need it. The code already has persist.ignoreBatteryOptimization, used when the OEM has no battery-opt activity, but onboarding does not offer that as a user Skip.
This is not only concerned with scheduling, but also with how long a work can go on, as in the last couple of Android releases (with Android 16 all got even more restricted) multiple restrictions were introduced on how long "background" jobs can go. This effects all backups, meaning even if the user is running one backup when the app is open, the backup could be killed by the system if it likes to (in previous Android versions there was even a setting to modify your restrictions' "profile" among the developer settings). So, I wouldn't like backups to get killed, then get spammed by users that nothing works.
In Neo Store I allowed for ignoring the permission, as Android TVs seems to miss the permission totally. For Neo Backup, concerning that rooting Android TVs is even far more limited (the one's that support it, run usually Linux too).
I submitted feature request https://github.com/NeoApplications/Neo-Backup/issues/1062 to the developers. The developer replied that they had already provided a button that lets you bypass the permission requirement, but I really couldn't find any such button that would let me use this app without granting it unrestricted battery permission.
I just noticed that you opened it in Neo Backup and not Neo Store. At that moment, I thought that the issue was on Neo Store, as I was navigating NS's issues before (somehow I landed nevertheless at your issue). That said, this issue is more fitting for now.
Added a fitting card to the roadmap
Usage access is used for StorageStatsManager.queryStatsForPackage() so the UI can show APK / data / cache sizes. Root already reads /data/data, /data/app, and /system/app. Without this permission, size chips can show "—" or be hidden. Backup and restore still work. On some LineageOS 20+ builds the permission cannot even be granted from Settings (#941, #978), which currently blocks the entire app.
Using root to read files is far slower and energy-inefficient than reading system-reported properties (we already had intensive tests on a more important feature concerning detecting apps with data changed since last backup). So no, it's nothing close to be the same. On the blocked-permission issue, as @larsson5 noted in one of the issues you linked (and as already communicated multiple times in the community groups), since Android 15, there's a restriction on "restricted permissions" for apps not installed from Play Store. Here's the steps to solve it as larsson5 provided it:
I'm running Vanilla Android, no Gapps etc so I personally don't care about Google Playstore or it's respective apps & Modding the dex to bypass unnecessary permissions of NB in my case is fine , so I'm no longer affected by the permissions NB asking at start-up as Modding the app itself is serving fine for me. Thanks