From 9d4aa4983aef3474804f38730b2cc390653db1f5 Mon Sep 17 00:00:00 2001 From: Sebastian Goscik Date: Wed, 24 Aug 2016 14:36:00 +0100 Subject: [PATCH] antutu: Fixed setting permissions It has been observed on some devices that the FINE_LOCATION premissions is required for antutu to run without asking for permissions at run time but this was not listed in the APK manifest. This caused issues on devices were only the permissions in the manifest can be granted. This commit sliences any error when trying to set this permission as well as only trying only on Android 6+ --- wlauto/workloads/antutu/__init__.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/wlauto/workloads/antutu/__init__.py b/wlauto/workloads/antutu/__init__.py index 86d67565..13cffa73 100644 --- a/wlauto/workloads/antutu/__init__.py +++ b/wlauto/workloads/antutu/__init__.py @@ -17,6 +17,7 @@ import os from collections import defaultdict, OrderedDict from wlauto import AndroidUiAutoBenchmark, Parameter, File +from wlauto.exceptions import DeviceError from wlauto.utils.android import ApkInfo @@ -80,8 +81,12 @@ class Antutu(AndroidUiAutoBenchmark): info = ApkInfo(antutu_3d) if not context.device.is_installed(info.package): self.device.install_apk(antutu_3d, timeout=120) - # Antutu doesnt seem to list this as one of its permissions, but it asks for it. - self.device.execute("pm grant com.antutu.ABenchMark android.permission.ACCESS_FINE_LOCATION") + if self.device.get_sdk_version() >= 23: + # Antutu doesnt seem to list this as one of its permissions, but on some devices it asks for it. + try: + self.device.execute("pm grant com.antutu.ABenchMark android.permission.ACCESS_FINE_LOCATION") + except DeviceError: + self.logger.debug("failed to grant ACCESS_FINE_LOCATION, continuing") super(Antutu, self).setup(context) def update_result(self, context):