app: Need to unmount sdcard before launching encryption app 48/156348/1 accepted/tizen/unified/20171019.145706 submit/tizen/20171019.034316
authorpr.jung <pr.jung@samsung.com>
Wed, 18 Oct 2017 06:25:14 +0000 (15:25 +0900)
committerHyotaek Shim <hyotaek.shim@samsung.com>
Wed, 18 Oct 2017 06:39:41 +0000 (06:39 +0000)
Change-Id: Id01b0888d3b102e350844c2a00c7c6790b9e3a24
Signed-off-by: pr.jung <pr.jung@samsung.com>
(cherry picked from commit 863659e8fc5e53a0edc780dc2a49f20e2fdf3470)

apps/extended-sd/src/es-internal-storage-page.c

index 711d4ef..9047ce7 100644 (file)
@@ -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;