How to grant permissions required by some features on non-root device?
← Knowledge Base
Most of the basic features of Greenify work out of the box on non-root devices, still some useful additional features require a one-time privilege escalation procedure different than normal permissions, which is enforced by Android system. (This procedure is NOT required on rooted device)
This one-time procedure requires a computer with USB port, a USB data cable and a tiny tool called "ADB", which is part of the official Android platform tools from Google.
1. Connect your Android device to the computer with USB data cable. Ensure the required driver is correctly installed on the computer for your Android device. (For Windows PC, this official guide and driver list for common OEM might be helpful. If it does not work out, the official Google Android USB driver should work for most Android devices, just manually install it, and select "Android ADB Interface" or "Android Composite ADB Interface")
2. On the Android device, if you cannot find "Settings – Developer options", then go to "Settings – About", click the "Build number" entry many times until a toast message shows "You are now a developer". (Settings path may be slightly different on various Android devices)
3. Go back to "Settings – Developer options" (the new entry activated by the last step), enable "USB debugging".
4. If you have never used the USB debugging before, new hardware should now be detected on the computer. If nothing detected or errors encountered, you may need to manually install the correct USB driver for your Android device, as mentioned in step 1.
5. Open the shell/terminal/command-prompt on the computer, run "adb devices" (without quotes). If everything is properly configured, there should be at least one device in the output. If not, recheck the physical usb connection, "USB debugging" option on the Android device and the device driver installed on the computer.
A sample of the expected output of "adb devices"
List of devices attached
0701352d251c75ab device
6. A permission request dialog "Allow USB debugging?" may appear on the Android device, asking for authorization for the USB debugging connected computer. Please accept it.
7. For different features, you need to run slightly different commands (without quotes) in the shell/terminal/command-prompt to grant the corresponding permission:
Accessibility service run-on-demand:
adb -d shell pm grant com.oasisfeng.greenify android.permission.WRITE_SECURE_SETTINGS
Aggressive Doze on Android 7.0+ (non-root):
adb -d shell pm grant com.oasisfeng.greenify android.permission.WRITE_SECURE_SETTINGS
Doze on the Go:
adb -d shell pm grant com.oasisfeng.greenify android.permission.DUMP
Aggressive Doze (on device/ROM with Doze disabled):
adb -d shell pm grant com.oasisfeng.greenify android.permission.DUMP
Wake-up Tracker:
adb -d shell pm grant com.oasisfeng.greenify android.permission.READ_LOGS
Wake-up Cut-off: (Android 4.4~5.x)
adb -d shell pm grant com.oasisfeng.greenify android.permission.READ_LOGS
adb -d shell pm grant com.oasisfeng.greenify android.permission.WRITE_SECURE_SETTINGS
Background-free enforcement on Android 8+ (non-root):
adb -d shell pm grant com.oasisfeng.greenify android.permission.GET_APP_OPS_STATS
8. Force stop Greenify to let the granted permission take effect. You can either do it in system "Settings – Apps – Greenify – Force stop", or execute this command:
adb -d shell am force-stop com.oasisfeng.greenify
9. (Optional) If you don’t need the USB debugging functionality any more, you can disable it for security reason in "Settings – Developer options". It will not affect the granted permissions to Greenify (until being uninstalled).
All done. Now you can disconnect the USB cable and enjoy the additional exciting features of Greenify!
The permission granted via the above one-time procedure will last until Greenify is uninstalled or your device is factory reset.