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

Commit a0ae2f94 authored by Pawan Wagh's avatar Pawan Wagh
Browse files

Add hidden API to wipe device with command

Adding method with permission so that Settings app can
wipe the /data partition with ext4 format

Test: m Settings && adb install -r $ANDROID_PRODUCT_OUT/system_ext/priv-app/Settings/Settings.apk
Test: adb shell cat /proc/mounts | grep f2fs
Bug: 320700993

Change-Id: I1d391cff06fce81c3690b113584ad69557951afc
parent b0f339a6
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
@@ -1243,6 +1243,24 @@ public class RecoverySystem {
        bootCommand(context, "--wipe_ab", filenameArg, reasonArg, localeArg);
    }

    /**
     * Reboot into recovery and wipe the data partition with ext4
     *
     * @throws IOException if something goes wrong.
     *
     * @hide
     */
    @RequiresPermission(allOf = {
            android.Manifest.permission.RECOVERY,
            android.Manifest.permission.REBOOT
    })
    public void wipePartitionToExt4()
            throws IOException {
        // Reformat /data partition with ext4
        String command = "--wipe_data\n--reformat_data=ext4";
        rebootRecoveryWithCommand(command);
    }

    /**
     * Reboot into the recovery system with the supplied argument.
     * @param args to pass to the recovery utility.