Encrypted File Systems. Recovery changes for framework.

Modifications to allow for new call to recovery to toggle EFS settings.
This commit is contained in:
Oscar Montemayor
2009-11-30 10:37:37 -08:00
parent 06253f58fb
commit 3baf1bf734
3 changed files with 35 additions and 0 deletions

View File

@@ -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.

View File

@@ -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.

View File

@@ -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();