summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorJason parks <jparks@google.com>2011-01-21 11:39:15 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-01-21 11:39:15 -0800
commit0f2ef34b5a7158ab105edfb0d6c5904ae23e89fa (patch)
tree9bc119f3e035a06dadc3d7ab444e761a6109693b /services
parent4569f1a561b4db77cc87f649e04c352415b65605 (diff)
parent9ed98bcdc9ef3445075fdba1933d0ec2b4bc147e (diff)
downloadframeworks_base-0f2ef34b5a7158ab105edfb0d6c5904ae23e89fa.zip
frameworks_base-0f2ef34b5a7158ab105edfb0d6c5904ae23e89fa.tar.gz
frameworks_base-0f2ef34b5a7158ab105edfb0d6c5904ae23e89fa.tar.bz2
Merge "Update encryption commands." into honeycomb
Diffstat (limited to 'services')
-rw-r--r--services/java/com/android/server/MountService.java33
1 files changed, 25 insertions, 8 deletions
diff --git a/services/java/com/android/server/MountService.java b/services/java/com/android/server/MountService.java
index d6804f9..d862585 100644
--- a/services/java/com/android/server/MountService.java
+++ b/services/java/com/android/server/MountService.java
@@ -618,7 +618,7 @@ class MountService extends IMountService.Stub implements INativeDaemonConnectorC
Slog.w(TAG, "Failed to get share availability");
}
/*
- * Now that we've done our initialization, release
+ * Now that we've done our initialization, release
* the hounds!
*/
mReady = true;
@@ -1237,7 +1237,7 @@ class MountService extends IMountService.Stub implements INativeDaemonConnectorC
waitForReady();
return doGetVolumeShared(Environment.getExternalStorageDirectory().getPath(), "ums");
}
-
+
/**
* @return state of the volume at the specified mount point
*/
@@ -1407,7 +1407,7 @@ class MountService extends IMountService.Stub implements INativeDaemonConnectorC
return rc;
}
-
+
public int mountSecureContainer(String id, String key, int ownerUid) {
validatePermission(android.Manifest.permission.ASEC_MOUNT_UNMOUNT);
waitForReady();
@@ -1495,7 +1495,7 @@ class MountService extends IMountService.Stub implements INativeDaemonConnectorC
synchronized (mAsecMountSet) {
/*
- * Because a mounted container has active internal state which cannot be
+ * Because a mounted container has active internal state which cannot be
* changed while active, we must ensure both ids are not currently mounted.
*/
if (mAsecMountSet.contains(oldId) || mAsecMountSet.contains(newId)) {
@@ -1644,13 +1644,30 @@ class MountService extends IMountService.Stub implements INativeDaemonConnectorC
}
try {
- mConnector.doCommand(String.format("cryptfs checkpw %s", password));
+ ArrayList<String> rsp = mConnector.doCommand("cryptfs checkpw " + password);
+ String []tok = rsp.get(0).split(" ");
+
+ if (tok == null || tok.length != 2) {
+ return -1;
+ }
+
+ int code = Integer.parseInt(tok[1]);
+
+ if (code == 0) {
+ // Decrypt was successful. Post a delayed message before restarting in order
+ // to let the UI to clear itself
+ mHandler.postDelayed(new Runnable() {
+ public void run() {
+ mConnector.doCommand(String.format("cryptfs restart"));
+ }
+ }, 2000); // 2 seconds
+ }
+
+ return code;
} catch (NativeDaemonConnectorException e) {
// Decryption failed
return e.getCode();
}
-
- return 0;
}
public int encryptStorage(String password) {
@@ -1667,7 +1684,7 @@ class MountService extends IMountService.Stub implements INativeDaemonConnectorC
}
try {
- mConnector.doCommand(String.format("cryptfs enablecrypto wipe %s", password));
+ mConnector.doCommand(String.format("cryptfs enablecrypto inplace %s", password));
} catch (NativeDaemonConnectorException e) {
// Encryption failed
return e.getCode();