Skip to content

Instantly share code, notes, and snippets.

@mikewest
Created May 13, 2016 23:10
Show Gist options
  • Save mikewest/58943294ad0e80a2b7482cc812c3824f to your computer and use it in GitHub Desktop.
Save mikewest/58943294ad0e80a2b7482cc812c3824f to your computer and use it in GitHub Desktop.
#!/bin/sh
if [ -z "$1" ]; then
shot_path=$(date +%Y-%m-%d-%H-%M-%S).mp4
else
shot_path="$*"
fi
trap ctrl_c INT
function ctrl_c() {
echo "** Trapped CTRL-C"
echo "** Downloading screencast"
sleep 2
adb shell am broadcast -a com.android.systemui.demo -e command exit
adb pull /sdcard/Movies/$shot_path .
alldone
}
function setup() {
adb shell settings put global sysui_demo_allowed 1
adb shell am broadcast -a com.android.systemui.demo -e command network -e mobile hide
adb shell am broadcast -a com.android.systemui.demo -e command battery -e level 100 -e plugged false
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 nosim hide
# Tweak this if you want the clock to changed
adb shell am broadcast -a com.android.systemui.demo -e command clock -e hhmm 1234
# Remove this if you want notifications to be availalbe
adb shell am broadcast -a com.android.systemui.demo -e command notifications -e visible false
echo When finished, run: adb shell am broadcast -a com.android.systemui.demo -e command exit
}
function alldone() {
adb shell am broadcast -a com.android.systemui.demo -e command exit
}
setup
adb shell screenrecord --bit-rate 6000000 /sdcard/Movies/$shot_path
echo "Finished"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment