How to Inspect Night Mode, Car Mode, and UI Scaling States on Android Using ADB dumpsys uimode

Modern Android applications adapt dynamically to changing environmental contexts—such as transitioning from light to dark theme at sunset, entering driving-optimised interfaces when connected to Android Auto or vehicle head units, or accommodating large displays and dock stations. These system-wide appearance states are governed by the Android framework’s UiModeManager service. When debugging dark theme rendering bugs, verifying automotive intent filters, or troubleshooting dock state triggers, manual UI interaction is often slow and non-deterministic. Through the Android Debug Bridge (ADB), the internal dumpsys uimode command gives developers direct access to real-time UI mode configurations, lock states, scheduled night transitions, and forced projection states.

Understanding UiModeManager and UI Mode Configurations

In the Android operating system, UiModeManagerService monitors physical sensor cues, user preferences, dock accessories, and vehicle interfaces to adjust the current Configuration.uiMode bitmask. This configuration controls three primary interface dimensions:

  • Night Mode: Controls system dark mode. Operating modes include MODE_NIGHT_NO (light theme), MODE_NIGHT_YES (forced dark theme), MODE_NIGHT_AUTO (twilight/sensor driven), and MODE_NIGHT_CUSTOM (custom time schedule or bedtime routine).
  • UI Mode Type: Reflects physical device or accessory context, such as UI_MODE_TYPE_NORMAL (standard smartphone/tablet), UI_MODE_TYPE_CAR (in-car projection or vehicle head unit), UI_MODE_TYPE_DESK (docked workstation), UI_MODE_TYPE_TELEVISION, or UI_MODE_TYPE_APPLIANCE.
  • Projection Modes: Tracks whether third-party projection systems (such as automotive projection or external display desktop experiences) have acquired UI locks to prevent standard phone rotation and display sleep.

Connecting via ADB and Dumping UI Mode State

To inspect the current status of UiModeManagerService, connect your Android device with USB debugging enabled and execute the diagnostic dump:

adb shell dumpsys uimode

The command outputs comprehensive operational telemetry, including current night mode configuration, night mode locks, twilight schedule coordinates, and registered car mode priorities.

Inspecting Night Mode and Twilight Automation Details

When night mode is set to automatic or custom scheduling, Android calculates twilight boundaries based on location telemetry or clock algorithms. To inspect how UiModeManager is currently evaluating night mode:

adb shell dumpsys uimode | grep -E "mNightMode|mComputedNightMode|mCustomNightMode"

The output reports values corresponding to framework constants:

  • mNightMode=1: Forced light mode (MODE_NIGHT_NO).
  • mNightMode=2: Forced dark mode (MODE_NIGHT_YES).
  • mNightMode=0: Automatic mode based on ambient light or twilight calculations.
  • mNightMode=3: Custom time schedule.

You can also check whether the computed night mode matches the active configuration:

adb shell dumpsys uimode | grep -A 5 "mTwilightManager"

Simulating and Overriding Night Mode via Command Line

For automated UI testing and layout regression verification, you can override the system-wide night mode dynamically without navigating settings menus:

# Force system-wide Dark Theme
adb shell cmd uimode night yes

# Force system-wide Light Theme
adb shell cmd uimode night no

# Restore automatic night mode based on sunset/sunrise
adb shell cmd uimode night auto

# Configure custom night mode time window (e.g. 21:00 to 07:00)
adb shell cmd uimode night custom 21:00 07:00

After executing the override, verify that your application properly reacts to onConfigurationChanged() by reloading dark assets, updating vector tint colours, and refreshing WebViews.

Inspecting and Testing Car Mode States

Applications designed for driving environments must listen for UiModeManager.ACTION_ENTER_CAR_MODE and adjust touch targets, font scaling, and distractions. To inspect whether car mode is currently active and which processes hold car mode locks:

adb shell dumpsys uimode | grep -A 10 "mCarModePackagePriority"

To simulate entering Car Mode during development:

# Enter Car Mode programmatically
adb shell cmd uimode car yes

# Check current UI mode configuration
adb shell dumpsys uimode | grep "mCurUiMode"

# Exit Car Mode and restore standard smartphone interface
adb shell cmd uimode car no

When Car Mode is toggled, observe how your application adjusts layout resources drawn from values-car/ qualifiers.

Auditing System Settings Backing UI Modes

The user-facing night mode preferences are backed by persistent records in the Android secure settings database. To audit these stored settings directly:

# Check UI night mode persistent value
adb shell settings get secure ui_night_mode

# Check dark theme schedule type (0: None, 1: Twilight, 2: Custom bedtime)
adb shell settings get secure dark_theme_custom_start_time
adb shell settings get secure dark_theme_custom_end_time

Using dumpsys uimode and ADB command-line overrides allows Android engineers and quality assurance teams to rapidly validate theme transitions, automotive adaptions, and dock integrations with deterministic, scriptable precision.

Get the best tech tips delivered straight to your inbox.

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