-
Notifications
You must be signed in to change notification settings - Fork 0
/
Demo_Adb_shell.py
43 lines (33 loc) · 975 Bytes
/
Demo_Adb_shell.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#__Coding:UTF-8__
import os
import time
#Install All apks from app
def installApps():
filepath = raw_input('Please Input the FilePath or FileName:')
#Get the files from the filepath
files = os.listdir(filepath)
for f in files:
print('adb install -r '+f)
text = os.popen('adb install -r app/'+f)
time.sleep(2)
print text.read()
#Delete APK by the packageName
def deleteApps():
packageName = raw_input('Please input the packageName:')
os.popen('adb uninstall '+packageName)
#Clear the Logcat
def clearLogCat():
print('start clear logcat')
os.popen('adb logcat -c')
while(True):
print('1:install All apks')
print('2:deleteAPP by packageName')
print('3:clear all logcat\n')
number =int(raw_input('Please input the Number:'))
if number == 1:
print('Install APPS')
installApps()
elif number == 2:
deleteApps()
elif number == 3:
clearLogCat()