install_apk() was using the default timeout of 30 seconds, this can
cause problems for some applications on slower targets. Since
installation is expected to be a long-ish operation, there is not reason
for the timeout to be this short.
This commit adjusts the timeout to 5 minutes, which should be a more
reasonable value for most applications. For some apps with particularly
large APKs, this may not be enough, but in those cases, the default
should already be overriden on per-worload bases.
Ran into a development target on which one of the values in getprop
output contained a new line. Updating getprop parsing logic to handle
such cases by switching to a regex.
A force flag has been added to the `install_apk` method which
ignores the check that the specified file is an apk. This is to support
the new UiAutomation Apk which have been given the extention .uiautoapk.
Adds a method to determine the appropriate method of triggering a media refresh
of a given list of file based on the devices android version and root status. If
a device is running android marshmallow and below or has root, trigger a refresh
of the files containing folder otherwise trigger a refresh of each individual
file.
In android N it is no longer allowed to trigger a media refresh of a directory
without root, therefore this method has been added to trigger a refresh of an
individual file.
On Android targets, WA collects device display information by running
"dumpsys window" during run initialisation. Previously, this was
redirectied into on-device file (under the working directory) and then
pulled from the target.
It looks like on Android-on-ChromeOS devices the redirect leads to an
"Unknown Error" and the resulting file is empty. To get around that,
this commit modfies the dumpsys command so that the output is collected
directly from the shell's stdout and then writen on the host.
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.
- renamed the capture method from "capture_view_hierachy" to
"capture_ui_hierarchy" to fix typo and make more descriptive.
- Change the file extension of the cature file to ".uix" because this is
the extension uiautomatorviewer looks for.
It is possible that the command executed by get_pids_of() will return
None (in cases where there are no running processes with the specified
name and the grep call didn't find anything). If that happens, then the
subsequent call to split() failed (as that is not a method of None). To
avoid this, substitute an empty string instead.
Adds support for passing -d option to "pm install", which allows
installing an APK when a newer version of the package is already present
on the device.
New method to force a re-index of the mediaserver cache for the
specified directory. Used in workloads that require external media files
as dependencies.
Dump window hierarchy view from uiautomator to a file when WA fails
during execution. Note: the xml file are pre-formatted after dump.
Implementation specific to android.device.
- 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)
Moved ``working_directory`` parameter to BaseLinuxDevice.
Changed the default ``binaries_directory`` for AndroidDevice to allow
WA binaries to be easily separated.
These are now gathered via `getprop` rather than trying to parse the
build.prop file directly.
This fixes issues with build.prop files that have imports.
Due to the previous commits, this command no longer works properly.
It turns out there is an issue with using multiple levels of escaping.
It seems that bash handles the backslashes and single quotes separately
incorrectly processing our escaping. To get around this we are writing the
sqlite command to a shell script file and running that.
This seems to be the only case in WA at the moment that requires this,
if more show up/when WA moves to devlib it should use the devlib shutil
mechanism.
Added two commands to WA to record and replay input events using revent.
As part of this also added the ability to get a device model from
android and linux device. This may need to be improved in the future.
Added:
get_binary_path: Checks binary_directory for the wanted binary, if
if its not there, it will use which to find a
system one. returns the full path
install_if_needed: will install a binary only if it is not present.
Changes:
- Busybox is now deployed to non-rooted devices
- is_installed has now been removed as the new functions supersede it
- binaries will now always be installed to `binaries_directory` and
not system folders.
- updated workloads to use these new functions
- rt-app and sysbench might still need work
Previously swipe_to_unlock was not used and conflicted with a method
of the same name.
- swipe_to_unlock() renamed perform_unlock_swipe()
- swipe_to_unlock parameter now takes a direction, this allows swipe unlocking on Android M devices
- ensure_screen_is_on() will now also unlock the screen if swipe_to_unlock is set
This is a fix to the previous fix
(2510329cdf938ff85e7574e9f7f3880e370a56ad) that updated get_properties
to store "dumpsys window" output relative to the working_directory. That
commit constructed the path using self.device, which is wrong, as in
this case self itself is the device.
Commit 95f17702d74d06d8f61bc710c53472d25d2f92ed redirected output of
"dumpsys window" to a file (needed for Gem5 support). However, the file
was created in $PWD, which breaks on production devices, as that
location is not writable. This moves the file under the working
directory on the device.
- Move the processing of Android properties to an internal
method. This allows the Android properties to be extracted without
extracting those of the Linux device.
- Redirect the output from 'dumpsys window' to a file and pull the
file as opposed to extracting the output from the terminal. This is
more reliable in the event that another process writes to the shell.
- standardisded on a single context argument
- removed Device.init() no longer necessary as initilize now
automatically gets propagated up the hierarchy. Renamed the existing
use of it to "initilize".
- related pylint cleanup.
uname is not available on all Android devices, and we cannot rely on
busybox for establishing the ABI, as we need to get the ABI before we
can depoly the right version of busybox.
In both cases, the ABI is now obtained by executing "uname -m" on the
device and perfroming a mapping from the returned machine architecture
a known ABI. If no known ABI is found the architecture string itself is
returned.
added more paths to pull by default when device.get_properties is
invoked during run initialization. Also moved the LinuxDevice
implementation into BaseLinuxDevice, so that AndroidDevice tires to pull
the same files (on top of the Android-specific stuff).