def reinstall(apk_path): cmd = "aapt dump badging %s" % apk_path ret, out, err = popen(cmd) # print ret, out, err pt_package_name = "package: name='" pt_launch_activity = "\nlaunchable-activity: name='" package_name = trivia.extract(out, pt_package_name, "'") launch_activity_name = trivia.extract(out, pt_launch_activity, "'") cmds = [ "adb uninstall %s" % package_name, "adb install %s" % apk_path, "adb shell am start -n %s/%s" % (package_name, launch_activity_name), ] for cmd in cmds: run(cmd)
def extract_sha1(content): return trivia.extract(content, "SHA1: ", "\n")
def extract_sha256(content): return trivia.extract(content, "SHA256: ", "\n")
def extract_target_sdk(content): return trivia.extract(content, "targetSdkVersion:'", "'")
def extract_md5(content): return trivia.extract(content, "MD5: ", "\n")
def extract_min_sdk(content): return trivia.extract(content, "sdkVersion:'", "'")
def extract_version_name(content): return trivia.extract(content, "versionName='", "'")
def extract_version_code(content): return trivia.extract(content, "versionCode='", "'")
def extract_launchable_activity(content): return trivia.extract(content, "\nlaunchable-activity: name='", "'")
def extract_package_name(content): return trivia.extract(content, "package: name='", "'")