Due to the fact that uiauto apk files built on different machines will
be signed with different keys, adb will fail to overwrite a previous
version even when set to replace. This commit now will uninstall the
previous uiauto apk file if present before attempting to install the new
version.
The new method of using uiautomation 2 is by using instrumented apk files rather
than JAR files. This commit updates the base workload has been updated to
install/uninstall the new uiautomation APK files and to invoke the relevant
instrumentation.
Previously AndroidPerfWorkload broadcast media mounted unconditionally
inside push_assets and delete_assets. This change makes it so the
broadcast only happens if something was actually pushed/needs to be
delete.
Due to the limitations of UiAutomator, parameters are not allowed to contain
certain characters including spaces and newlines when passed on the command line.
The python UiAutomatorWorkload baseclasse has been updated to use a
ParameterDict when storing workload parameters.
Apkworkload setup phase performs many functionalities in
a single method that is broken down into short methods.
The split short methods can be called individually when
relevant use cases arise.
Renamed android device property from 'supported_eabis' to 'supported_abis' to be consistent with linux device.
Updated dex2oat workload to use new property name.
Previously when retrieving apks only it's name would be used to choose
an apk. Now the native code reported by the apk is used to determine
the correct version to run for the specific device. It tries to
match the primary abi of device with native code before falling back to
using a compatible apk.
When using the check_abi parameter it no longer relies on naming convention
and only allows apks with native code supporting a devices primary abi to be
used.
Updated the relevant documentation.
Moved broadcast to super. Mandatory and Default are XOR
Added a longer wait for sync to finish. Increases reliability on certain phones
Changed recipient to not mandatory and a default set
Wait for sync when launching gmail from the sharing feature
Fix: cornercase where image viewer already points to working directory. Refactored code due to duplication
Added new function to BaseUiAutomation class to find a folder in the gallery
- Updated the revent parser to handle the new revent format.
- Updated the revent parser to expose device info and recording
metatdata.
- The parser can now be used in streaming and non-streaming mode (stream
events from the file as they are being accessed, or read them all in
at once).
- -g option added to "record" command to expose the gamepad recording
mode.
- Corrected code highlighting and phase names in documentation
- Fixed check_states paremeter not being honoured
- Moved state dependencies check to happen earlier in execution
and to be a user facing error
Previously if trying to downgrade an app using the `-r` option of
`adb install` the `INSTALL_FAILED_VERSION_DOWNGRADE` error would occur.
The app is now uninstalled first to prevent this.
Since initilize only runs once per workload, we can't set variables required
for each iteration in initilize. Revent workload was setting its file paths
in initilize, now moved to setup.
APK Resolution is now handled a bit differently to try maximise the likelyhood
of a workload running.
Like before `force_install` will always try to install the host version, if it
is not present or is not a correct version, it will error.
`check_apk` has changed so that when it is `True` it will prefer to use the host
side APK. If it is not there, or not a suitable version and/or abi and the target
already has a correct version of the app, the target app will be used. When it is
to `False` WA will prefer the target version of the app so long as it is a valid
version, if it is not then it will fallback to the host side APK.
Super works by having a iterator of parent classes to ensure each is called
once and only once. WA calls some parent methods in classes with multiple
inheritenceconditionally so calls them directly instread. This breaks super
which ends up calling some methods multiple times.
To work around this until workloads are reworked to use composition rather than
inheritance, all classes that that subclass `Workload` directly no longer use
`super`.
Implement new method to enforce that a valid apk version is used to run
the workload. Based on a min and max range of apk versions tested
during development.
- Device subclasses should provide their own implementation.
Default behaviour is to raise a `NotImplementedError`
- Workload subclasses can set `requires_network` to `True` and
network connectivity check will be performed during `setup()`
Add method to automatically check against a dictionary of known package
versions that don't work well with AndroidUiAutoBenchmark workloads.
Raises an exception if found.
- Added statedetect.py in utils which is a standalone module that
contains all the methods needed for state detection
- Modified the setup() and run() methods of the GameWorkload class
in common/android/workload.py to have a parameter that enables
state checks and run the check after setup and run if requested.
State detection uses the template matching method available in
OpenCV to determine the state of the workload by detecting
predefined unique elements on a screenshot from the device.
Issue: On some devices, _grant_requested_permissions may throw an
error when trying to grant permissions that were already granted
at install time using 'adb install -g'.
Fix: Surround permission grant method for API 23+ with try/except
Issue: Currently, _grant_requested_permissions skips all lines after
the first line not starting with 'android.permission'. This causes
a problem for apps where some required permissions appear after a
non-matching line e.g. Google Slides.
Fix: Don't break on non-matching line until end of section is reached
- Check the APK's versionName property against the workload's
expected version if specified
- If workload specifies check_abi param, try to get APK from
ABI-specific path on the host
- Add variant_name param to APK resource-getter for backwards
compatibility of dex2oat and peacekeeper
Issue: For certain installation errors, it is possible for WA to
incorrectly report that an APK was reinstalled while it actually
wasn't, leading to bugs later on in the run.
Fix:
- Add the '-r' flag to adb install when reinstalling, to make sure
APK is replaced.
- Add '-g' flag for API 23 and higher, to grant all permissions that
would otherwise be requested at runtime (similar to pre-API 23)
Previously the WA device name was used when searching for revent files.
Since most were `generic_android` this made it difficult to keep revent
files for multiple android devices. Now it the device model is used instead.
If a file with the device model is not found it will fall back to the WA
device name.