Exemplo n.º 1
0
def _apk_parse(args):
    (pkg_name, activity) = apkparse.parse_apk(args.filename)
    print json.dumps({
        'package_name': pkg_name,
        'main_activity': activity,
    },
                     indent=4)
Exemplo n.º 2
0
def _apk_parse(args):
    import atx.androaxml as apkparse
    (pkg_name, activity) = apkparse.parse_apk(args.filename)
    print(
        json.dumps({
            'package_name': pkg_name,
            'main_activity': activity,
        },
                   indent=4))
Exemplo n.º 3
0
def _apk_parse(args):
    import atx.androaxml as apkparse
    manifest = apkparse.parse_apk(args.filename)
    print(
        json.dumps(
            {
                'package_name': manifest.package_name,
                'main_activity': manifest.main_activity,
                'version': {
                    'code': manifest.version_code,
                    'name': manifest.version_name,
                }
            },
            indent=4))
Exemplo n.º 4
0
def main(path, serial=None, host=None, port=None, start=False):
    adb = adbkit.Client(host,
                        port).device(serial)  #adbutils.Adb(serial, host, port)

    # use qiniu paths
    if __apks.get(path):
        path = __apks.get(path)

    if re.match(r'^https?://', path):
        tmpdir = tempfile.mkdtemp(prefix='atx-install-')
        log.info("Create temp directory: %s", tmpdir)

        # FIXME(ssx): will not called when Ctrl+C pressed in windows git-bash
        atexit.register(clean, tmpdir)

        urlpath = path
        target = os.path.join(tmpdir, '_tmp.apk')
        path = target
        log.info("Download from: %s", urlpath)
        utils.http_download(urlpath, target)

    import atx.androaxml as apkparse
    manifest = apkparse.parse_apk(path)
    log.info("APK package name: %s", manifest.package_name)
    log.info("APK main activity: %s", manifest.main_activity)

    log.info("Push file to android device")
    adb_pushfile(adb, path, DEFAULT_REMOTE_PATH)

    log.info("Install ..., will take a few seconds")
    adb_must_install(adb, DEFAULT_REMOTE_PATH, manifest.package_name)
    log.info("Remove _tmp.apk")
    adb_remove(adb, DEFAULT_REMOTE_PATH)

    if start:
        log.info("Start app '%s'" % manifest.package_name)
        adb.raw_cmd('shell', 'am', 'start', '-n', manifest.package_name + '/' +
                    manifest.main_activity).wait()
    log.info("Success")
Exemplo n.º 5
0
def main(path, serial=None, host=None, port=None, start=False):
    adb = adbkit.Client(host, port).device(serial) #adbutils.Adb(serial, host, port)
    
    # use qiniu paths
    if __apks.get(path):
        path = __apks.get(path)

    if re.match(r'^https?://', path):
        tmpdir = tempfile.mkdtemp(prefix='atx-install-')
        log.info("Create temp directory: %s", tmpdir)
        
        # FIXME(ssx): will not called when Ctrl+C pressed in windows git-bash
        atexit.register(clean, tmpdir)

        urlpath = path
        target = os.path.join(tmpdir, '_tmp.apk')
        path = target
        log.info("Download from: %s", urlpath)
        utils.http_download(urlpath, target)

    package_name, main_activity = apkparse.parse_apk(path)
    log.info("APK package name: %s", package_name)
    log.info("APK main activity: %s", main_activity)

    log.info("Push file to android device")
    adb_pushfile(adb, path, DEFAULT_REMOTE_PATH)

    log.info("Install ..., will take a few seconds")
    adb_must_install(adb, DEFAULT_REMOTE_PATH, package_name)
    log.info("Remove _tmp.apk")
    adb_remove(adb, DEFAULT_REMOTE_PATH)

    if start:
        log.info("Start app '%s'" % package_name)
        adb.raw_cmd('shell', 'am', 'start', '-n', package_name+'/'+main_activity).wait()
    log.info("Success")
Exemplo n.º 6
0
def _apk_parse(args):
    (pkg_name, activity) = apkparse.parse_apk(args.filename)
    print json.dumps({
        'package_name': pkg_name,
        'main_activity': activity,
    }, indent=4)