Skip to content

Commit b636325

Browse files
committed
2014-9-3
1 parent e2dee8e commit b636325

File tree

6 files changed

+22
-10
lines changed

6 files changed

+22
-10
lines changed

python/batch_uninstall.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
#!/usr/bin/python
2+
#!coding=utf-8
23

34
import os
45
import sys
56

7+
#卸载手机上的第三方应用
8+
69
def uninstall():
710
os.popen("adb wait-for-device")
811
print "start uninstall..."

python/getApp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
def get_current_package_name():
1111
pattern = re.compile(r"[a-zA-Z0-9\.]+/.[a-zA-Z0-9\.]+")
1212
os.popen("adb wait-for-device")
13-
out = os.popen("adb shell dumpsys input | findstr FocusedApplication").read()
13+
out = os.popen("adb shell dumpsys window w | " + find_util + " \/ | " + find_util + " name=").read()
1414
package_name = pattern.findall(out)[0].split("/")[0]
1515

1616
return package_name

python/get_current_activity.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
#!/usr/bin/python
2+
#!coding=utf-8
23

34
import os
45
import platform
56
import re
67
import sys
78

8-
PATH = lambda p: os.path.abspath(
9-
os.path.join(os.path.dirname(__file__), p)
10-
)
9+
#获取设备当前界面的activity,保存至当前目录下的CurrentActivity.txt文件中
10+
11+
PATH = lambda p: os.path.abspath(p)
1112

1213
system = platform.system()
1314
if system is "Windows":
@@ -19,7 +20,7 @@
1920

2021
def get_activity():
2122
os.popen("adb wait-for-device")
22-
out = os.popen("adb shell dumpsys input | " + find_util + " FocusedApplication").read()
23+
out = os.popen("adb shell dumpsys window w | " + find_util + " \/ | " + find_util + " name=").read()
2324
return pattern.findall(out)[0]
2425

2526

python/get_current_pkginfo.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1+
#!coding=utf-8
2+
13
import os
24
import tempfile
35
import re
46

7+
#使用aapt获取设备上当前应用的apk信息,保存至当前目录下的PackageInfo.txt中
8+
59
tempFile = tempfile.gettempdir()
610

711
def get_aapt():
@@ -16,7 +20,7 @@ def get_aapt():
1620
def get_current_package_name():
1721
pattern = re.compile(r"[a-zA-Z0-9\.]+/.[a-zA-Z0-9\.]+")
1822
os.popen("adb wait-for-device")
19-
out = os.popen("adb shell dumpsys input | findstr FocusedApplication").read()
23+
out = os.popen("adb shell dumpsys window w | findstr \/ | findstr name=").read()
2024
package_name = pattern.findall(out)[0].split("/")[0]
2125

2226
return package_name

python/get_package_name.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
#!/usr/bin/python
2+
#!coding=utf-8
23

34
import os
45
import platform
56
import re
67
import sys
78

8-
PATH = lambda p: os.path.abspath(
9-
os.path.join(os.path.dirname(__file__), p)
10-
)
9+
#获取当前应用的包名,保存至当前目录下的PackageName.txt文件中
10+
11+
PATH = lambda p: os.path.abspath(p)
1112

1213
system = platform.system()
1314
if system is "Windows":
@@ -19,7 +20,7 @@
1920

2021
def get_package_name():
2122
os.popen("adb wait-for-device")
22-
out = os.popen("adb shell dumpsys input | " + find_util + " FocusedApplication").read()
23+
out = os.popen("adb shell dumpsys window w | " + find_util + " \/ | " + find_util + " name=").read()
2324
package_name = pattern.findall(out)[0].split("/")[0]
2425

2526
return package_name

python/screenshot.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
#!/usr/bin/env python
2+
#!coding=utf-8
23

34
import os
45
import time
56

7+
#截取设备上的屏幕,保存至当前目录下的screenshot目录
8+
69
PATH = lambda p: os.path.abspath(p)
710

811
def screenshot():

0 commit comments

Comments
 (0)