Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3303)

Unified Diff: build/android/devil/android/device_utils.py

Issue 1511473004: [Android] Add support for installing older versions of installed apks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: adb_install_apk changes and rebase Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « build/android/adb_install_apk.py ('k') | build/android/devil/android/device_utils_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 a379a65c0d347c8864544702029f8eb7026ef147..3a20ca74c1fafb244b92f6292fc7ea584697b8f8 100644
--- a/build/android/devil/android/device_utils.py
+++ b/build/android/devil/android/device_utils.py
@@ -544,17 +544,18 @@ class DeviceUtils(object):
@decorators.WithTimeoutAndRetriesFromInstance(
min_default_timeout=INSTALL_DEFAULT_TIMEOUT)
- def Install(self, apk, reinstall=False, permissions=None, timeout=None,
- retries=None):
+ def Install(self, apk, allow_downgrade=False, reinstall=False,
+ permissions=None, timeout=None, retries=None):
"""Install an APK.
Noop if an identical APK is already installed.
Args:
apk: An ApkHelper instance or string containing the path to the APK.
+ allow_downgrade: A boolean indicating if we should allow downgrades.
+ reinstall: A boolean indicating if we should keep any existing app data.
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.
timeout: timeout in seconds
retries: number of retries
@@ -563,14 +564,14 @@ class DeviceUtils(object):
CommandTimeoutError if the installation times out.
DeviceUnreachableError on missing device.
"""
- self._InstallInternal(apk, None, reinstall=reinstall,
- permissions=permissions)
+ self._InstallInternal(apk, None, allow_downgrade=allow_downgrade,
+ reinstall=reinstall, permissions=permissions)
@decorators.WithTimeoutAndRetriesFromInstance(
min_default_timeout=INSTALL_DEFAULT_TIMEOUT)
- def InstallSplitApk(self, base_apk, split_apks, reinstall=False,
- allow_cached_props=False, permissions=None, timeout=None,
- retries=None):
+ def InstallSplitApk(self, base_apk, split_apks, allow_downgrade=False,
+ reinstall=False, allow_cached_props=False,
+ permissions=None, timeout=None, retries=None):
"""Install a split APK.
Noop if all of the APK splits are already installed.
@@ -579,6 +580,7 @@ class DeviceUtils(object):
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.
+ allow_downgrade: A boolean indicating if we should allow downgrades.
reinstall: A boolean indicating if we should keep any existing app data.
allow_cached_props: Whether to use cached values for device properties.
permissions: Set of permissions to set. If not set, finds permissions with
@@ -594,10 +596,12 @@ class DeviceUtils(object):
"""
self._InstallInternal(base_apk, split_apks, reinstall=reinstall,
allow_cached_props=allow_cached_props,
- permissions=permissions)
+ permissions=permissions,
+ allow_downgrade=allow_downgrade)
- def _InstallInternal(self, base_apk, split_apks, reinstall=False,
- allow_cached_props=False, permissions=None):
+ def _InstallInternal(self, base_apk, split_apks, allow_downgrade=False,
+ reinstall=False, allow_cached_props=False,
+ permissions=None):
if split_apks:
self._CheckSdkLevel(version_codes.LOLLIPOP)
@@ -643,9 +647,11 @@ class DeviceUtils(object):
if split_apks:
partial = package_name if len(apks_to_install) < len(all_apks) else None
self.adb.InstallMultiple(
- apks_to_install, partial=partial, reinstall=reinstall)
+ apks_to_install, partial=partial, reinstall=reinstall,
+ allow_downgrade=allow_downgrade)
else:
- self.adb.Install(base_apk.path, reinstall=reinstall)
+ self.adb.Install(
+ base_apk.path, reinstall=reinstall, allow_downgrade=allow_downgrade)
if (permissions is None
and self.build_version_sdk >= version_codes.MARSHMALLOW):
permissions = base_apk.GetPermissions()
« no previous file with comments | « build/android/adb_install_apk.py ('k') | build/android/devil/android/device_utils_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698