def show_project_options(): devices = get_connected_devices() print_header(devices) package = get_project_package() apk_path = os.path.join(cur_dir, "build", "android", "bin", "app.apk") options = [] counter = 0 for d in devices: print d.serial_number print repeat("-", len(d.serial_number)) if d.has_package(package): options.append({ "function": d.uninstall, "arg": package }) print "(%s)\tUninstall %s from %s" % (counter, package, d.serial_number) counter += 1 if os.path.exists(apk_path): options.append({ "function": d.install, "arg": apk_path }) print "(%s)\tInstall %s to %s" % (counter, os.path.relpath(apk_path), d.serial_number) counter += 1 bl(1) print_common_commands() choice_handler(options)
def show_multi_uninstaller(package_filter): devices = get_connected_devices() print_header(devices) options = [] found = False counter = 0 for device in devices: packages = device.get_matching_packages(package_filter) if len(packages) == 0: continue found = True print device.serial_number print repeat("-", len(device.serial_number)) for package in packages: print "(%s) Uninstall %s from %s." % (counter, package, device.serial_number) options.append({ "function": device.uninstall, "arg": package }) counter += 1 bl(1) if not found: print "No packages found that start with '%s'." % package_filter bl(1) print_common_commands() choice_handler(options)
def do_immediate_uninstall(): devices = get_connected_devices() print "Checking devices: %s" % devices package = get_project_package() did_one = False for d in devices: if d.has_package(package): print "Uninstalling %s from %s" % (package, d.serial_number) d.uninstall(package) did_one = True if not did_one: print "No attached devices contained %s" % package