diff options
author | 2010-01-23 08:12:43 -0800 | |
---|---|---|
committer | 2010-01-23 08:12:43 -0800 | |
commit | 45f61040823d8c442838f75cde8760f236603dae (patch) | |
tree | 2c45ee66fd0458b7656bab5c0237fd5ca04950a5 | |
parent | 60e8495c1699f6f4d4046a3394b1eafdeefe6d64 (diff) |
MountService: Add support for renaming secure containers
Signed-off-by: San Mehat <san@google.com>
-rw-r--r-- | core/java/android/os/IMountService.aidl | 5 | ||||
-rw-r--r-- | media/sdutils/sdutil.cpp | 15 | ||||
-rw-r--r-- | services/java/com/android/server/MountService.java | 5 |
3 files changed, 24 insertions, 1 deletions
diff --git a/core/java/android/os/IMountService.aidl b/core/java/android/os/IMountService.aidl index c0c2d036bb7d..2124e85b480c 100644 --- a/core/java/android/os/IMountService.aidl +++ b/core/java/android/os/IMountService.aidl @@ -99,6 +99,11 @@ interface IMountService void unmountSecureContainer(String id); /* + * Rename an unmounted secure container. + */ + void renameSecureContainer(String oldId, String newId); + + /* * 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 322f743a3697..a61cccb122ab 100644 --- a/media/sdutils/sdutil.cpp +++ b/media/sdutils/sdutil.cpp @@ -134,6 +134,12 @@ static void asec_unmount(const char *id) { gMountService->unmountSecureContainer(sId); } +static void asec_rename(const char *oldId, const char *newId) { + String16 sOldId(oldId); + String16 sNewId(newId); + gMountService->renameSecureContainer(sOldId, sNewId); +} + static int asec_path(const char *id) { String16 sId(id); gMountService->getSecureContainerPath(sId); @@ -212,7 +218,13 @@ int main(int argc, char **argv) } else if (!strcmp(argument, "destroy")) { return android::asec_destroy(id); } else if (!strcmp(argument, "mount")) { - return android::asec_mount(id, argv[4], atoi(argv[5])); + if (argc == 6) + return android::asec_mount(id, argv[4], atoi(argv[5])); + } else if (!strcmp(argument, "rename")) { + if (argc == 5) { + android::asec_rename(id, argv[4]); + return 0; + } } else if (!strcmp(argument, "unmount")) { android::asec_unmount(id); return 0; @@ -233,6 +245,7 @@ usage: " sdutil asec destroy <id>\n" " sdutil asec mount <id> <key> <ownerUid>\n" " sdutil asec unmount <id>\n" + " sdutil asec rename <oldId, newId>\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 0cee31df59fd..353da12154a7 100644 --- a/services/java/com/android/server/MountService.java +++ b/services/java/com/android/server/MountService.java @@ -1056,6 +1056,11 @@ class MountService extends IMountService.Stub mConnector.doCommand(cmd); } + public void renameSecureContainer(String oldId, String newId) throws IllegalStateException { + String cmd = String.format("rename_asec %s %s", oldId, newId); + mConnector.doCommand(cmd); + } + public String getSecureContainerPath(String id) throws IllegalStateException { ArrayList<String> rsp = mConnector.doCommand("asec_path " + id); |