diff options
| author | 2019-05-29 09:18:58 -0700 | |
|---|---|---|
| committer | 2019-05-29 09:18:58 -0700 | |
| commit | dcf19166c3d4102fcc4c1cd5c9b86b140e08fb72 (patch) | |
| tree | e87d5ffbad0c9f3d48bca92fb2870145506e353b | |
| parent | 26fdabb9a08c01b5fb55062d299dfea1e6eb1083 (diff) | |
Applies INSTALL_REPLACE_EXISTING outside of while loop
Prior to this change, the default behavior of replacing packages unless
-R was provided would only happen if at least one command line argument
was provided due to the actual setting of the flag happening within the
while loop that parses arguments. This change moves the application
outside of that loop, ensuring it's always set by default, even if no
arguments are provided.
Bug: 133453175
Test: adb install-multi-package ... with existing packages
Change-Id: I6673bb92c318b0a328880a5e9eb7cc6f5ba0ff40
| -rw-r--r-- | services/core/java/com/android/server/pm/PackageManagerShellCommand.java | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/services/core/java/com/android/server/pm/PackageManagerShellCommand.java b/services/core/java/com/android/server/pm/PackageManagerShellCommand.java index f5c8049dcb25..81de8e263299 100644 --- a/services/core/java/com/android/server/pm/PackageManagerShellCommand.java +++ b/services/core/java/com/android/server/pm/PackageManagerShellCommand.java @@ -2496,9 +2496,9 @@ class PackageManagerShellCommand extends ShellCommand { default: throw new IllegalArgumentException("Unknown option " + opt); } - if (replaceExisting) { - sessionParams.installFlags |= PackageManager.INSTALL_REPLACE_EXISTING; - } + } + if (replaceExisting) { + sessionParams.installFlags |= PackageManager.INSTALL_REPLACE_EXISTING; } return params; } |