summaryrefslogtreecommitdiff
path: root/services/java/com/android/server/MountService.java
diff options
context:
space:
mode:
authorJason parks <jparks@google.com>2011-01-07 09:01:15 -0600
committerJason parks <jparks@google.com>2011-01-07 09:01:56 -0600
commitd6332552761fcce700adb465ff540d30a671403c (patch)
treeb476c74c4e0872f9bf0531797da06a69c745de2f /services/java/com/android/server/MountService.java
parenta085ef3e35e986463567360b1d02a66c642ea603 (diff)
Add a method enable encryption.
This is for testing and needs to be cleaned up. Change-Id: I71cd5412f7096dc13d9ab61229ee9846c6f0006a
Diffstat (limited to 'services/java/com/android/server/MountService.java')
-rw-r--r--services/java/com/android/server/MountService.java23
1 files changed, 23 insertions, 0 deletions
diff --git a/services/java/com/android/server/MountService.java b/services/java/com/android/server/MountService.java
index bf8145780403..d6804f9ad565 100644
--- a/services/java/com/android/server/MountService.java
+++ b/services/java/com/android/server/MountService.java
@@ -1653,6 +1653,29 @@ class MountService extends IMountService.Stub implements INativeDaemonConnectorC
return 0;
}
+ public int encryptStorage(String password) {
+ if (password == null) {
+ throw new IllegalArgumentException("password cannot be null");
+ }
+
+ // TODO: Enforce a permission
+
+ waitForReady();
+
+ if (DEBUG_EVENTS) {
+ Slog.i(TAG, "decrypting storage...");
+ }
+
+ try {
+ mConnector.doCommand(String.format("cryptfs enablecrypto wipe %s", password));
+ } catch (NativeDaemonConnectorException e) {
+ // Encryption failed
+ return e.getCode();
+ }
+
+ return 0;
+ }
+
private void addObbStateLocked(ObbState obbState) throws RemoteException {
final IBinder binder = obbState.getBinder();
List<ObbState> obbStates = mObbMounts.get(binder);