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)
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)
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)
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)
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)
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)
def DevicesListStatus(): ''' 函数功能:列举出当前运行模拟器的状态 参数:无 例子:adb devices ''' command = "adb devices" print command #process = ShellIO(command) util.sh(command, False, False, False)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)