Esempio n. 1
0
    def RunApkProgram(apk_packet_name, activity_name):
        '''
        函数功能:将一个apk文件运行起来
        参数:apk_packet_name  包名
             activity_name  activity 活动的名称
        例子:adb shell am start -n com.android.browser/com.android.browser.BrowserActivity    
        '''
        index = activity_name.find(activity_name)
        if index == 0:
            #处理:adb shell am start -n com.android.browser/com.android.browser.BrowserActivity
            command = "adb shell am start -n  %s/%s" % (apk_packet_name,
                                                        activity_name)

        index = activity_name.find(".")
        if index == 0:
            #处理:adb shell am start -n com.android.browser/.BrowserActivity
            command = "adb shell am start -n  %s/%s" % (apk_packet_name,
                                                        activity_name)
        else:
            #处理:adb shell am start -n com.android.browser/BrowserActivity 在前边加一个.
            command = "adb shell am start -n  %s/.%s" % (apk_packet_name,
                                                         activity_name)

        print command
        util.sh(command, False, False, False)
Esempio n. 2
0
 def UninstallApk(apk_packet_name):
     '''
     函数功能:卸载一个apk文件
     参数:apk_packet_name 包名称
     例子:adb uninstall com.doodoobird.anttest 
     '''
 
     command = "adb uninstall %s"%(apk_packet_name)
     util.sh(command, False, False, False) 
Esempio n. 3
0
    def UninstallApk(apk_packet_name):
        '''
        函数功能:卸载一个apk文件
        参数:apk_packet_name 包名称
        例子:adb uninstall com.doodoobird.anttest 
        '''

        command = "adb uninstall %s" % (apk_packet_name)
        util.sh(command, False, False, False)
Esempio n. 4
0
 def ClearDebugModel(apk_packet_name):
     '''
     函数功能:清楚指定应用的调试标签
     参数:apk_packet_name 应用的包名
     例子: adb shell am clear-debug-app 
     '''
     
     command = "adb shell am clear-debug-app"
     util.sh(command, False, False, False)
Esempio n. 5
0
 def StopApkProgram(apk_packet_name):
     '''
     函数功能:终止一个apk文件的运行
     参数:apk_packet_name 被终止apk文件的包名
     例子: adb shell am force-stop com.lt.test
     '''
     command = "adb shell am force-stop %s" % (apk_packet_name)
     print command
     util.sh(command, False, False, False)
Esempio n. 6
0
    def ClearDebugModel(apk_packet_name):
        '''
        函数功能:清楚指定应用的调试标签
        参数:apk_packet_name 应用的包名
        例子: adb shell am clear-debug-app 
        '''

        command = "adb shell am clear-debug-app"
        util.sh(command, False, False, False)
Esempio n. 7
0
 def StopApkProgram(apk_packet_name):
     '''
     函数功能:终止一个apk文件的运行
     参数:apk_packet_name 被终止apk文件的包名
     例子: adb shell am force-stop com.lt.test
     '''
     command = "adb shell am force-stop %s"%(apk_packet_name)
     print command
     util.sh(command, False, False, False)
Esempio n. 8
0
 def DevicesListStatus():
     '''
     函数功能:列举出当前运行模拟器的状态
     参数:无
     例子:adb devices
     '''
     command = "adb devices"
     print command
     #process = ShellIO(command)
     util.sh(command, False, False, False)
Esempio n. 9
0
 def DeleteEmulator(emulator_name):
     '''
     函数功能:删除指定的模拟器
     参数:emulator_name 模拟器的名称
     例子:android delete avd –n android4.2.2
     '''    
     command = "android delete avd -n %s"%(emulator_name)
     print command
     #process = ShellIO(command)
     util.sh(command, False, False, False)
Esempio n. 10
0
 def RunEmulator(emulator_name):
     '''
     函数功能:运行模拟器
     参数:emulator_name 模拟器的名称
     例子:emulator -avd android4.2.2
     '''
     command = "emulator -avd %s"%(emulator_name)
     print command
     #process = util.ShellIO(command)
     util.sh(command, False, False, True)
Esempio n. 11
0
    def SetDebugModel(apk_packet_name):
        '''
        函数功能:将指定的apk程序设置为调试模式
        参数:apk_packet_name  监控目标apk的包名
        例子:adb shell am set-debug-app -w com.android.browser
        '''

        command = "adb shell am set-debug-app -w %s" % (apk_packet_name)
        print command
        util.sh(command, False, False, False)
