1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-03-21 01:59:13 +00:00

AndroidDevice: Added method to retrive primary abi of installed package

Tries to retireve the primary abi of a currently installed package on
device.
This commit is contained in:
Marc Bonnici 2016-12-08 15:55:18 +00:00
parent 4352e02806
commit f467f6f991

View File

@ -262,6 +262,24 @@ class AndroidDevice(BaseLinuxDevice): # pylint: disable=W0223
return line.split('=', 1)[1]
return None
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 list_packages(self):
"""
List packages installed on the device.