mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-02-21 20:38:57 +00:00
Fix for packages without launch activities
If the package has no defined launch activity you must call the activity manager in a different way.
This commit is contained in:
parent
712c79020d
commit
ff5f48b7e7
@ -122,7 +122,8 @@ class ApkWorkload(Workload):
|
|||||||
:package: The package name of the app. This is usually a Java-style name of the form
|
:package: The package name of the app. This is usually a Java-style name of the form
|
||||||
``com.companyname.appname``.
|
``com.companyname.appname``.
|
||||||
:activity: This is the initial activity of the app. This will be used to launch the
|
:activity: This is the initial activity of the app. This will be used to launch the
|
||||||
app during the setup.
|
app during the setup. Many applications do not specify a launch activity so
|
||||||
|
this may be left blank if necessary.
|
||||||
:view: The class of the main view pane of the app. This needs to be defined in order
|
:view: The class of the main view pane of the app. This needs to be defined in order
|
||||||
to collect SurfaceFlinger-derived statistics (such as FPS) for the app, but
|
to collect SurfaceFlinger-derived statistics (such as FPS) for the app, but
|
||||||
may otherwise be left as ``None``.
|
may otherwise be left as ``None``.
|
||||||
@ -168,6 +169,7 @@ class ApkWorkload(Workload):
|
|||||||
self.apk_version = None
|
self.apk_version = None
|
||||||
self.logcat_log = None
|
self.logcat_log = None
|
||||||
|
|
||||||
|
|
||||||
def init_resources(self, context):
|
def init_resources(self, context):
|
||||||
self.apk_file = context.resolver.get(wlauto.common.android.resources.ApkFile(self),
|
self.apk_file = context.resolver.get(wlauto.common.android.resources.ApkFile(self),
|
||||||
version=getattr(self, 'version', None),
|
version=getattr(self, 'version', None),
|
||||||
@ -183,7 +185,7 @@ class ApkWorkload(Workload):
|
|||||||
|
|
||||||
def setup(self, context):
|
def setup(self, context):
|
||||||
self.initialize_package(context)
|
self.initialize_package(context)
|
||||||
self.start_activity()
|
self.launch_package()
|
||||||
self.device.execute('am kill-all') # kill all *background* activities
|
self.device.execute('am kill-all') # kill all *background* activities
|
||||||
self.device.clear_logcat()
|
self.device.clear_logcat()
|
||||||
|
|
||||||
@ -225,8 +227,11 @@ class ApkWorkload(Workload):
|
|||||||
self.reset(context)
|
self.reset(context)
|
||||||
self.apk_version = host_version
|
self.apk_version = host_version
|
||||||
|
|
||||||
def start_activity(self):
|
def launch_package(self):
|
||||||
output = self.device.execute('am start -W -n {}/{}'.format(self.package, self.activity))
|
if not self.activity:
|
||||||
|
output = self.device.execute('am start -W {}'.format(self.package))
|
||||||
|
else:
|
||||||
|
output = self.device.execute('am start -W -n {}/{}'.format(self.package, self.activity))
|
||||||
if 'Error:' in output:
|
if 'Error:' in output:
|
||||||
self.device.execute('am force-stop {}'.format(self.package)) # this will dismiss any erro dialogs
|
self.device.execute('am force-stop {}'.format(self.package)) # this will dismiss any erro dialogs
|
||||||
raise WorkloadError(output)
|
raise WorkloadError(output)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user