app: Remove test code 03/156203/2 submit/tizen_4.0/20171017.115140
authorpr.jung <pr.jung@samsung.com>
Tue, 17 Oct 2017 11:43:30 +0000 (20:43 +0900)
committerHyotaek Shim <hyotaek.shim@samsung.com>
Tue, 17 Oct 2017 11:45:07 +0000 (11:45 +0000)
- Get Primary mmc id and devpath using dbus method call

Change-Id: I0a798bad0dfb7e7ad69e986c81f37c2620c1067d
Signed-off-by: pr.jung <pr.jung@samsung.com>
apps/extended-sd/include/extended-sd-main.h
apps/extended-sd/src/es-internal-storage-page.c
apps/extended-sd/src/extended-sd-main.c

index 406e79a..f3f772f 100644 (file)
@@ -58,6 +58,7 @@ typedef struct appdata {
        internal_storage_page_data_s* internal_storage_page_data;
 
        int storage_id;
+       char *devpath;
 } appdata_s;
 
 #define SAFE_FREE(data) if (data) { free(data); data = NULL; }
index 0be6fd9..711d4ef 100644 (file)
@@ -97,7 +97,7 @@ encryption_format(void *data)
                return;
 
        app_control_add_extra_data(app_control, VIEWTYPE_KEY, ENCRYPT_EXTENSION);
-       app_control_add_extra_data(app_control, DEVPATH_KEY, "/dev/mmcblk1");
+       app_control_add_extra_data(app_control, DEVPATH_KEY, ad->devpath);
        app_control_add_extra_data(app_control, MAPPING_NODE_KEY, "extendedsd");
        ret = app_control_set_app_id(app_control, SECURITY_APP_ID);
        if (ret != APP_CONTROL_ERROR_NONE) {
index e91db75..b59073f 100644 (file)
@@ -94,24 +94,14 @@ app_control(app_control_h app_control, void *data)
        /* Handle the launch request. */
        GVariant *output;
        appdata_s *ad = (appdata_s *)data;
-       char *id = NULL;
-       char str_id[32];
-       char *arr[1];
-       int int_id;
+       int id;
        int ret;
        char *type = NULL;
+       char *devpath;
        int len;
 
        ret_if(ad == NULL);
 
-       app_control_get_extra_data(app_control, POPUP_SDCARD_ID, &id);
-       if (!id) {
-               ad->storage_id = -1;
-               DMSG("No sdcard id");
-               return;
-       }
-       ad->storage_id = atoi(id);
-
        ret = storage_set_state_changed_cb(ad->storage_id, storage_removed_cb, ad);
        if (ret != STORAGE_ERROR_NONE) {
                DMSG_ERR("Failed to register signal handler");
@@ -133,21 +123,19 @@ app_control(app_control_h app_control, void *data)
        } else
                create_home_page_base_layout(ad);
 
-       snprintf(str_id, sizeof(str_id), "%d", ad->storage_id);
-       arr[0] = str_id;
        ret = dbus_method_sync_with_reply(STORAGED_BUS_NAME,
-                       STORAGED_PATH_BLOCK_MANAGER, STORAGED_INTERFACE_BLOCK_MANAGER, "GetDeviceInfo", "i", arr, &output);
+                       STORAGED_PATH_BLOCK_MANAGER, STORAGED_INTERFACE_BLOCK_MANAGER, "GetMmcPrimary", NULL, NULL, &output);
        if (ret < 0) {
                DMSG("Failed to get storage information: %d", ret);
                return;
        }
 
-       g_variant_get(output, "(issssssisibii)", NULL, NULL, NULL, NULL,
-                       NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, &int_id);
-       if (int_id != ad->storage_id) {
-               DMSG("Storage already removed");
-               ui_app_exit();
-       }
+       g_variant_get(output, "(issssssisibii)", NULL, &devpath, NULL, NULL,
+                       NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, &id);
+
+       DMSG("Get Primary MMC: %d %s", id, devpath);
+       ad->storage_id = id;
+       ad->devpath = strdup(devpath);
 
 }