Index: build/android/devil/android/device_utils.py |
diff --git a/build/android/devil/android/device_utils.py b/build/android/devil/android/device_utils.py |
index 85472e78c291beb3349c7da7624bac2776cba7f0..73ed277c65d40aca9171ed28b7224e69d9292695 100644 |
--- a/build/android/devil/android/device_utils.py |
+++ b/build/android/devil/android/device_utils.py |
@@ -527,14 +527,14 @@ class DeviceUtils(object): |
@decorators.WithTimeoutAndRetriesFromInstance( |
min_default_timeout=INSTALL_DEFAULT_TIMEOUT) |
- def Install(self, apk_path, reinstall=False, permissions=None, timeout=None, |
+ def Install(self, apk, reinstall=False, permissions=None, timeout=None, |
retries=None): |
"""Install an APK. |
Noop if an identical APK is already installed. |
Args: |
- apk_path: A string containing the path to the APK to install. |
+ apk: An ApkHelper instance or string containing the path to the APK. |
permissions: Set of permissions to set. If not set, finds permissions with |
apk helper. To set no permissions, pass []. |
reinstall: A boolean indicating if we should keep any existing app data. |
@@ -546,7 +546,7 @@ class DeviceUtils(object): |
CommandTimeoutError if the installation times out. |
DeviceUnreachableError on missing device. |
""" |
- self._InstallInternal(apk_path, None, reinstall=reinstall, |
+ self._InstallInternal(apk, None, reinstall=reinstall, |
permissions=permissions) |
@decorators.WithTimeoutAndRetriesFromInstance( |
@@ -559,7 +559,8 @@ class DeviceUtils(object): |
Noop if all of the APK splits are already installed. |
Args: |
- base_apk: A string of the path to the base APK. |
+ base_apk: An ApkHelper instance or string containing the path to the base |
+ APK. |
split_apks: A list of strings of paths of all of the APK splits. |
reinstall: A boolean indicating if we should keep any existing app data. |
allow_cached_props: Whether to use cached values for device properties. |
@@ -583,14 +584,16 @@ class DeviceUtils(object): |
if split_apks: |
self._CheckSdkLevel(version_codes.LOLLIPOP) |
- all_apks = [base_apk] |
+ base_apk = apk_helper.ToHelper(base_apk) |
+ |
+ all_apks = [base_apk.path] |
if split_apks: |
all_apks += split_select.SelectSplits( |
- self, base_apk, split_apks, allow_cached_props=allow_cached_props) |
+ self, base_apk.path, split_apks, allow_cached_props=allow_cached_props) |
if len(all_apks) == 1: |
logging.warning('split-select did not select any from %s', split_apks) |
- package_name = apk_helper.GetPackageName(base_apk) |
+ package_name = base_apk.GetPackageName() |
device_apk_paths = self._GetApplicationPathsInternal(package_name) |
apks_to_install = None |
@@ -625,10 +628,10 @@ class DeviceUtils(object): |
self.adb.InstallMultiple( |
apks_to_install, partial=partial, reinstall=reinstall) |
else: |
- self.adb.Install(base_apk, reinstall=reinstall) |
+ self.adb.Install(base_apk.path, reinstall=reinstall) |
if (permissions is None |
and self.build_version_sdk >= version_codes.MARSHMALLOW): |
- permissions = apk_helper.ApkHelper(base_apk).GetPermissions() |
+ permissions = base_apk.GetPermissions() |
self.GrantPermissions(package_name, permissions) |
# Upon success, we know the device checksums, but not their paths. |
if host_checksums is not None: |