Skip to content

Instantly share code, notes, and snippets.

@watabee
Last active November 6, 2023 09:28
Show Gist options
  • Save watabee/bb8a9008996a4d3a428b51f0bbeb1ed5 to your computer and use it in GitHub Desktop.
Save watabee/bb8a9008996a4d3a428b51f0bbeb1ed5 to your computer and use it in GitHub Desktop.
Enter or exit demo mode for the Android System UI
function android-demo-mode() {
CMD=$1
if [[ $CMD != "on" && $CMD != "off" ]]; then
echo "Usage: $0 [on|off] [hhmm]" >&2
return 1
fi
if [[ "$2" != "" ]]; then
HHMM="$2"
fi
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
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
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment