Index: build/android/incremental_install/installer.py |
diff --git a/build/android/incremental_install/installer.py b/build/android/incremental_install/installer.py |
index 421318cf3937073fda112c9e591633cc9ad09604..6c429118a018554ff5ce0122191ec9f060079da6 100755 |
--- a/build/android/incremental_install/installer.py |
+++ b/build/android/incremental_install/installer.py |
@@ -86,7 +86,8 @@ def Uninstall(device, package, enable_device_cache=False): |
def Install(device, apk, split_globs=None, native_libs=None, dex_files=None, |
enable_device_cache=False, use_concurrency=True, |
- show_proguard_warning=False, permissions=()): |
+ show_proguard_warning=False, permissions=(), |
+ allow_downgrade=True): |
"""Installs the given incremental apk and all required supporting files. |
Args: |
@@ -119,9 +120,11 @@ def Install(device, apk, split_globs=None, native_libs=None, dex_files=None, |
for split_glob in split_globs: |
splits.extend((f for f in glob.glob(split_glob))) |
device.InstallSplitApk(apk, splits, reinstall=True, |
- allow_cached_props=True, permissions=permissions) |
+ allow_cached_props=True, permissions=permissions, |
+ allow_downgrade=allow_downgrade) |
else: |
- device.Install(apk, reinstall=True, permissions=permissions) |
+ device.Install(apk, reinstall=True, permissions=permissions, |
+ allow_downgrade=allow_downgrade) |
install_timer.Stop(log=False) |
# Push .so and .dex files to the device (if they have changed). |
@@ -272,6 +275,12 @@ def main(): |
default=0, |
action='count', |
help='Verbose level (multiple times for more)') |
+ parser.add_argument('--disable-downgrade', |
+ action='store_false', |
+ default=True, |
+ dest='allow_downgrade', |
+ help='Disable install of apk with lower version number' |
+ 'than the version already on the device.') |
args = parser.parse_args() |
@@ -300,7 +309,8 @@ def main(): |
Install(device, apk, split_globs=args.splits, native_libs=args.native_libs, |
dex_files=args.dex_files, enable_device_cache=args.cache, |
use_concurrency=args.threading, |
- show_proguard_warning=args.show_proguard_warning) |
+ show_proguard_warning=args.show_proguard_warning, |
+ allow_downgrade=args.allow_downgrade) |
if __name__ == '__main__': |