How to grant permissions required by some features on non-root device?

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 needed 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 development kit (just download the command line tools) from Google. ("ADB" can also be downloaded in small standalone installer created by XDA forum member)

1. Connect your Android device to the computer with USB data cable.

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 not or errors encountered, you need to manually install the correct USB driver for your Android device. This universal Android USB driver for Windows provided by Google should work for most Android devices, just manually install it (select "Android ADB Interface" or "Android Composite ADB Interface").

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 may appear on the Android device, asking for authorization for the USB debugging connected computer. Accept it with "Always allow from this computer" checked.

7. For different features, you need to run slight different command (without quotes) in the shell/terminal/command-prompt to grant the corresponding permission:

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.WRITE_SECURE_SETTINGS

8. (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 permission to Greenify.

9. You may need to force stop Greenify (in Settings - Apps) and restart it for the granted permissions to take effect.

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.

Feedback and Knowledge Base