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

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: 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
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 400c51731a7930b4bd0e7d9b4bf527bd6591b6b5..3a6428748eca21384744b57fd1ee8e5b71d70b70 100644
--- a/build/android/devil/android/device_utils.py
+++ b/build/android/devil/android/device_utils.py
@@ -543,8 +543,8 @@ 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.
@@ -556,20 +556,21 @@ class DeviceUtils(object):
reinstall: A boolean indicating if we should keep any existing app data.
timeout: timeout in seconds
retries: number of retries
+ allow_downgrade: A boolean indicating if we should allow downgrades.
jbudorick 2015/12/08 16:44:56 nit: these should be in the order in which they ap
rnephew (Reviews Here) 2015/12/08 16:57:57 Done.
Raises:
CommandFailedError if the installation fails.
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.
@@ -584,6 +585,7 @@ class DeviceUtils(object):
apk helper. To set no permissions, pass [].
timeout: timeout in seconds
retries: number of retries
+ allow_downgrade: A boolean indicating if we should allow downgrades.
jbudorick 2015/12/08 16:44:56 nit: same
rnephew (Reviews Here) 2015/12/08 16:57:57 Done.
Raises:
CommandFailedError if the installation fails.
@@ -593,10 +595,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)
@@ -642,9 +646,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 | « no previous file | build/android/devil/android/device_utils_test.py » ('j') | build/android/devil/android/sdk/adb_wrapper.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698