from pathlib import Path exec(Path(__file__).with_name('capture-auto.py').read_text().split('orig=')[0]) orig={'cmd':sh('cat','/data/local/tmp/chrome-command-line'),'debug':sh('settings','get','global','debug_app'),'rotate':sh('cmd','window','user-rotation'),'fixed':sh('cmd','window','fixed-to-user-rotation')} try: sh('settings','put','global','debug_app','org.chromium.chrome') sh("printf '_ --disable-fre --no-first-run --disable-features=WebAppShortEdgesCutoutMode\n' > /data/local/tmp/chrome-command-line") sh('cmd','window','fixed-to-user-rotation','enabled');sh('cmd','window','user-rotation','lock','0') for _ in range(2):sh('am','force-stop','org.chromium.chrome');sh('am','start','-n','org.chromium.chrome/com.google.android.apps.chrome.Main');time.sleep(7) launch('FS Rotation') sh('input','tap','150','1320') shot('06-cover-portrait') sh('cmd','window','user-rotation','lock','1');shot('07-cover-landscape') sh('cmd','window','user-rotation','lock','0');shot('08-cover-return-portrait') launch('E2E Fullscreen',force_stop='');shot('09-portrait-locked-after-cover-rotation') finally: sh(f"printf '%s\n' '{orig['cmd']}' > /data/local/tmp/chrome-command-line") sh('am','force-stop','org.chromium.chrome') if orig['rotate'].startswith('free'):sh('cmd','window','user-rotation','free') else: sh('cmd','window','user-rotation',*orig['rotate'].split()) sh('cmd','window','fixed-to-user-rotation',orig['fixed']) if orig['debug']=='null':sh('settings','delete','global','debug_app') else:sh('settings','put','global','debug_app',orig['debug'])