import threading
import time
class base_thread(threading.Thread):
def __init__(self, func):
threading.Thread.__init__(self)
self.func = func
#print(type(self.func))
def run(self):
self.func
# -*- coding: utf-8 -*-
import os
import time
import sys
import glob
from Base.Threads import base_thread
#單文件安裝
def install(filename):
print(filename)
os.popen("adb install %s" % filename)
#批量安裝app,多線程安裝
def bact_install(dir):
if os.path.isdir(dir):
starttime = time.time()
filelist= glob.glob(dir + "*.apk")
threads = []
for i in range(0, len(filelist)):
threads.append(base_thread(install(filelist[i])))
for j in range(0, len(filelist)):
threads[j].start()
for k in range(0, len(filelist)):
threads[k].join()
print("總運(yùn)行時(shí)間"+str(time.time() - starttime))
else:
print("目錄不存在")
sys.exit(0)
#卸載app
def uninstall(packageName):
os.popen("adb wait-for-device")
print("start uninstall...")
os.popen("adb uninstall %s" % packageName)
最后編輯于 :
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。