From ba6889ea7facc622fdb91067cdca0992a9afd2e4 Mon Sep 17 00:00:00 2001 From: Marc Bonnici Date: Tue, 6 Feb 2018 15:23:25 +0000 Subject: [PATCH] android/workload: Move parameter from GameWorkload to ApkWorkload Class In addition to `GameWorkloads` some benchmarks also download additional data upon initialisation. Moving this parameter to the `ApkWorkload` parent class allows all APK based workloads to indicate that their data should not be cleared prior to running the workload. --- wlauto/common/android/workload.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/wlauto/common/android/workload.py b/wlauto/common/android/workload.py index fba8e428..a89007f2 100755 --- a/wlauto/common/android/workload.py +++ b/wlauto/common/android/workload.py @@ -195,6 +195,11 @@ class ApkWorkload(Workload): If ``True``, workload will check that the APK matches the target device ABI, otherwise any APK found will be used. '''), + Parameter('clear_data_on_reset', kind=bool, default=True, + description=""" + If set to ``False``, this will prevent WA from clearing package + data for this workload prior to running it. + """), ] def __init__(self, device, _call_super=True, **kwargs): @@ -404,7 +409,8 @@ class ApkWorkload(Workload): def reset(self, context): # pylint: disable=W0613 self.device.execute('am force-stop {}'.format(self.package)) - self.device.execute('pm clear {}'.format(self.package)) + if self.clear_data_on_reset: + self.device.execute('pm clear {}'.format(self.package)) # As of android API level 23, apps can request permissions at runtime, # this will grant all of them so requests do not pop up when running the app @@ -647,11 +653,6 @@ class GameWorkload(ApkWorkload, ReventWorkload): after setup and run"""), Parameter('assets_push_timeout', kind=int, default=500, description='Timeout used during deployment of the assets package (if there is one).'), - Parameter('clear_data_on_reset', kind=bool, default=True, - description=""" - If set to ``False``, this will prevent WA from clearing package - data for this workload prior to running it. - """), ] def __init__(self, device, **kwargs): # pylint: disable=W0613