Since Android 6.0 (Marshmallow), Google has introduced a series of background restrictions to improve battery life and system responsiveness. These mechanisms—Doze, App Standby, and the broader Battery Optimization framework—decide when an app can run code, access the network, or wake the device. While they benefit most users, developers and power users sometimes need to adjust the defaults to keep essential apps functional.
Doze activates when the device is idle: screen off, unplugged, and stationary for a period of time. In Doze, the system enters a series of maintenance windows during which apps can perform deferred tasks such as syncing data. Outside those windows, network access and wakelocks are blocked.
App Standby monitors how often you interact with each app. If an app hasn’t been used for a while, Android classifies it as "idle" and restricts its background activities, similar to Doze but on a per‑app basis.
Starting with Android 9 (Pie), Adaptive Battery uses machine‑learning to predict which apps you’ll need soon and limits the background execution of less‑used apps. This works together with Doze and App Standby to conserve power.
adb shell dumpsys deviceidle – shows the current Doze state and the list of apps exempted.Exemptions are useful for apps that need to receive timely messages (e.g., VoIP, alarm clocks). Follow these steps:
Note: Exempted apps can consume more power, so limit this to essential services.
If you prefer command‑line control, you can add or remove apps from the Doze whitelist:
# Add an app to the whitelist
adb shell cmd deviceidle whitelist +com.example.myapp
# Remove an app from the whitelist
adb shell cmd deviceidle whitelist -com.example.myapp
These commands require USB debugging to be enabled.
Android does not provide a direct UI to change App Standby thresholds, but you can manually force an app into an idle state for testing:
# Put an app into standby (replace package name)
adb shell am set-inactive com.example.myapp true
# Remove the standby flag
adb shell am set-inactive com.example.myapp false
Adaptive Battery is on by default, but you can influence its behavior:
Some app categories require background execution even when Doze is active. Android provides special permissions:
If you develop an app, ensure you request these permissions responsibly; misuse can lead to Play Store policy violations.
While disabling optimizations can improve functionality, it also increases power consumption and may affect thermal performance on older devices. Additionally, some OEM skins (e.g., Xiaomi’s MIUI, Huawei’s EMUI) implement their own aggressive background‑kill policies that override stock Android settings. In those cases, you may need to adjust the manufacturer‑specific battery manager or use the device’s “Protected apps” list.
Android’s background restriction framework—Doze, App Standby, and Adaptive Battery—balances battery life with app responsiveness. By understanding how each mechanism works and using the built‑in UI or ADB tools to adjust exemptions, you can keep essential services running smoothly without sacrificing overall battery health. Regularly review your battery usage and tweak settings as your app habits evolve.









