Modify UX scenario to set up sdcard through setting apps 15/155315/3
authorHyotaek Shim <hyotaek.shim@samsung.com>
Fri, 13 Oct 2017 02:09:56 +0000 (11:09 +0900)
committerHyotaek Shim <hyotaek.shim@samsung.com>
Fri, 13 Oct 2017 02:19:42 +0000 (11:19 +0900)
Change-Id: Ib6a6bba01222b0c74ad15aff6b47e424a62b0ca9
Signed-off-by: Hyotaek Shim <hyotaek.shim@samsung.com>
src/block/block.c

index c9107c9..082eeb3 100644 (file)
@@ -2103,7 +2103,7 @@ static int add_block_device(struct udev_device *dev, const char *devnode, bool i
 {
        struct block_data *data;
        struct block_device *bdev;
-       char id_string[PATH_LEN];
+       //char id_string[PATH_LEN];
        bool partition;
        int ret;
        int thread_id;
@@ -2151,9 +2151,42 @@ static int add_block_device(struct udev_device *dev, const char *devnode, bool i
        pthread_mutex_lock(&(th_manager[thread_id].mutex));
        th_manager[thread_id].num_dev++;
        DD_LIST_APPEND(th_manager[thread_id].block_dev_list, bdev);
-
        pthread_mutex_unlock(&(th_manager[thread_id].mutex));
 
+       if (!strncmp(bdev->data->fs_type, LUKS_NAME, strlen(LUKS_NAME))) {
+               bdev->data->block_type = BLOCK_MMC_EXTENDED_INTERNAL_DEV;
+               ret = change_mount_point(bdev, EXTENDED_SD_PATH);
+               if (ret < 0) {
+                       ret = -EPERM;
+                       free_block_device(bdev);
+                       return ret;
+               }
+
+               /* ---- ODE UI launch ----
+               snprintf(id_string, PATH_LEN, "%d", bdev->data->id);
+               ret = launch_system_app(POPUP_DEFAULT, 4, POPUP_KEY_CONTENT, "sdcardsetup", POPUP_SDCARD_ID, id_string);
+               if (ret < 0)
+                       _E("Failed to launch popup");
+
+               ode_luks_set_event_cb(CALLBACK)
+               */
+
+               return 0;
+       } else if (!strncmp(bdev->data->fs_type, EXT4_NAME, strlen(EXT4_NAME))) {
+               bdev->data->block_type = BLOCK_MMC_EXTENDED_INTERNAL_DEV;
+               ret = change_mount_point(bdev, EXTENDED_SD_PATH);
+               if (ret < 0) {
+                       ret = -EPERM;
+                       free_block_device(bdev);
+                       return ret;
+               }
+       } else if (!bdev->data->fs_type) {
+               _E("Unformatted Storage");
+               free_block_device(bdev);
+               return -EPERM;
+       }
+
+#if 0
        /* Check this sdcard is already formatted for extended internal sdcard */
        if (block_conf[bdev->data->block_type].extendedinternal &&
                bdev->data->block_type == BLOCK_MMC_DEV &&
@@ -2188,7 +2221,6 @@ static int add_block_device(struct udev_device *dev, const char *devnode, bool i
                                        free_block_device(bdev);
                                        return ret;
                                }
-
                        }
                }
        } else {
@@ -2198,7 +2230,7 @@ static int add_block_device(struct udev_device *dev, const char *devnode, bool i
                        return -EPERM;
                }
        }
-
+#endif
        ret = add_operation(bdev, BLOCK_DEV_INSERT, NULL, (void *)data);
        if (ret < 0) {
                _E("Failed to add operation (insert %s)", devnode);