summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorSan Mehat <san@google.com>2010-01-06 14:30:56 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2010-01-06 14:30:56 -0800
commitd1265febc4ae20b0e709177735b175acd94b286a (patch)
treedaa3727125b982b9f231f63f489916c9ca364057 /media
parentf7b6e1fd211a592726f31271a6a04c8d18c0f309 (diff)
parent3697229cc7adfd89493e87ba8b6401c8b68bdd71 (diff)
downloadframeworks_base-d1265febc4ae20b0e709177735b175acd94b286a.zip
frameworks_base-d1265febc4ae20b0e709177735b175acd94b286a.tar.gz
frameworks_base-d1265febc4ae20b0e709177735b175acd94b286a.tar.bz2
Merge "framework: MountService: Add initial support for Android Secure External Caches"
Diffstat (limited to 'media')
-rw-r--r--media/sdutils/sdutil.cpp66
1 files changed, 65 insertions, 1 deletions
diff --git a/media/sdutils/sdutil.cpp b/media/sdutils/sdutil.cpp
index fe11878..7f0dda7 100644
--- a/media/sdutils/sdutil.cpp
+++ b/media/sdutils/sdutil.cpp
@@ -99,6 +99,42 @@ static int mount(const char* path) {
return -1;
}
+static int asec_create(const char *id, int sizeMb, const char *fstype,
+ const char *key, int ownerUid) {
+ String16 sId(id);
+ String16 sFstype(fstype);
+ String16 sKey(key);
+
+ String16 r = gMountService->createSecureCache(sId, sizeMb, sFstype,
+ sKey, ownerUid);
+ return 0;
+}
+
+static int asec_finalize(const char *id) {
+ String16 sId(id);
+ gMountService->finalizeSecureCache(sId);
+ return 0;
+}
+
+static int asec_destroy(const char *id) {
+ String16 sId(id);
+ gMountService->destroySecureCache(sId);
+ return 0;
+}
+
+static int asec_mount(const char *id, const char *key, int ownerUid) {
+ String16 sId(id);
+ String16 sKey(key);
+ gMountService->mountSecureCache(sId, sKey, ownerUid);
+ return 0;
+}
+
+static int asec_path(const char *id) {
+ String16 sId(id);
+ gMountService->getSecureCachePath(sId);
+ return 0;
+}
+
static int unmount(const char* path) {
String16 string(path);
gMountService->unmountMedia(string);
@@ -153,14 +189,42 @@ int main(int argc, char **argv)
android::init();
return android::umsEnable(false);
}
+ } else if (!strcmp(command, "asec")) {
+ const char* id = (argc > 3 ? argv[3] : NULL);
+
+ if (!id)
+ goto usage;
+
+ android::init();
+ if (!strcmp(argument, "create")) {
+
+ if (argc != 8)
+ goto usage;
+ return android::asec_create(id, atoi(argv[4]), argv[5], argv[6],
+ atoi(argv[7]));
+ } else if (!strcmp(argument, "finalize")) {
+ return android::asec_finalize(id);
+ } 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]));
+ } else if (!strcmp(argument, "path")) {
+ return android::asec_path(id);
+ }
}
+usage:
fprintf(stderr, "usage:\n"
" sdutil mount <mount path> - mounts the SD card at the given mount point\n"
" sdutil unmount <mount path> - unmounts the SD card at the given mount point\n"
" sdutil format <mount path> - formats the SD card at the given mount point\n"
" sdutil ums enable - enables USB mass storage\n"
- " sdutil ums disable - disnables USB mass storage\n"
+ " sdutil ums disable - disables USB mass storage\n"
+ " sdutil asec create <id> <sizeMb> <fstype> <key> <ownerUid>\n"
+ " sdutil asec finalize <id>\n"
+ " sdutil asec destroy <id>\n"
+ " sdutil asec mount <id> <key> <ownerUid>\n"
+ " sdutil asec path <id>\n"
);
return -1;
}