Skip to content

Instantly share code, notes, and snippets.

@JeppeLeth
Created August 10, 2017 06:36
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JeppeLeth/baba25db005960684c1a6c65b67a0aa9 to your computer and use it in GitHub Desktop.
Save JeppeLeth/baba25db005960684c1a6c65b67a0aa9 to your computer and use it in GitHub Desktop.
Android Demo mode activation using ADB
#!/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
# source https://android.googlesource.com/platform/frameworks/base/+/master/packages/SystemUI/docs/demo_mode.md
@Rambo4u
Copy link

Rambo4u commented Oct 2, 2021

adb shell settings put global sysui_demo_allowed 1

@Rambo4u
Copy link

Rambo4u commented Oct 2, 2021

#adb shell settings put global sysui_demo_allowed 1

@ChRriiZz
Copy link

ChRriiZz commented Jan 3, 2023

adb shell settings put global sysui_demo_allowed 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment