Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0c8569f2 authored by San Mehat's avatar San Mehat Committed by Android (Google) Code Review
Browse files

Merge "MountService: Add support for renaming secure containers"

parents 79896bd1 45f61040
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -98,6 +98,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.
     */
+14 −1
Original line number Diff line number Diff line
@@ -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")) {
            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;
+5 −0
Original line number Diff line number Diff line
@@ -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);