Esempio n. 12
0
 def SetDebugModel(apk_packet_name):
     '''
     函数功能:将指定的apk程序设置为调试模式
     参数:apk_packet_name  监控目标apk的包名
     例子:adb shell am set-debug-app -w com.android.browser
     '''
 
     command = "adb shell am set-debug-app -w %s"%(apk_packet_name)
     print command
     util.sh(command, False, False, False)
Esempio n. 13
0
 def InstallApk(apk_file_path, emulator_name=None):
     '''
     函数功能:安装一个apk文件到模拟器
     参数:apk_file_path 要安装的apk文件的路径
     例子:adb install SoundRecorder.apk
     '''
     if emulator_name==None:
         command = "adb install %s"%(apk_file_path)
     else:
         command = "adb -s %s install %s"%(emulator_name,apk_file_path)
     util.sh(command, False, False, False)
Esempio n. 14
0
 def ApktoolDecodeStatic(self, apkFilePath, apkDecodeFolderPath):
     '''
     函数功能:使用apktool对apk文件进行解码
     参数:apkFilePath 待解码的apk文件的路径
          apkDecodeFolderPath 保存解码后内容的文件的路径
     apktool d <file.apk> <dir>
     '''
     pass
     command ="apktool d %s  %s"%(apkFilePath, apkDecodeFolderPath)
     print command
     util.sh(command, False, False, False)
Esempio n. 15
0
 def ApktoolDecodeStatic(self, apkFilePath, apkDecodeFolderPath):
     '''
     函数功能:使用apktool对apk文件进行解码
     参数:apkFilePath 待解码的apk文件的路径
          apkDecodeFolderPath 保存解码后内容的文件的路径
     apktool d <file.apk> <dir>
     '''
     pass
     command = "apktool d %s  %s" % (apkFilePath, apkDecodeFolderPath)
     print command
     util.sh(command, False, False, False)
Esempio n. 16
0
 def ApktoolDecode(self):
     '''
     函数功能:使用apktool对apk文件进行解码
     参数:apkFilePath 待解码的apk文件的路径
          apkDecodeFolderPath 保存解码后内容的文件的路径
     apktool d <file.apk> <dir>
     '''
     pass
     command ="apktool d %s  %s"%(self.apkFilePath, self.decoderFolderPath)
     print command
     util.sh(command, True, True, False)
Esempio n. 17
0
 def InstallApk(apk_file_path, emulator_name=None):
     '''
     函数功能:安装一个apk文件到模拟器
     参数:apk_file_path 要安装的apk文件的路径
     例子:adb install SoundRecorder.apk
     '''
     if emulator_name == None:
         command = "adb install %s" % (apk_file_path)
     else:
         command = "adb -s %s install %s" % (emulator_name, apk_file_path)
     util.sh(command, False, False, False)
Esempio n. 18
0
 def ApktoolDecode(self):
     '''
     函数功能:使用apktool对apk文件进行解码
     参数:apkFilePath 待解码的apk文件的路径
          apkDecodeFolderPath 保存解码后内容的文件的路径
     apktool d <file.apk> <dir>
     '''
     pass
     command = "apktool d %s  %s" % (self.apkFilePath,
                                     self.decoderFolderPath)
     print command
     util.sh(command, True, True, False)
Esempio n. 19
0
 def RunApkProgram(apk_packet_name, activity_name):
     '''
     函数功能:将一个apk文件运行起来
     参数:apk_packet_name  包名
          activity_name  activity 活动的名称
     例子:adb shell am start -n com.android.browser/com.android.browser.BrowserActivity    
     '''    
     index=activity_name.find(activity_name)
     if index==0:
         #处理:adb shell am start -n com.android.browser/com.android.browser.BrowserActivity
         command = "adb shell am start -n  %s/%s"%(apk_packet_name, activity_name)
     
     index = activity_name.find(".")
     if index==0:
         #处理:adb shell am start -n com.android.browser/.BrowserActivity
         command = "adb shell am start -n  %s/%s"%(apk_packet_name, activity_name)
     else:
         #处理:adb shell am start -n com.android.browser/BrowserActivity 在前边加一个.
         command = "adb shell am start -n  %s/.%s"%(apk_packet_name, activity_name)
         
         
     print command
     util.sh(command, False, False, False)