Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a933349b authored by Patrick Baumann's avatar Patrick Baumann
Browse files

Makes adb install -r the default behavior

This change ignores the -r indicator and only enforces that the
install be non-replacing when the -R flag is provided.

Change-Id: I9034ca06acbdaa99b458d4e6d8c3b379582b2bf0
Fixes: 30566724
Test: manual - ensured -r replaces and -R does not
parent 0deaa4c8
Loading
Loading
Loading
Loading
+9 −3
Original line number Diff line number Diff line
@@ -1892,13 +1892,16 @@ class PackageManagerShellCommand extends ShellCommand {
        final InstallParams params = new InstallParams();
        params.sessionParams = sessionParams;
        String opt;
        boolean replaceExisting = true;
        while ((opt = getNextOption()) != null) {
            switch (opt) {
                case "-l":
                    sessionParams.installFlags |= PackageManager.INSTALL_FORWARD_LOCK;
                    break;
                case "-r":
                    sessionParams.installFlags |= PackageManager.INSTALL_REPLACE_EXISTING;
                case "-r": // ignore
                    break;
                case "-R":
                    replaceExisting = false;
                    break;
                case "-i":
                    params.installerPackageName = getNextArg();
@@ -1983,6 +1986,9 @@ class PackageManagerShellCommand extends ShellCommand {
                default:
                    throw new IllegalArgumentException("Unknown option " + opt);
            }
            if (replaceExisting) {
                sessionParams.installFlags |= PackageManager.INSTALL_REPLACE_EXISTING;
            }
        }
        return params;
    }
@@ -2451,7 +2457,7 @@ class PackageManagerShellCommand extends ShellCommand {
        pw.println("    Install an application.  Must provide the apk data to install, either as a");
        pw.println("    file path or '-' to read from stdin.  Options are:");
        pw.println("      -l: forward lock application");
        pw.println("      -r: allow replacement of existing application");
        pw.println("      -R: disallow replacement of existing application");
        pw.println("      -t: allow test packages");
        pw.println("      -i: specify package name of installer owning the app");
        pw.println("      -s: install application on sdcard");