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

Commit 3baf1bf7 authored by Oscar Montemayor's avatar Oscar Montemayor
Browse files

Encrypted File Systems. Recovery changes for framework.

Modifications to allow for new call to recovery to toggle EFS settings.
parent 06253f58
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -44,6 +44,9 @@ interface ICheckinService {
    /** Reboot into the recovery system and wipe all user data. */
    void masterClear();

    /** Reboot into the recovery system, wipe all user data and enable Encrypted File Systems. */
    void masterClearAndToggleEFS(boolean efsEnabled);

    /**
     * Determine if the device is under parental control. Return null if
     * we are unable to check the parental control status.
+15 −0
Original line number Diff line number Diff line
@@ -74,6 +74,21 @@ public class RecoverySystem {
        bootCommand("--wipe_data");
    }

    /**
     * Reboot into the recovery system to wipe the /data partition and toggle
     * Encrypted File Systems on/off.
     * @param extras to add to the RECOVERY_COMPLETED intent after rebooting.
     * @throws IOException if something goes wrong.
     * @hide
     */
    public static void rebootAndToggleEFS(boolean efsEnabled) throws IOException {
        if (efsEnabled) {
            bootCommand("--set_encrypted_filesystem=on");
        } else {
            bootCommand("--set_encrypted_filesystem=off");
        }
    }

    /**
     * Reboot into the recovery system with the supplied argument.
     * @param arg to pass to the recovery utility.
+17 −0
Original line number Diff line number Diff line
@@ -66,6 +66,23 @@ public final class FallbackCheckinService extends ICheckinService.Stub {
        }
    }

    public void masterClearAndToggleEFS(boolean efsEnabled) {
        if (mContext.checkCallingOrSelfPermission("android.permission.MASTER_CLEAR") !=
			PackageManager.PERMISSION_GRANTED) {
            Log.e(TAG, "Permission Denial: can't invoke masterClearAndToggleEFS from "
				  + "pid=" + Binder.getCallingPid() + ", "
				  + "uid=" + Binder.getCallingUid());
            return;
        }

        // Save the android ID so the new system can get it erased.
        try {
            RecoverySystem.rebootAndToggleEFS(efsEnabled);
        } catch (IOException e) {
            Log.e(TAG, "Reboot for toggle EFS failed", e);
        }
    }

    public void getParentalControlState(IParentalControlCallback p, String requestingApp)
            throws android.os.RemoteException {
        ParentalControlState state = new ParentalControlState();