summaryrefslogtreecommitdiffstats
path: root/packages/SystemUI/docs/demo_mode.md
blob: 258c76b85ee7cb40a3931157685b21e79847fdd3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
# 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.
<br/>
Commands are sent as string extras with key ```command``` (required). Possible values are:

Command              | Subcommand                 | Argument       | Description
---                  | ---                        | ---            | ---
```enter```          |                            |                | Enters 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)
```exit```           |                            |                | Exits demo mode, bars back to their system-driven state
```battery```        |                            |                | Control the battery display
                     | ```level```                |                | Sets the battery level (0 - 100)
                     | ```plugged```              |                | Sets charging state (```true```, ```false```)
```network```        |                            |                | Control the RSSI display
                     | ```airplane```             |                | ```show``` to show icon, any other value to hide
                     | ```fully```                |                | Sets MCS state to fully connected (```true```, ```false```)
                     | ```wifi```                 |                | ```show``` to show icon, any other value to hide
                     |                            | ```level```    | Sets wifi level (null or 0-4)
                     | ```mobile```               |                | ```show``` to show icon, any other value to hide
                     |                            | ```datatype``` | Values: ```1x```, ```3g```, ```4g```, ```e```, ```g```, ```h```, ```lte```, ```roam```, any other value to hide
                     |                            | ```level```    | Sets mobile signal strength level (null or 0-4)
                     | ```carriernetworkchange``` |                | Sets mobile signal icon to carrier network change UX when disconnected (```show``` to show icon, any other value to hide)
                     | ```sims```                 |                | Sets the number of sims (1-8)
                     | ```nosim```                |                | ```show``` to show icon, any other value to hide
```bars```           |                            |                | Control the visual style of the bars (opaque, translucent, etc)
                     | ```mode```                 |                | Sets the bars visual style (opaque, translucent, semi-transparent)
```status```         |                            |                | Control the system status icons
                     | ```volume```               |                | Sets the icon in the volume slot (```silent```, ```vibrate```, any other value to hide)
                     | ```bluetooth```            |                | Sets the icon in the bluetooth slot (```connected```, ```disconnected```, any other value to hide)
                     | ```location```             |                | Sets the icon in the location slot (```show```, any other value to hide)
                     | ```alarm```                |                | Sets the icon in the alarm_clock slot (```show```, any other value to hide)
                     | ```sync```                 |                | Sets the icon in the sync_active slot (```show```, any other value to hide)
                     | ```tty```                  |                | Sets the icon in the tty slot (```show```, any other value to hide)
                     | ```eri```                  |                | Sets the icon in the cdma_eri slot (```show```, any other value to hide)
                     | ```mute```                 |                | Sets the icon in the mute slot (```show```, any other value to hide)
                     | ```speakerphone```         |                | Sets the icon in the speakerphone slot (```show```, any other value to hide)
```notifications```  |                            |                | Control the notification icons
                     | ```visible```              |                | ```false``` to hide the notification icons, any other value to show
```clock```          |                            |                | Control the clock display
                     | ```millis```               |                | Sets the time in millis
                     | ```hhmm```                 |                | Sets 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 the wifi level to max

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


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)
```bash
#!/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
```