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

Commit 9dba709d authored by San Mehat's avatar San Mehat
Browse files

MountService: Add new 'unmountSecureContainer' API call



Signed-off-by: default avatarSan Mehat <san@google.com>
parent 5fbf4094
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -93,6 +93,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.
     */
+9 −0
Original line number Diff line number Diff line
@@ -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;
+5 −0
Original line number Diff line number Diff line
@@ -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);