diff --git a/devlib/target.py b/devlib/target.py index a920655..27b1c4b 100644 --- a/devlib/target.py +++ b/devlib/target.py @@ -101,6 +101,10 @@ class Target(object): def abi(self): # pylint: disable=no-self-use return None + @property + def supported_abi(self): + return [self.abi] + @property @memoized def cpuinfo(self): @@ -828,6 +832,30 @@ class AndroidTarget(Target): def abi(self): return self.getprop()['ro.product.cpu.abi'].split('-')[0] + @property + @memoized + def supported_abi(self): + props = self.getprop() + result = [props['ro.product.cpu.abi']] + if 'ro.product.cpu.abi2' in props: + result.append(props['ro.product.cpu.abi2']) + if 'ro.product.cpu.abilist' in props: + for abi in props['ro.product.cpu.abilist'].split(','): + if abi not in result: + result.append(abi) + + mapped_result = [] + for supported_abi in result: + for abi, architectures in ABI_MAP.iteritems(): + found = False + if supported_abi in architectures and abi not in mapped_result: + mapped_result.append(abi) + found = True + break + if not found and supported_abi not in mapped_result: + mapped_result.append(supported_abi) + return mapped_result + @property @memoized def os_version(self): diff --git a/devlib/utils/android.py b/devlib/utils/android.py index e8ca78d..22aab95 100644 --- a/devlib/utils/android.py +++ b/devlib/utils/android.py @@ -27,7 +27,7 @@ import re from collections import defaultdict from devlib.exception import TargetError, HostError, DevlibError -from devlib.utils.misc import check_output, which, memoized +from devlib.utils.misc import check_output, which, memoized, ABI_MAP from devlib.utils.misc import escape_single_quotes, escape_double_quotes @@ -124,6 +124,7 @@ class ApkInfo(object): self.label = None self.version_name = None self.version_code = None + self.native_code = None self.parse(path) def parse(self, apk_path): @@ -143,6 +144,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 diff --git a/devlib/utils/misc.py b/devlib/utils/misc.py index d6a5093..f601686 100644 --- a/devlib/utils/misc.py +++ b/devlib/utils/misc.py @@ -41,7 +41,7 @@ from devlib.exception import HostError, TimeoutError # ABI --> architectures list ABI_MAP = { - 'armeabi': ['armeabi', 'armv7', 'armv7l', 'armv7el', 'armv7lh'], + 'armeabi': ['armeabi', 'armv7', 'armv7l', 'armv7el', 'armv7lh', 'armeabi-v7a'], 'arm64': ['arm64', 'armv8', 'arm64-v8a', 'aarch64'], }