MountService: Add new 'unmountSecureContainer' API call
Signed-off-by: San Mehat <san@google.com>
This commit is contained in:
@ -93,6 +93,11 @@ interface IMountService
|
|||||||
*/
|
*/
|
||||||
String mountSecureContainer(String id, String key, int ownerUid);
|
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.
|
* Returns the filesystem path of a mounted secure container.
|
||||||
*/
|
*/
|
||||||
|
@ -129,6 +129,11 @@ static int asec_mount(const char *id, const char *key, int ownerUid) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void asec_unmount(const char *id) {
|
||||||
|
String16 sId(id);
|
||||||
|
gMountService->unmountSecureContainer(sId);
|
||||||
|
}
|
||||||
|
|
||||||
static int asec_path(const char *id) {
|
static int asec_path(const char *id) {
|
||||||
String16 sId(id);
|
String16 sId(id);
|
||||||
gMountService->getSecureContainerPath(sId);
|
gMountService->getSecureContainerPath(sId);
|
||||||
@ -208,6 +213,9 @@ int main(int argc, char **argv)
|
|||||||
return android::asec_destroy(id);
|
return android::asec_destroy(id);
|
||||||
} else if (!strcmp(argument, "mount")) {
|
} else if (!strcmp(argument, "mount")) {
|
||||||
return android::asec_mount(id, argv[4], atoi(argv[5]));
|
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")) {
|
} else if (!strcmp(argument, "path")) {
|
||||||
return android::asec_path(id);
|
return android::asec_path(id);
|
||||||
}
|
}
|
||||||
@ -224,6 +232,7 @@ usage:
|
|||||||
" sdutil asec finalize <id>\n"
|
" sdutil asec finalize <id>\n"
|
||||||
" sdutil asec destroy <id>\n"
|
" sdutil asec destroy <id>\n"
|
||||||
" sdutil asec mount <id> <key> <ownerUid>\n"
|
" sdutil asec mount <id> <key> <ownerUid>\n"
|
||||||
|
" sdutil asec unmount <id>\n"
|
||||||
" sdutil asec path <id>\n"
|
" sdutil asec path <id>\n"
|
||||||
);
|
);
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -1057,6 +1057,11 @@ class MountService extends IMountService.Stub
|
|||||||
return getSecureContainerPath(id);
|
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 {
|
public String getSecureContainerPath(String id) throws IllegalStateException {
|
||||||
ArrayList<String> rsp = mConnector.doCommand("asec_path " + id);
|
ArrayList<String> rsp = mConnector.doCommand("asec_path " + id);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user