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

Commit 3270054d authored by Kelvin Zhang's avatar Kelvin Zhang Committed by Gerrit Code Review
Browse files

Merge "Add a CLI entry point for wipe recovery command" into main

parents 62b94e7e 9c1b1deb
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -524,6 +524,7 @@ public class RecoverySystemService extends IRecoverySystem.Stub implements Reboo
        if (DEBUG) Slog.d(TAG, "rebootRecoveryWithCommand: [" + command + "]");
        synchronized (sRequestLock) {
            if (!setupOrClearBcb(true, command)) {
                Slog.e(TAG, "rebootRecoveryWithCommand failed to setup BCB");
                return;
            }

+15 −0
Original line number Diff line number Diff line
@@ -48,6 +48,8 @@ public class RecoverySystemShellCommand extends ShellCommand {
                    return isLskfCaptured();
                case "reboot-and-apply":
                    return rebootAndApply();
                case "wipe":
                    return wipe();
                default:
                    return handleDefaultCommands(cmd);
            }
@@ -58,6 +60,18 @@ public class RecoverySystemShellCommand extends ShellCommand {
        }
    }

    private int wipe() throws RemoteException {
        PrintWriter pw = getOutPrintWriter();
        String newFsType = getNextArg();
        String command = "--wipe_data";
        if (newFsType != null && !newFsType.isEmpty()) {
            command += "\n--reformat_data=" + newFsType;
        }
        pw.println("Rebooting into recovery with " + command.replaceAll("\n", " "));
        mService.rebootRecoveryWithCommand(command);
        return 0;
    }

    private int requestLskf() throws RemoteException {
        String packageName = getNextArgRequired();
        boolean success = mService.requestLskf(packageName, null);
@@ -104,5 +118,6 @@ public class RecoverySystemShellCommand extends ShellCommand {
        pw.println("  clear-lskf");
        pw.println("  is-lskf-captured <package_name>");
        pw.println("  reboot-and-apply <package_name> <reason>");
        pw.println("  wipe <new filesystem type ext4/f2fs>");
    }
}