def parse(self, apk_path): _check_env() command = [aapt, 'dump', 'badging', apk_path] logger.debug(' '.join(command)) output = subprocess.check_output(command) for line in output.split('\n'): if line.startswith('application-label:'): self.label = line.split(':')[1].strip().replace('\'', '') elif line.startswith('package:'): match = self.version_regex.search(line) if match: self.package = match.group('name') self.version_code = match.group('vcode') self.version_name = match.group('vname') 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
def parse(self, apk_path): _check_env() command = [aapt, 'dump', 'badging', apk_path] logger.debug(' '.join(command)) output = subprocess.check_output(command) for line in output.split('\n'): if line.startswith('application-label:'): self.label = line.split(':')[1].strip().replace('\'', '') elif line.startswith('package:'): match = self.version_regex.search(line) if match: self.package = match.group('name') self.version_code = match.group('vcode') self.version_name = match.group('vname') 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
def abi(self): if not self._abi: val = self.execute('uname -m').strip() for abi, architectures in ABI_MAP.iteritems(): if val in architectures: self._abi = abi break else: self._abi = val return self._abi
def abi(self): if not self._abi: val = self.execute('uname -m').strip() for abi, architectures in ABI_MAP.iteritems(): if val in architectures: self._abi = abi break else: self._abi = val return self._abi
def get_installed_package_abi(self, package): """ Returns the primary abi of the specified package if it is installed on the device, or ``None`` otherwise. """ output = self.execute('dumpsys package {}'.format(package)) val = None for line in convert_new_lines(output).split('\n'): if 'primaryCpuAbi' in line: val = line.split('=', 1)[1] break if val == 'null': return None for abi, architectures in ABI_MAP.iteritems(): if val in architectures: return abi return val
def get_installed_package_abi(self, package): """ Returns the primary abi of the specified package if it is installed on the device, or ``None`` otherwise. """ output = self.execute('dumpsys package {}'.format(package)) val = None for line in convert_new_lines(output).split('\n'): if 'primaryCpuAbi' in line: val = line.split('=', 1)[1] break if val == 'null': return None for abi, architectures in ABI_MAP.iteritems(): if val in architectures: return abi return val
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
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
def abi(self): val = self.getprop()['ro.product.cpu.abi'].split('-')[0] for abi, architectures in ABI_MAP.iteritems(): if val in architectures: return abi return val
def abi(self): val = self.getprop()['ro.product.cpu.abi'].split('-')[0] for abi, architectures in ABI_MAP.iteritems(): if val in architectures: return abi return val