Demo Mode for the Android System UI

Demo mode for the status bar allows you to force the status bar into a fixed state, useful for taking screenshots with a consistent status bar state, or testing different status icon permutations. Demo mode is available in recent versions of Android.

Enabling demo mode

Demo mode is protected behind a system setting. To enable it for a device, run:

adb shell settings put global sysui_demo_allowed 1

Protocol

The protocol is based on broadcast intents, and thus can be driven via the command line (adb shell am broadcast) or an app (Context.sendBroadcast).

Broadcast action

com.android.systemui.demo

Commands

Commands and subcommands (below) are sent as string extras in the broadcast intent.
Commands are sent as string extras with key command (required). Possible values are:

CommandSubcommandArgumentDescription
enterEnters demo mode, bar state allowed to be modified (for convenience, any of the other non-exit commands will automatically flip demo mode on, no need to call this explicitly in practice)
exitExits demo mode, bars back to their system-driven state
batteryControl the battery display
levelSets the battery level (0 - 100)
pluggedSets charging state (true, false)
powersaveSets power save mode (true, anything else)
networkControl the RSSI display
airplaneshow to show icon, any other value to hide
fullySets MCS state to fully connected (true, false)
wifishow to show icon, carriermerged to show a carrier merged (W+) connection, any other value to hide
levelSets wifi level (null or 0-4)
hotspotSets the wifi to be from an Instant Hotspot. Values: none, unknown, phone, tablet, laptop, watch, auto. (See DemoModeWifiDataSource.kt.)
numlevelsSets the default maximum number of levels (typically 5)
inflateTrue if numlevels should be increased by 1 (represents a carrier configuration)
mobileshow to show icon, any other value to hide
datatypeValues: 1x, 3g, 4g, e, g, h, lte, roam, any other value to hide
levelSets mobile signal strength level (null or 0-4)
slotSets the subscription ID for this demo mobile icon. Allows you to have multiple demo SIMs.
inflateTrue if there should be 5 bars instead of 4
satelliteshow to show icon, any other value to hide
connectionconnected, off, on, or unknown (matches SatelliteConnectionState enum)
levelSets satellite signal strength level (0-4)
carriernetworkchangeSets mobile signal icon to carrier network change UX when disconnected (show to show icon, any other value to hide)
simsSets the number of sims (1-8)
nosimshow to show icon, any other value to hide
barsControl the visual style of the bars (opaque, translucent, etc)
modeSets the bars visual style (opaque, translucent, semi-transparent)
statusControl the system status icons
volumeSets the icon in the volume slot (silent, vibrate, any other value to hide)
bluetoothSets the icon in the bluetooth slot (connected, disconnected, any other value to hide)
locationSets the icon in the location slot (show, any other value to hide)
alarmSets the icon in the alarm_clock slot (show, any other value to hide)
syncSets the icon in the sync_active slot (show, any other value to hide)
ttySets the icon in the tty slot (show, any other value to hide)
eriSets the icon in the cdma_eri slot (show, any other value to hide)
muteSets the icon in the mute slot (show, any other value to hide)
speakerphoneSets the icon in the speakerphone slot (show, any other value to hide)
notificationsControl the notification icons
visiblefalse to hide the notification icons, any other value to show
clockControl the clock display
millisSets the time in millis
hhmmSets the time in hh:mm

Examples

Enter demo mode

adb shell am broadcast -a com.android.systemui.demo -e command enter

Exit demo mode

adb shell am broadcast -a com.android.systemui.demo -e command exit

Set the clock to 12:31

adb shell am broadcast -a com.android.systemui.demo -e command clock -e hhmm
1231

Set mobile to 3 bars with LTE

adb shell am broadcast -a com.android.systemui.demo -e command network -e mobile show -e level 3 -e datatype lte

Set mobile to no bars with 3g

adb shell am broadcast -a com.android.systemui.demo -e command network -e mobile show -e level 0 -e datatype 3g

Set 2 SIMs with the same number of levels (so they'll be stacked)

adb shell am broadcast -a com.android.systemui.demo -e command network -e mobile show -e slot 10 -e level 1
adb shell am broadcast -a com.android.systemui.demo -e command network -e mobile show -e slot 11 -e level 2

Set 2 SIMs with different number of levels

adb shell am broadcast -a com.android.systemui.demo -e command network -e mobile show -e slot 10 -e level 1 -e inflate false
adb shell am broadcast -a com.android.systemui.demo -e command network -e mobile show -e slot 11 -e level 2 -e inflate true

Set the wifi level to max

adb shell am broadcast -a com.android.systemui.demo -e command network -e wifi
show -e level 4

Set carrier merged to max

adb shell am broadcast -a com.android.systemui.demo -e command network -e wifi carriermerged -e slot 3 -e level 4 -e numlevels 5

Show the satellite icon

# Sets mobile to be out-of-service, which is required for satellite to show
adb shell am broadcast -a com.android.systemui.demo -e command network -e mobile show -e level 0
# Sets satellite to be connected
adb shell am broadcast -a com.android.systemui.demo -e command network -e satellite show -e level 4 -e connection connected

Show the silent volume icon

adb shell am broadcast -a com.android.systemui.demo -e command status -e volume
silent

Empty battery, and not charging (red exclamation point)

adb shell am broadcast -a com.android.systemui.demo -e command battery -e level
0 -e plugged false

Hide the notification icons

adb shell am broadcast -a com.android.systemui.demo -e command notifications -e
visible false

Exit demo mode

adb shell am broadcast -a com.android.systemui.demo -e command exit

Example demo controller app in AOSP

frameworks/base/tests/SystemUIDemoModeController

Example script (for screenshotting purposes)

#!/bin/sh
CMD=$1

if [[ $ADB == "" ]]; then
  ADB=adb
fi

if [[ $CMD != "on" && $CMD != "off" ]]; then
  echo "Usage: $0 [on|off] [hhmm]" >&2
  exit
fi

if [[ "$2" != "" ]]; then
  HHMM="$2"
fi

$ADB root || exit
$ADB wait-for-devices
$ADB shell settings put global sysui_demo_allowed 1

if [ $CMD == "on" ]; then
  $ADB shell am broadcast -a com.android.systemui.demo -e command enter || exit
  if [[ "$HHMM" != "" ]]; then
    $ADB shell am broadcast -a com.android.systemui.demo -e command clock -e
hhmm ${HHMM}
  fi
  $ADB shell am broadcast -a com.android.systemui.demo -e command battery -e
plugged false
  $ADB shell am broadcast -a com.android.systemui.demo -e command battery -e
level 100
  $ADB shell am broadcast -a com.android.systemui.demo -e command network -e
wifi show -e level 4
  $ADB shell am broadcast -a com.android.systemui.demo -e command network -e
mobile show -e datatype none -e level 4
  $ADB shell am broadcast -a com.android.systemui.demo -e command notifications
-e visible false
elif [ $CMD == "off" ]; then
  $ADB shell am broadcast -a com.android.systemui.demo -e command exit
fi

See also: Tuner

SysUI also has a TunerActivity that can customize other behaviors of the status bar, like showing seconds in the clock. It is not officially supported as of Android P, but we do still have some support in code for it.

See go/enable-sysui-tuner for directions on enabling and launching the Tuner activity. Copied here for reference:

adb root &&
adb shell pm enable com.android.systemui/.tuner.TunerActivity &&
adb shell am start -n com.android.systemui/.tuner.TunerActivity

After running the above, you can also find the Tuner activity in the Settings app: Android Settings > System > System UI Tuner