ODE: add a popup to launch ode application 79/156579/1 accepted/tizen/unified/20171019.145702 submit/tizen/20171019.034316
authorlokilee73 <changjoo.lee@samsung.com>
Thu, 19 Oct 2017 02:19:45 +0000 (11:19 +0900)
committerHyotaek Shim <hyotaek.shim@samsung.com>
Thu, 19 Oct 2017 04:00:59 +0000 (04:00 +0000)
Change-Id: I3fec9ac53283f76aa227d05705eb0d05589d2a0f
Signed-off-by: lokilee73 <changjoo.lee@samsung.com>
(cherry picked from commit a86fd726614849b94a76ea4940ae869470bbe222)

src/mmc/mmc-mobile.c

index 225dace..27e1686 100755 (executable)
 
 #define SETTING_MMC_ENCRYPTION_UG  "setting-mmc-encryption-efl"
 #define EXTENDED_SD_APPNAME            "org.tizen.extended-sd"
+#define ODE_APPNAME                    "org.tizen.ode"
 #define SDCARD_KEY                     "_SDCARD_NUM_"
+#define VIEWTYPE_KEY                   "viewtype"
+#define DEVPATH_KEY                    "dev_path"
+#define MAPPINGNODE_KEY                        "mapping_node"
 
 #define DD_BUS_NAME             "org.tizen.system.deviced"
 #define DD_OBJECT_PATH_ODE      "/Org/Tizen/System/DeviceD/Ode"
@@ -35,7 +39,8 @@
 
 enum ext_app {
        EXT_SETTING_MMC_UG,
-       EXT_SD_SETTING
+       EXT_SD_SETTING,
+       EXT_ODE
 };
 
 static const struct popup_ops mount_error_ops;
@@ -45,7 +50,12 @@ static const struct popup_ops check_smack_ops;
 static const struct popup_ops ode_encrypt_ops;
 static const struct popup_ops ode_decrypt_ops;
 static const struct popup_ops sdcard_setup_ops;
+static const struct popup_ops unlock_extendedsd_ops;
+
 static char *Sdcard_ID = NULL;
+static char *View_Type = NULL;
+static char *Dev_Path = NULL;
+static char *Mapping_Node = NULL;
 
 static void remove_other_mmc_popups(const struct popup_ops *ops)
 {
@@ -129,6 +139,11 @@ static void launch_app(int type)
        else if (type == EXT_SD_SETTING) {
                app_control_add_extra_data(app_control, SDCARD_KEY, Sdcard_ID);
                ret = app_control_set_app_id(app_control, EXTENDED_SD_APPNAME);
+       } else if (type == EXT_ODE) {
+               app_control_add_extra_data(app_control, VIEWTYPE_KEY, View_Type);
+               app_control_add_extra_data(app_control, DEVPATH_KEY, Dev_Path);
+               app_control_add_extra_data(app_control, MAPPINGNODE_KEY, Mapping_Node);
+               ret = app_control_set_app_id(app_control, ODE_APPNAME);
        } else {
                _E("No matched type(%d)", type);
                return;
@@ -297,6 +312,24 @@ static void launch_sdcard_setup(const struct popup_ops *ops)
        terminate_if_no_popup();
 }
 
+static int launch_ode(bundle *b, const struct popup_ops *ops)
+{
+       if (!b || !ops)
+               return -EINVAL;
+
+       View_Type = (char *)bundle_get_val(b, VIEWTYPE_KEY);
+       Dev_Path = (char *)bundle_get_val(b, DEVPATH_KEY);
+       Mapping_Node = (char *)bundle_get_val(b, MAPPINGNODE_KEY);
+
+       if (!View_Type || !Dev_Path || !Mapping_Node) {
+               _E("Failed to get data for ode");
+               return -ENOENT;
+       }
+
+       launch_app(EXT_ODE);
+       return 0;
+}
+
 static int sdcard_setup_get_content(const struct popup_ops *ops, char *content, unsigned int len)
 {
        int ret;
@@ -314,7 +347,7 @@ static int sdcard_setup_get_content(const struct popup_ops *ops, char *content,
 
        Sdcard_ID = (char *)bundle_get_val(obj->b, SDCARD_KEY);
        if (!Sdcard_ID) {
-               _E("Failed to get SDCARD ID(%s)");
+               _E("Failed to get SDCARD ID");
                return -ENOENT;
        }
 
@@ -406,6 +439,11 @@ static const struct popup_ops sdcard_setup_ops = {
        .pre            = launch_mmc_popup,
 };
 
+static const struct popup_ops unlock_extendedsd_ops = {
+       .name           = "unlockextendedsd",
+       .show           = launch_ode,
+};
+
 /* Constructor to register mmc popup */
 static __attribute__ ((constructor)) void register_mmc_popup(void)
 {
@@ -416,4 +454,5 @@ static __attribute__ ((constructor)) void register_mmc_popup(void)
        register_popup(&ode_encrypt_ops);
        register_popup(&ode_decrypt_ops);
        register_popup(&sdcard_setup_ops);
+       register_popup(&unlock_extendedsd_ops);
 }