summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author San Mehat <san@google.com> 2010-01-18 06:47:41 -0800
committer San Mehat <san@google.com> 2010-01-18 06:49:19 -0800
commit9dba709d4439d8cdb464a3dcccbddffdbe4b10ff (patch)
tree07b08f8bee730d8ec59604d6e29287f7cb0f7b88
parent5fbf4094f5857ab15801c65a260a5c4b6866d655 (diff)
MountService: Add new 'unmountSecureContainer' API call
Signed-off-by: San Mehat <san@google.com>
-rw-r--r--core/java/android/os/IMountService.aidl5
-rw-r--r--media/sdutils/sdutil.cpp9
-rw-r--r--services/java/com/android/server/MountService.java5
3 files changed, 19 insertions, 0 deletions
diff --git a/core/java/android/os/IMountService.aidl b/core/java/android/os/IMountService.aidl
index e73569adc97e..c0c2d036bb7d 100644
--- a/core/java/android/os/IMountService.aidl
+++ b/core/java/android/os/IMountService.aidl
@@ -94,6 +94,11 @@ interface IMountService
String mountSecureContainer(String id, String key, int ownerUid);
/*
+ * Unount a secure container.
+ */
+ void unmountSecureContainer(String id);
+
+ /*
* Returns the filesystem path of a mounted secure container.
*/
String getSecureContainerPath(String id);
diff --git a/media/sdutils/sdutil.cpp b/media/sdutils/sdutil.cpp
index a30e59c037b3..322f743a3697 100644
--- a/media/sdutils/sdutil.cpp
+++ b/media/sdutils/sdutil.cpp
@@ -129,6 +129,11 @@ static int asec_mount(const char *id, const char *key, int ownerUid) {
return 0;
}
+static void asec_unmount(const char *id) {
+ String16 sId(id);
+ gMountService->unmountSecureContainer(sId);
+}
+
static int asec_path(const char *id) {
String16 sId(id);
gMountService->getSecureContainerPath(sId);
@@ -208,6 +213,9 @@ int main(int argc, char **argv)
return android::asec_destroy(id);
} else if (!strcmp(argument, "mount")) {
return android::asec_mount(id, argv[4], atoi(argv[5]));
+ } else if (!strcmp(argument, "unmount")) {
+ android::asec_unmount(id);
+ return 0;
} else if (!strcmp(argument, "path")) {
return android::asec_path(id);
}
@@ -224,6 +232,7 @@ usage:
" sdutil asec finalize <id>\n"
" sdutil asec destroy <id>\n"
" sdutil asec mount <id> <key> <ownerUid>\n"
+ " sdutil asec unmount <id>\n"
" sdutil asec path <id>\n"
);
return -1;
diff --git a/services/java/com/android/server/MountService.java b/services/java/com/android/server/MountService.java
index d54c4d904f9d..f8f8742bb5cf 100644
--- a/services/java/com/android/server/MountService.java
+++ b/services/java/com/android/server/MountService.java
@@ -1057,6 +1057,11 @@ class MountService extends IMountService.Stub
return getSecureContainerPath(id);
}
+ public void unmountSecureContainer(String id) throws IllegalStateException {
+ String cmd = String.format("unmount_asec %s ", id);
+ mConnector.doCommand(cmd);
+ }
+
public String getSecureContainerPath(String id) throws IllegalStateException {
ArrayList<String> rsp = mConnector.doCommand("asec_path " + id);