Exemplo n.º 1
0
 def mobileAppQuite(self):
     connectDevices = dl().get_mobileDevices()
     commands = []
     for device in connectDevices:
         cmd = "adb -s %s shell am force-stop %s" % (device, self.packName)
         commands.append(cmd)
     Common().loop_threads(commands)
Exemplo n.º 2
0
 def deviceConnect(self):
     commands = []
     data = dl().get_Tv_IP()
     for IP in data:
         cmd = "adb connect %s" %(IP)
         commands.append(cmd)
     Common().loop_threads(commands)
Exemplo n.º 3
0
 def tvUninstall(self):
     connectDevices = dl().get_tvDevices()
     commands = []
     for device in connectDevices:
         cmd = "adb -s %s uninstall %s" % (device, self.packName)
         commands.append(cmd)
     Common().loop_threads(commands)
Exemplo n.º 4
0
 def MobileUninstall(self):
     connectDevices = dl().get_mobileDevices()
     commands = []
     for device in connectDevices:
         cmd = Adb().adbUninstall(device,self.packName)
         commands.append(cmd)
     Common().loop_threads(commands)
Exemplo n.º 5
0
 def MobileInstall(self, apk_path):
     connectDevices = dl().get_mobileDevices()
     commands =[]
     for device in connectDevices:
         cmd = Adb().adbInstall( device,apk_path)
         commands.append(cmd)
     Common().loop_threads(commands)
Exemplo n.º 6
0
 def mobileBack(self):
     connectDevices = dl().get_mobileDevices()
     commands = []
     for device in connectDevices:
         mobileBack = KeyCode().KeyCode_Back(device)
         commands.append(mobileBack)
     Common().loop_threads(commands)
Exemplo n.º 7
0
 def tvInstall(self, apk_path):
     connectDevices = dl().get_tvDevices()
     commands = []
     for device in connectDevices:
         cmd = "adb -s %s install -r %s" % (device, apk_path)
         commands.append(cmd)
     Common().loop_threads(commands)
Exemplo n.º 8
0
 def mobileHome(self):
     connectDevices = dl().get_mobileDevices()
     commands = []
     for device in connectDevices:
         mobileHome = KeyCode().KEYCODE_HOME(device)
         commands.append(mobileHome)
     Common().loop_threads(commands)
Exemplo n.º 9
0
 def MobileAppClear(self):
     connectDevices = dl().get_mobileDevices()
     commands = []
     for device in connectDevices:
         adbClear = Adb().adbClear(device, self.packName)
         commands.append(adbClear)
     Common().loop_threads(commands)
Exemplo n.º 10
0
    def installApk(self, apk_path):
        connectDevices = dl().get_MobileName()
        commands = []

        for device in connectDevices:
            cmd = "adb -s %s install -r %s" % (device, apk_path)
            commands.append(cmd)
        Common().loop_threads(commands)
Exemplo n.º 11
0
 def mobileApp(self):
     connectDevices = dl().get_MobileName()
     packName = APP().get_apk_package()
     commands = []
     for device in connectDevices:
         cmd = "adb -s %s shell am force-stop %s" % (device, packName)
         commands.append(cmd)
     Common().loop_threads(commands)
Exemplo n.º 12
0
 def MobileAppRun(self):
     launchable_activity = APP().get_apk_activity()
     pack_lauch = self.packName +"/"+ launchable_activity
     connectDevices = dl().get_mobileDevices()
     commands = []
     for device in connectDevices:
         cmd = "adb -s %s shell am start -n %s" % (device, pack_lauch)
         commands.append(cmd)
     Common().loop_threads(commands)
Exemplo n.º 13
0
    def Uninstall(self):
        packName = APP().get_apk_package()

        connectDevices = dl().get_Tv_IP()
        commands = []
        for device in connectDevices:
            cmd = "adb -s %s uninstall %s" % (device, packName)
            commands.append(cmd)
        Common().loop_threads(commands)
Exemplo n.º 14
0
 def get_apk_activity(self):
     cmd = Common().aaPath() + " | findstr launchable-activity:"
     result = ""
     p = subprocess.Popen(cmd, stdout=subprocess.PIPE,
                          stderr=subprocess.PIPE,
                          stdin=subprocess.PIPE, shell=True)
     (output, err) = p.communicate()
     if output != "":
         result = output.split()[1].decode()[6:-1]
     return result
Exemplo n.º 15
0
 def lauchApp(self):
     launchable_activity = APP().get_apk_activity()
     packName = APP().get_apk_package()
     pack_lauch = packName + "/" + launchable_activity
     connectDevices = dl().get_Tv_IP()
     commands = []
     for device in connectDevices:
         cmd = "adb -s %s shell am start -n %s" % (device, pack_lauch)
         commands.append(cmd)
     Common().loop_threads(commands)
Exemplo n.º 16
0
 def get_apk_package(self):
     cmd = Common().aaPath()+ " | findstr package:"
     result = ""
     p = subprocess.Popen(cmd, stdout=subprocess.PIPE,
                          stderr=subprocess.PIPE,
                          stdin=subprocess.PIPE, shell=True)
     (output, err) = p.communicate()
     output = str(output, encoding='utf8')
     if output != "":
         result = output.split()[1][6:-1]
     return result
Exemplo n.º 17
0
 def get_apk_name(self):
     cmd = Common().aaPath() + " | findstr application-label-zu: "
     result = ""
     p = subprocess.Popen(cmd, stdout=subprocess.PIPE,
                          stderr=subprocess.PIPE,
                          stdin=subprocess.PIPE, shell=True)
     (output, err) = p.communicate()
     output = str(output, encoding='utf8')
     if output != "":
         result = output.split("'")[1]
     return result
Exemplo n.º 18
0
 def get_apk_version(self):
     cmd = Common().aaPath()
     result = ""
     p = subprocess.Popen(cmd, stdout=subprocess.PIPE,
                          stderr=subprocess.PIPE,
                          stdin=subprocess.PIPE, shell=True)
     (output, err) = p.communicate()
     if output != "":
         result = output.split()[3].decode()[12:]
         result = result.split("'")[1]
     return result
Exemplo n.º 19
0
                    elif i == '7':
                        TvCase().tvAppClear()
                        break
                    elif i == '8':
                        TvCase().tvHome()
                        break
                    elif i == '9':
                        TvCase().tvBack()
                        break
                    else:
                        startInit().Case_Select()
            elif i == '3':
                Adb().adbDisconnect()
                break
            elif i == '4':
                Adb().adbRestart()
                break
            elif i == '5':
                Adb().cmdKill()
                break
            elif i == 'e':
                exit(0)
            else:
                print("try")
                continue


if __name__ == '__main__':
    apk_path = Common().apkPath()
    apk_name = APP().get_apk_package()
    startInit().Case_Select()
Exemplo n.º 20
0
 def get_apk_size(self):
     size = os.path.getsize(Common().apkPath()) / (1024 * 1000)
     return('%.2f' % size)+ "M"  #保留小数点后两位