From 4352e028067d3275d96cd5cdad074c3a68c805cc Mon Sep 17 00:00:00 2001 From: Marc Bonnici Date: Wed, 7 Dec 2016 16:31:47 +0000 Subject: [PATCH] APK Info: Added property to extract native code from an apk Looks for any native code present in an apk and stores the mapped abi(s) for use when selecting appropriate apks. --- wlauto/utils/android.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/wlauto/utils/android.py b/wlauto/utils/android.py index 0ce7d328..affb8ade 100644 --- a/wlauto/utils/android.py +++ b/wlauto/utils/android.py @@ -28,7 +28,7 @@ import re from wlauto.exceptions import DeviceError, ConfigError, HostError, WAError from wlauto.utils.misc import (check_output, escape_single_quotes, escape_double_quotes, get_null, - CalledProcessErrorWithStderr) + CalledProcessErrorWithStderr, ABI_MAP) MAX_TRIES = 5 @@ -164,6 +164,7 @@ class ApkInfo(object): self.label = None self.version_name = None self.version_code = None + self.native_code = [] self.parse(path) def parse(self, apk_path): @@ -183,6 +184,19 @@ class ApkInfo(object): elif line.startswith('launchable-activity:'): match = self.name_regex.search(line) self.activity = match.group('name') + elif line.startswith('native-code'): + apk_abis = [entry.strip() for entry in line.split(':')[1].split("'") if entry.strip()] + mapped_abis = [] + for apk_abi in apk_abis: + found = False + for abi, architectures in ABI_MAP.iteritems(): + if apk_abi in architectures: + mapped_abis.append(abi) + found = True + break + if not found: + mapped_abis.append(apk_abi) + self.native_code = mapped_abis else: pass # not interested