-
-
Save pavlospt/110a911a6a20f9ed1bc7fbe0e7b26340 to your computer and use it in GitHub Desktop.
A simple bash script to enable demo mode on a Marshmallow+ device via ADB (based on http://bit.ly/295BHLx)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 wait-for-device | |
$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 nosim hide | |
$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 4g -e level 4 -e fully true | |
$ADB shell am broadcast -a com.android.systemui.demo -e command notifications -e visible false | |
$ADB shell am broadcast -a com.android.systemui.demo -e command clock -e hhmm 0800 | |
elif [ $CMD == "off" ]; then | |
$ADB shell am broadcast -a com.android.systemui.demo -e command exit | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment