Skip to content

Instantly share code, notes, and snippets.

@bbchriscesar
Created December 22, 2020 19:54
Show Gist options
  • Save bbchriscesar/30a951fbf3a1c8a1a36ebcd3d7e9218c to your computer and use it in GitHub Desktop.
Save bbchriscesar/30a951fbf3a1c8a1a36ebcd3d7e9218c to your computer and use it in GitHub Desktop.
import os
import time
udid = '99SAY1BJFV'
filename = 'videoRecord'
def startRecord(filename):
adb = 'adb -s ' + udid + ' shell screenrecord /sdcard/' + filename + '.mp4'
os.system(adb)
def pullVideo(filename):
adb = 'adb -s ' + udid + ' pull /sdcard/' + filename + '.mp4 ' + '/Users/christiannec/PycharmProjects/AndroidProjects/Video/'
os.system(adb)
def demoModeON():
adb1 = 'adb -s ' + udid + ' shell settings put global sysui_demo_allowed 1'
os.system(adb1)
adb2 = 'adb -s ' + udid + ' shell am broadcast -a com.android.systemui.demo -e command enter'
os.system(adb2)
adb3 = 'adb -s ' + udid + ' shell am broadcast -a com.android.systemui.demo -e command network -e wifi show -e level 4 -e mobile show -e level 4 -e datatype lte'
os.system(adb3)
adb4 = 'adb -s ' + udid + ' shell am broadcast -a com.android.systemui.demo -e command network -e fully true'
os.system(adb4)
adb4 = 'adb -s ' + udid + ' shell am broadcast -a com.android.systemui.demo -e command battery -e level 100 -e plugged false'
os.system(adb4)
adb5 = 'adb -s ' + udid + ' shell am broadcast -a com.android.systemui.demo -e command notifications -e visible false'
os.system(adb5)
adb6 = 'adb -s ' + udid + ' shell am broadcast -a com.android.systemui.demo -e command clock -e hhmm 0100'
os.system(adb6)
time.sleep(2)
def demoModeOff():
adb = 'adb -s ' + udid + ' shell am broadcast -a com.android.systemui.demo -e command exit'
os.system(adb)
time.sleep(2)
demoModeON()
startRecord(filename)
print('Press STOP and press ENTER to save the video')
os.system("""bash -c 'read -s -n 1 -p "Take a screenshot ..."'""")
pullVideo(filename)
demoModeOff()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment