How to Inspect Android Doze Mode and Deep Idle States Using ADB dumpsys deviceidle

Battery longevity remains one of the defining quality metrics for mobile devices running the Android operating system. To curb background battery depletion when a device is stationary and unplugged, Android introduced Doze Mode. Managed by the internal DeviceIdleController system service, Doze aggressively throttles background network access, defers job scheduler tasks, suspends alarm execution, and restricts wake locks through a multi-tiered state machine comprising Light Doze and Deep Doze. For mobile developers building real-time applications, enterprise sync services, or push-notification architectures, understanding how and when an application is restricted by Doze is critical. Using the Android Debug Bridge (ADB), engineers can inspect active idle states, audit power whitelists, and simulate Doze transitions via dumpsys deviceidle.

Architecture of the Android Doze State Machine

Android’s idle power management operates two distinct, coordinated state machines:

  • Light Doze: Activated shortly after the device screen turns off while running on battery power, even while in motion (such as in a user’s pocket). Light Doze imposes network restrictions and batches jobs while providing frequent maintenance windows.
  • Deep Doze: Triggered when the device remains stationary (detected via significant motion sensors and accelerometer readings), with the screen off and disconnected from a charger. Deep Doze enters a profound power-saving state where CPU wake locks are completely ignored, network access is suspended, and alarms are postponed until periodic maintenance intervals occur.

The Deep Doze state machine progresses sequentially through defined phases: ACTIVE → INACTIVE → IDLE_PENDING → SENSING → LOCATING → IDLE → IDLE_MAINTENANCE. The dumpsys deviceidle command provides direct visibility into each phase.

Establishing an ADB Connection and Verifying State

Ensure your Android device has Developer Options and USB Debugging enabled. Connect the device via USB or wireless ADB, and confirm connectivity:

adb devices

Confirm that your target device is detected before running diagnostic shell commands.

Querying the Complete Doze Diagnostic Dump

To inspect the comprehensive status of the DeviceIdleController service, execute the following command in your terminal:

adb shell dumpsys deviceidle

The diagnostic dump outputs the complete internal state of both Light and Deep Doze engines:

DEVICE IDLE CONTROLLER (dumpsys deviceidle)
-------------------------------------------------------------------------------
mState=IDLE
mLightState=IDLE
mScreenOn=false
mCharging=false
mForceIdle=false
mMotionListener.active=false
mCurDisplay=0
mMaintenanceStartTime=0
mNextIdlePendingDelay=+30m0s0ms
mNextIdleDelay=+1h0m0s0ms
mNextLightIdleDelay=+10m0s0ms
Whitelist (system):
  com.android.providers.telephony
  com.google.android.gms
  com.google.android.gsf
Whitelist (user):
  com.example.enterprise.sync

Inspecting Active Doze States and Motion Sensors

To quickly check whether the device is currently in an idle state or actively executing a maintenance window, filter the output for primary state variables:

adb shell dumpsys deviceidle | grep -E "mState|mLightState|mScreenOn|mCharging"

If mState=IDLE, the device is currently in Deep Doze. In this state, any network socket opened by non-whitelisted applications will fail or block until the state transitions to mState=IDLE_MAINTENANCE.

Auditing System and User Power Whitelists

Applications placed on the Doze battery optimization whitelist are permitted network access and can hold partial wake locks even while the operating system is in Deep Doze. There are two tiers of whitelists reported in the dump:

  • System Whitelist: Pre-installed system apps and Google Play Services required for core cellular telephony and push messaging (FCM).
  • User Whitelist: Third-party applications exempted by the user via Settings > Apps > Special App Access > Battery Optimization.

To display all whitelisted packages, query the dump with a grep filter:

adb shell dumpsys deviceidle whitelist

To temporarily add a package to the user whitelist for testing without manually navigating device settings menus:

adb shell dumpsys deviceidle whitelist +com.example.myapp

To remove the package from the whitelist:

adb shell dumpsys deviceidle whitelist -com.example.myapp

Simulating Doze Mode Transitions Without Waiting

Under normal device operation, transitioning into Deep Doze requires leaving the device completely undisturbed on a flat surface for 30 to 60 minutes. Android provides debug commands to force immediate state progression for rapid testing.

First, simulate unplugging the battery charger while maintaining your ADB connection:

adb shell dumpsys battery unplug

Turn the device screen off:

adb shell input keyevent 26

Step through the Deep Doze state machine sequentially using the step argument:

adb shell dumpsys deviceidle step deep

Each invocation of this command advances the state machine one step forward: from INACTIVE to IDLE_PENDING, then to SENSING, and finally into IDLE. Verify the current state after each step:

adb shell dumpsys deviceidle | grep "mState="

To force the device immediately into Deep Doze in a single command:

adb shell dumpsys deviceidle force-idle deep

Testing Application Sync and Push Delivery in Doze

With the device forced into IDLE, send high-priority push notifications or trigger background sync tasks. Observe whether your application respects Doze constraints: alarms scheduled via setExactAndAllowWhileIdle() will fire, whereas standard alarms scheduled via setExact() remain deferred until the next maintenance window.

Restoring Normal Device Power State

After completing your tests, restore the device to its normal operational power state and reconnect the simulated battery charger:

adb shell dumpsys deviceidle unforce
adb shell dumpsys battery reset

Confirm that the battery status returns to normal charging and mForceIdle=false is reported, returning the device to standard consumer power behaviour.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.