Skip to content

Instantly share code, notes, and snippets.

@frapontillo
Created May 27, 2021 12:52
Show Gist options
  • Save frapontillo/7fa6f37a988728d99d094ac9b79d8092 to your computer and use it in GitHub Desktop.
Save frapontillo/7fa6f37a988728d99d094ac9b79d8092 to your computer and use it in GitHub Desktop.
Turn Android Demo Mode on and off
#!/bin/bash
on() {
adb shell settings put global sysui_demo_allowed 1 > /dev/null
adb shell am broadcast -a com.android.systemui.demo -e command enter > /dev/null
adb shell am broadcast -a com.android.systemui.demo -e command clock -e hhmm 1000 > /dev/null
adb shell am broadcast -a com.android.systemui.demo -e command network -e wifi show -e level 4 > /dev/null
adb shell am broadcast -a com.android.systemui.demo -e command network -e mobile show -e level 4 -e datatype lte > /dev/null
adb shell am broadcast -a com.android.systemui.demo -e command notifications -e visible false > /dev/null
adb shell am broadcast -a com.android.systemui.demo -e command battery -e level 100 -e plugged false > /dev/null
}
off() {
adb shell am broadcast -a com.android.systemui.demo -e command exit > /dev/null
adb shell settings put global sysui_demo_allowed 0 > /dev/null
}
MODE=$1
if [[ $MODE != "on" && $MODE != "off" ]]; then
echo "Usage: $0 [on|off]" >&2
exit
fi
adb shell settings put global sysui_demo_allowed 1
if [ $MODE == "on" ]; then
on;
else
off;
fi
echo "Android demo mode turned $MODE."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment