Skip to content

Commit c1477ab

Browse files
authored
Merge pull request #20 from AfzalivE/master
Added a self-script that toggles "test mode"
2 parents a7f73dd + 19be371 commit c1477ab

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

self_scripts/toggle_test_mode.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#-*- coding:UTF-8 -*-
2+
import sys
3+
import os
4+
import subprocess
5+
6+
adb_path = os.getenv('adb_path')
7+
serial = os.getenv('serial')
8+
9+
get_window_animation_scale_cmd = "{0} -s {1} shell settings get global window_animation_scale".format(adb_path, serial)
10+
get_transition_animation_scale_cmd = "{0} -s {1} shell settings get global transition_animation_scale".format(adb_path, serial)
11+
get_animator_duration_scale_cmd = "{0} -s {1} shell settings get global animator_duration_scale".format(adb_path, serial)
12+
13+
get_cmds = [get_window_animation_scale_cmd, get_transition_animation_scale_cmd, get_animator_duration_scale_cmd]
14+
15+
for cmd in get_cmds:
16+
result = subprocess.check_output(cmd,
17+
stderr=subprocess.STDOUT,
18+
shell=True).strip()
19+
mode = "0.0"
20+
if result == "0.0":
21+
mode = "1.0"
22+
23+
put_window_animation_scale_cmd = "{0} -s {1} shell settings put global window_animation_scale {2}".format(adb_path, serial, mode)
24+
put_transition_animation_scale_cmd = "{0} -s {1} shell settings put global transition_animation_scale {2}".format(adb_path, serial, mode)
25+
put_animator_duration_scale_cmd = "{0} -s {1} shell settings put global animator_duration_scale {2}".format(adb_path, serial, mode)
26+
27+
put_cmds = [put_window_animation_scale_cmd, put_transition_animation_scale_cmd, put_animator_duration_scale_cmd]
28+
29+
for cmd in put_cmds:
30+
sys.stderr.write(cmd)
31+
result = subprocess.check_output(cmd,
32+
stderr=subprocess.STDOUT,
33+
shell=True).strip()
34+
35+
print(result)

0 commit comments

Comments
 (0)