From 863659e8fc5e53a0edc780dc2a49f20e2fdf3470 Mon Sep 17 00:00:00 2001 From: "pr.jung" Date: Wed, 18 Oct 2017 15:25:14 +0900 Subject: [PATCH] app: Need to unmount sdcard before launching encryption app Change-Id: Id01b0888d3b102e350844c2a00c7c6790b9e3a24 Signed-off-by: pr.jung --- apps/extended-sd/src/es-internal-storage-page.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/apps/extended-sd/src/es-internal-storage-page.c b/apps/extended-sd/src/es-internal-storage-page.c index 711d4ef..9047ce7 100644 --- a/apps/extended-sd/src/es-internal-storage-page.c +++ b/apps/extended-sd/src/es-internal-storage-page.c @@ -4,6 +4,8 @@ #include "dbus-call.h" #include "log-util.h" +#define UNMOUNT_FORCE 1 + typedef enum { INTERNAL_STORAGE_ITEM_PAGE_1_HEADING = 0, INTERNAL_STORAGE_ITEM_PAGE_1_PARA_1, @@ -84,6 +86,9 @@ encryption_format(void *data) app_control_h app_control = NULL; appdata_s* ad = (appdata_s*)data; int ret; + char str_id[32]; + char str_option[32]; + char *arr[2]; ret_if(ad == NULL); @@ -92,6 +97,19 @@ encryption_format(void *data) page_content = create_page_4(ad); elm_object_part_content_set(ad->internal_storage_page_data->internal_storage_page_base_layout, "elm.swallow.content", page_content); + // Unmount sdcard + snprintf(str_id, sizeof(str_id), "%d", ad->storage_id); + arr[0] = str_id; + snprintf(str_option, sizeof(str_option), "%d", UNMOUNT_FORCE); + arr[1] = str_option; + + ret = dbus_method_sync(STORAGED_BUS_NAME, + STORAGED_PATH_BLOCK_MANAGER, STORAGED_INTERFACE_BLOCK_MANAGER, "Unmount", "ii", arr); + if (ret < 0) { + DMSG("Failed to mount sd card as portable storage: %d", ret); + return; + } + ret = app_control_create(&app_control); if (ret != APP_CONTROL_ERROR_NONE) return; -- 2.7.4