Fix memory leak issue
[platform/core/uifw/inputdelegator.git] / src / w-input-selector.cpp
index 05afb39..f9c1243 100755 (executable)
@@ -41,6 +41,10 @@ App_Data* app_data = NULL;
 
 InputKeyboardData g_input_keyboard_data;
 InputTypeData g_input_type_data;
+InputTemplateData g_input_template_data;
+
+static bool g_set_mimetype_in_app_service = false;
+static bool g_set_mimetype_in_app_resume = false;
 
 static Elm_Object_Item *it_empty;
 static Elm_Object_Item *it_title;
@@ -93,6 +97,7 @@ void _create_header_items(void *user_data);
 void _update_genlist_items(void *user_data);
 unsigned int _update_smartreply_items(void *user_data);
 unsigned int _update_template_items(void *user_data);
+unsigned int _update_user_template_items(void *user_data);
 static void _popup_close_cb(void *data, Evas_Object *obj, void *event_info);
 static void _popup_back_cb(void *data, Evas_Object *obj, void *event_info);
 static void input_type_deinit(void);
@@ -153,7 +158,6 @@ void init_customizing_theme(void)
        elm_theme_extension_add(NULL, app_edj_path.c_str());
 }
 
-
 static Eina_Bool back_cb(void *data, Elm_Object_Item *it)
 {
        reply_to_sender_by_callback_for_back();
@@ -246,6 +250,23 @@ static void __ise_template_gl_sel(void *data, Evas_Object *obj, void *event_info
        }
 }
 
+static void __ise_user_template_gl_sel(void *data, Evas_Object *obj, void *event_info)
+{
+       Elm_Object_Item *item = (Elm_Object_Item *) event_info;
+       int index = 0;
+
+       if (item) {
+               elm_genlist_item_selected_set(item, EINA_FALSE);
+
+               index = (uintptr_t) elm_object_item_data_get(item);
+
+               if (index < (int)g_input_template_data.input_template_array_len) {
+                       reply_to_sender_by_callback(g_input_template_data.input_template_array[index], "user_template", NULL, NULL);
+                       ui_app_exit();
+               }
+       }
+}
+
 static char * __ise_template_gl_text_get(void *data, Evas_Object *obj, const char *part)
 {
        if (!strcmp(part, "elm.text")) {
@@ -280,6 +301,19 @@ static char * __ise_template_gl_text_get(void *data, Evas_Object *obj, const cha
        return NULL;
 }
 
+static char * __ise_user_template_gl_text_get(void *data, Evas_Object *obj, const char *part)
+{
+       if (!strcmp(part, "elm.text")) {
+               unsigned int index = (uintptr_t)data;
+               if (index < (unsigned int)g_input_template_data.input_template_array_len) {
+                       if (g_input_template_data.input_template_array[index] != NULL) {
+                               return strdup(g_input_template_data.input_template_array[index]);
+                       }
+               }
+       }
+       return NULL;
+}
+
 static Evas_Object * __ise_gl_2button_content_get(void *data, Evas_Object *obj, const char *part)
 {
        char *first_input_type = *(g_input_type_data.input_type_array + 0);
@@ -305,13 +339,22 @@ static Evas_Object * __ise_gl_2button_content_get(void *data, Evas_Object *obj,
                        if (!strcmp(first_input_type, "input_voice")) {
                                elm_object_style_set(btn, "ime_button_stt");
                                path_ic = path + "images/w_mode_stt_ic.png";
+                               evas_object_smart_callback_add(btn, "clicked", _stt_clicked_cb, app_data);
+                               elm_atspi_accessible_name_set(btn, "IDS_IME_MBODY_VOICE_INPUT");
+                               elm_atspi_accessible_translation_domain_set(btn, PACKAGE);
                        } else if (!strcmp(first_input_type, "input_emoticon")) {
                                elm_object_style_set(btn, "ime_button_emoticon");
                                path_ic = path + "images/Delta_w_mode_emoticon_ic.png";
+                               evas_object_smart_callback_add(btn, "clicked", _emoticon_clicked_cb, app_data);
+                               elm_atspi_accessible_name_set(btn, "IDS_COM_HEADER_EMOTICON");
+                               elm_atspi_accessible_translation_domain_set(btn, PACKAGE);
                        } else if (!strcmp(first_input_type, "input_keyboard")) {
                                elm_object_style_set(btn, "ime_button_keyboard");
                                path_ic = path + "images/w_mode_keyboard_ic.png";
                                evas_object_propagate_events_set(btn, EINA_FALSE);
+                               evas_object_smart_callback_add(btn, "clicked", _keyboard_clicked_cb, app_data);
+                               elm_atspi_accessible_name_set(btn, "IDS_COM_OPT_KEYBOARD");
+                               elm_atspi_accessible_translation_domain_set(btn, PACKAGE);
                        }
                        elm_image_file_set(ic, path_ic.c_str(), NULL);
                        elm_object_content_set(btn, ic);
@@ -321,13 +364,22 @@ static Evas_Object * __ise_gl_2button_content_get(void *data, Evas_Object *obj,
                        if (!strcmp(second_input_type, "input_voice")) {
                                elm_object_style_set(btn, "ime_button_stt");
                                path_ic = path + "images/w_mode_stt_ic.png";
+                               evas_object_smart_callback_add(btn, "clicked", _stt_clicked_cb, app_data);
+                               elm_atspi_accessible_name_set(btn, "IDS_IME_MBODY_VOICE_INPUT");
+                               elm_atspi_accessible_translation_domain_set(btn, PACKAGE);
                        } else if (!strcmp(second_input_type, "input_emoticon")) {
                                elm_object_style_set(btn, "ime_button_emoticon");
                                path_ic = path + "images/Delta_w_mode_emoticon_ic.png";
+                               evas_object_smart_callback_add(btn, "clicked", _emoticon_clicked_cb, app_data);
+                               elm_atspi_accessible_name_set(btn, "IDS_COM_HEADER_EMOTICON");
+                               elm_atspi_accessible_translation_domain_set(btn, PACKAGE);
                        } else if (!strcmp(second_input_type, "input_keyboard")) {
                                elm_object_style_set(btn, "ime_button_keyboard");
                                path_ic = path + "images/w_mode_keyboard_ic.png";
                                evas_object_propagate_events_set(btn, EINA_FALSE);
+                               evas_object_smart_callback_add(btn, "clicked", _keyboard_clicked_cb, app_data);
+                               elm_atspi_accessible_name_set(btn, "IDS_COM_OPT_KEYBOARD");
+                               elm_atspi_accessible_translation_domain_set(btn, PACKAGE);
                        }
                        elm_image_file_set(ic, path_ic.c_str(), NULL);
                        elm_object_content_set(btn, ic);
@@ -344,21 +396,33 @@ static Evas_Object * __ise_gl_2button_content_get(void *data, Evas_Object *obj,
                        evas_object_layer_set(btn, 32000);
                        if (!strcmp(first_input_type, "input_voice")) {
                                evas_object_smart_callback_add(btn, "clicked", _stt_clicked_cb, app_data);
+                               elm_atspi_accessible_name_set(btn, "IDS_IME_MBODY_VOICE_INPUT");
+                               elm_atspi_accessible_translation_domain_set(btn, PACKAGE);
                        } else if (!strcmp(first_input_type, "input_emoticon")) {
                                evas_object_smart_callback_add(btn, "clicked", _emoticon_clicked_cb, app_data);
+                               elm_atspi_accessible_name_set(btn, "IDS_COM_HEADER_EMOTICON");
+                               elm_atspi_accessible_translation_domain_set(btn, PACKAGE);
                        } else if (!strcmp(first_input_type, "input_keyboard")) {
                                evas_object_propagate_events_set(btn, EINA_FALSE);
                                evas_object_smart_callback_add(btn, "clicked", _keyboard_clicked_cb, app_data);
+                               elm_atspi_accessible_name_set(btn, "IDS_COM_OPT_KEYBOARD");
+                               elm_atspi_accessible_translation_domain_set(btn, PACKAGE);
                        }
                } else if (!strcmp(part, "elm.icon.2.touch_area")){
                        evas_object_layer_set(btn, 32000);
                        if (!strcmp(second_input_type, "input_voice")) {
                                evas_object_smart_callback_add(btn, "clicked", _stt_clicked_cb, app_data);
+                               elm_atspi_accessible_name_set(btn, "IDS_IME_MBODY_VOICE_INPUT");
+                               elm_atspi_accessible_translation_domain_set(btn, PACKAGE);
                        } else if (!strcmp(second_input_type, "input_emoticon")) {
                                evas_object_smart_callback_add(btn, "clicked", _emoticon_clicked_cb, app_data);
+                               elm_atspi_accessible_name_set(btn, "IDS_COM_HEADER_EMOTICON");
+                               elm_atspi_accessible_translation_domain_set(btn, PACKAGE);
                        } else if (!strcmp(second_input_type, "input_keyboard")) {
                                evas_object_propagate_events_set(btn, EINA_FALSE);
                                evas_object_smart_callback_add(btn, "clicked", _keyboard_clicked_cb, app_data);
+                               elm_atspi_accessible_name_set(btn, "IDS_COM_OPT_KEYBOARD");
+                               elm_atspi_accessible_translation_domain_set(btn, PACKAGE);
                        }
                }
                return btn;
@@ -392,6 +456,9 @@ static Evas_Object * __ise_gl_3button_content_get(void *data, Evas_Object *obj,
                        elm_image_file_set(ic, path_ic.c_str(), NULL);
                        elm_object_content_set(btn, ic);
                        evas_object_layer_set(btn, 32000);
+                       evas_object_smart_callback_add(btn, "clicked", _stt_clicked_cb, app_data);
+                       elm_atspi_accessible_name_set(btn, "IDS_IME_MBODY_VOICE_INPUT");
+                       elm_atspi_accessible_translation_domain_set(btn, PACKAGE);
 
                } else if (!strcmp(part, "elm.icon.2")){
                        elm_object_style_set(btn, "ime_button_emoticon");
@@ -399,6 +466,9 @@ static Evas_Object * __ise_gl_3button_content_get(void *data, Evas_Object *obj,
                        elm_image_file_set(ic, path_ic.c_str(), NULL);
                        elm_object_content_set(btn, ic);
                        evas_object_layer_set(btn, 32000);
+                       evas_object_smart_callback_add(btn, "clicked", _emoticon_clicked_cb, app_data);
+                       elm_atspi_accessible_name_set(btn, "IDS_COM_HEADER_EMOTICON");
+                       elm_atspi_accessible_translation_domain_set(btn, PACKAGE);
 
                } else if (!strcmp(part, "elm.icon.3")){
                        elm_object_style_set(btn, "ime_button_keyboard");
@@ -407,6 +477,9 @@ static Evas_Object * __ise_gl_3button_content_get(void *data, Evas_Object *obj,
                        elm_object_content_set(btn, ic);
                        evas_object_layer_set(btn, 32000);
                        evas_object_propagate_events_set(btn, EINA_FALSE);
+                       evas_object_smart_callback_add(btn, "clicked", _keyboard_clicked_cb, app_data);
+                       elm_atspi_accessible_name_set(btn, "IDS_COM_OPT_KEYBOARD");
+                       elm_atspi_accessible_translation_domain_set(btn, PACKAGE);
                }
 
                return btn;
@@ -419,14 +492,20 @@ static Evas_Object * __ise_gl_3button_content_get(void *data, Evas_Object *obj,
                if (!strcmp(part, "elm.icon.1.touch_area")) {
                        evas_object_layer_set(btn, 32000);
                        evas_object_smart_callback_add(btn, "clicked", _stt_clicked_cb, app_data);
+                       elm_atspi_accessible_name_set(btn, "IDS_IME_MBODY_VOICE_INPUT");
+                       elm_atspi_accessible_translation_domain_set(btn, PACKAGE);
 
                } else if (!strcmp(part, "elm.icon.2.touch_area")){
                        evas_object_layer_set(btn, 32000);
                        evas_object_smart_callback_add(btn, "clicked", _emoticon_clicked_cb, app_data);
+                       elm_atspi_accessible_name_set(btn, "IDS_COM_HEADER_EMOTICON");
+                       elm_atspi_accessible_translation_domain_set(btn, PACKAGE);
                } else if (!strcmp(part, "elm.icon.3.touch_area")) {
                        evas_object_layer_set(btn, 32000);
                        evas_object_propagate_events_set(btn, EINA_FALSE);
                        evas_object_smart_callback_add(btn, "clicked", _keyboard_clicked_cb, app_data);
+                       elm_atspi_accessible_name_set(btn, "IDS_COM_OPT_KEYBOARD");
+                       elm_atspi_accessible_translation_domain_set(btn, PACKAGE);
                }
 
                return btn;
@@ -462,6 +541,39 @@ static void __ise_gl_lang_changed(void *data, Evas_Object *obj, void *event_info
        elm_genlist_realized_items_update(obj);
 }
 
+static char * __ise_drawing_text_get(void *data, Evas_Object *obj, const char *part)
+{
+       if(!strcmp(part, "elm.text")) {
+               return(strdup(gettext("WDS_IME_MBODY_DRAWING_M_EMOTICON_ABB")));
+       }
+       return NULL;
+}
+
+static Evas_Object * __ise_drawing_content_get(void *data, Evas_Object *obj, const char *part)
+{
+       if (!strcmp(part, "elm.icon")) {
+               Evas_Object* btn = elm_button_add(obj);
+               evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+               evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
+               Evas_Object* ic = elm_image_add(btn);
+               elm_image_resizable_set(ic, EINA_TRUE, EINA_TRUE);
+               string path = get_resource_path();
+               if (_WEARABLE)
+                       path = path + "wearable/";
+               else if (_TV)
+                       path = path + "tv/";
+               else
+                       path = path + "mobile/";
+               elm_object_style_set(btn, "ime_button_drawing");
+               string path_ic = path + "images/wi_drawing_icon.png";
+               elm_image_file_set(ic, path_ic.c_str(), NULL);
+               elm_object_content_set(btn, ic);
+               evas_object_layer_set(btn, 32000);
+               return btn;
+       }
+       return NULL;
+}
+
 void set_source_caller_app_id(app_control_h app_control)
 {
        if (!app_control){
@@ -710,15 +822,6 @@ static void _item_position_changed_cb(void *data, Evas_Object *obj, void *event_
        }
 }
 
-static char *
-_main_menu_title_text_get(void *data, Evas_Object *obj, const char *part)
-{
-       char buf[1024];
-
-       snprintf(buf, 1023, "%s", "Select method");
-       return strdup(buf);
-}
-
 void _create_genlist_items(void* user_data)
 {
        App_Data* app_data = (App_Data*) user_data;
@@ -732,8 +835,8 @@ void _create_genlist_items(void* user_data)
        elm_genlist_clear(app_data->genlist);
 
        Elm_Genlist_Item_Class * itc0 = elm_genlist_item_class_new();
-       itc0->item_style = "title";
-       itc0->func.text_get = _main_menu_title_text_get;
+       itc0->item_style = NULL;
+       itc0->func.text_get = NULL;
        itc0->func.content_get = NULL;
        itc0->func.state_get = NULL;
        itc0->func.del = NULL;
@@ -759,11 +862,13 @@ void _create_genlist_items(void* user_data)
                        ELM_GENLIST_ITEM_NONE,
                        NULL, NULL);
 
-       // 3 Buttons
-       it_title = elm_genlist_item_append(app_data->genlist, itc1,
-                       NULL, NULL,
-                       ELM_GENLIST_ITEM_NONE,
-                       NULL, NULL);
+       if (app_data->app_type != APP_TYPE_REPLY) {
+               // 3 Buttons
+               it_title = elm_genlist_item_append(app_data->genlist, itc1,
+                               NULL, NULL,
+                               ELM_GENLIST_ITEM_NONE,
+                               NULL, NULL);
+       }
 
        elm_genlist_item_select_mode_set(it_title, ELM_OBJECT_SELECT_MODE_NONE);
 
@@ -833,6 +938,10 @@ void _update_genlist_items(void *user_data)
 
        g_template_item_size = _update_template_items(user_data);
 
+       if (g_input_template_data.input_template_array_len > 0) {
+               _update_user_template_items(user_data);
+       }
+
        /* Update genlist item position */
        Elm_Object_Item *item = elm_genlist_item_next_get(it_title);
        elm_genlist_item_show(item, ELM_GENLIST_ITEM_SCROLLTO_MIDDLE);
@@ -894,7 +1003,7 @@ unsigned int _update_smartreply_items(void *user_data)
                        reply = input_smartreply_get_nth_item(i, &type);
                        if (reply == NULL)
                                continue;
-                       PRINTFUNC(DLOG_DEBUG, "SmartReply = [%d]%s", i, reply);
+                       SECURE_LOGD("SmartReply = [%d]%s", i, reply);
 
                        for (j = 0; j < template_list.size(); j++) {
                                const char *template_str;
@@ -910,8 +1019,10 @@ unsigned int _update_smartreply_items(void *user_data)
                                }
                        }
 
-                       if (matched == true)
+                       if (matched == true) {
+                               free(reply);
                                continue;
+                       }
 
                        elm_genlist_item_append(app_data->genlist,
                                                itc,
@@ -922,14 +1033,25 @@ unsigned int _update_smartreply_items(void *user_data)
                                                app_data);
 
                        item_size++;
-                       if (item_size >= 3)
+                       free(reply);
+                       if (item_size >= 3) {
                                break;
+                       }
                }
                elm_genlist_item_class_free(itc);
        }
        return item_size;
 }
 
+static void _drawing_item_clicked_cb(void *data, Evas_Object * obj, void *event_info)
+{
+       PRINTFUNC(DLOG_DEBUG, "%s", __func__);
+       App_Data* ad = (App_Data*) data;
+       if (!ad)
+               return;
+
+       launch_drawing_app(ad);
+}
 
 unsigned int _update_template_items(void *user_data)
 {
@@ -998,6 +1120,111 @@ unsigned int _update_template_items(void *user_data)
                        item_size++;
                }
                elm_genlist_item_class_free(itc);
+
+               // drawing button (+)
+               if (app_data->mime_type == MIME_TYPE_ALL && app_data->app_type == APP_TYPE_SELECT_MODE) {
+                       Elm_Genlist_Item_Class *itc;
+                       itc = elm_genlist_item_class_new();
+
+                       itc->item_style = "1text.1icon";
+                       itc->func.text_get = __ise_drawing_text_get;;
+                       itc->func.content_get = __ise_drawing_content_get;
+                       itc->func.state_get = NULL;
+                       itc->func.del = NULL;
+
+                       elm_genlist_item_append(app_data->genlist,
+                                       itc,
+                                       NULL,
+                                       NULL,
+                                       ELM_GENLIST_ITEM_NONE,
+                                       _drawing_item_clicked_cb,
+                                       app_data);
+
+                       elm_genlist_item_class_free(itc);
+               }
+
+               // dummy item for empty space
+               Elm_Genlist_Item_Class * itc0 = elm_genlist_item_class_new();
+               itc0->item_style = "title";
+               itc0->func.text_get = NULL;
+               itc0->func.content_get = NULL;
+               itc0->func.state_get = NULL;
+               itc0->func.del = NULL;
+
+               if (g_input_template_data.input_template_array_len < 1) {
+                       it_empty = elm_genlist_item_append(app_data->genlist, itc0,
+                               NULL, NULL,
+                               ELM_GENLIST_ITEM_NONE,
+                               NULL, NULL);
+               }
+               elm_genlist_item_class_free(itc0);
+       }
+
+       return item_size;
+}
+
+unsigned int _update_user_template_items(void *user_data)
+{
+       App_Data* app_data;
+
+       Elm_Object_Item *first;
+
+       unsigned int i = 0;
+       unsigned int item_size = 0;
+
+       app_data = (App_Data *)user_data;
+
+       if (app_data == NULL) {
+               PRINTFUNC(DLOG_ERROR, "Can not get app_data");
+               return item_size;
+       }
+
+       if (app_data->genlist == NULL) {
+               /* smartreply will update when genlist is exist only */
+               PRINTFUNC(DLOG_ERROR, "Can not get getlist");
+               return item_size;
+       }
+
+       first = elm_genlist_first_item_get(app_data->genlist);
+       if (first == NULL)
+               return 0;
+
+       if (g_input_template_data.input_template_array_len > 0) {
+               Elm_Genlist_Item_Class *itc;
+
+               itc = elm_genlist_item_class_new();
+
+               itc->item_style = "1text";
+               itc->func.text_get = __ise_user_template_gl_text_get;
+               itc->func.content_get = NULL;
+               itc->func.state_get = NULL;
+               itc->func.del = NULL;
+
+               for (i = 0; i < (unsigned int)g_input_template_data.input_template_array_len; i++) {
+                       elm_genlist_item_append(app_data->genlist,
+                                       itc,
+                                       (void *)(uintptr_t)i,
+                                       NULL,
+                                       ELM_GENLIST_ITEM_NONE,
+                                       __ise_user_template_gl_sel,
+                                       app_data);
+                       item_size++;
+               }
+               elm_genlist_item_class_free(itc);
+
+               // dummy item for empty space
+               Elm_Genlist_Item_Class * itc0 = elm_genlist_item_class_new();
+               itc0->item_style = "title";
+               itc0->func.text_get = NULL;
+               itc0->func.content_get = NULL;
+               itc0->func.state_get = NULL;
+               itc0->func.del = NULL;
+
+               it_empty = elm_genlist_item_append(app_data->genlist, itc0,
+                               NULL, NULL,
+                               ELM_GENLIST_ITEM_NONE,
+                               NULL, NULL);
+               elm_genlist_item_class_free(itc0);
        }
 
        return item_size;
@@ -1111,11 +1338,19 @@ void _app_service(app_control_h service, void* user_data)
        int input_type_array_len = -1;
        bool is_extra_data_array = false;
        char *mime_type = NULL;
+       char **user_template_array = NULL;
+       int user_template_array_len = -1;
 
        app_control_clone(&(app_data->source_app_control), service);
        app_data->reply_type = REPLY_APP_NORMAL;
        app_data->mime_type = MIME_TYPE_ALL;
 
+       ret = app_control_get_extra_data_array(service, "user_template", &user_template_array, &user_template_array_len);
+       g_input_template_data.input_template_array = user_template_array;
+       g_input_template_data.input_template_array_len = user_template_array_len;
+
+       g_set_mimetype_in_app_service = false;
+
        ret = app_control_get_mime(service, &mime_type);
        if (ret != APP_CONTROL_ERROR_NONE) {
                LOGD("Fail to get mime type : %d", ret);
@@ -1125,6 +1360,7 @@ void _app_service(app_control_h service, void* user_data)
                        if (!strncmp(mime_type, "image/", strlen("image/"))) {
                                app_data->mime_type = MIME_TYPE_IMAGE;
                                app_data->app_type = APP_TYPE_DRAWING;
+                               g_set_mimetype_in_app_service = true;
                                launch_drawing_app((void *)app_data);
                                if (mime_type)
                                        free(mime_type);
@@ -1163,6 +1399,10 @@ void _app_service(app_control_h service, void* user_data)
                                app_data->app_type = APP_TYPE_STT;
                                _stt_clicked_cb((void *)app_data, NULL, NULL);
                                goto ACTIVATE;
+                       } else if (!strcmp(context, "input_recording")) {
+                               app_data->app_type = APP_TYPE_RECORDING;
+                               _stt_clicked_cb((void *)app_data, NULL, NULL);
+                               goto ACTIVATE;
                        } else if (!strcmp(context, "input_emoticon")) {
                                app_data->app_type = APP_TYPE_EMOTICON;
                                _emoticon_clicked_cb((void *)app_data, NULL, NULL);
@@ -1172,6 +1412,10 @@ void _app_service(app_control_h service, void* user_data)
                                input_keyboard_init(service);
                                _keyboard_clicked_cb((void *)app_data, NULL, NULL);
                                goto ACTIVATE;
+                       } else if (!strcmp(context, "input_drawing")) {
+                               app_data->app_type = APP_TYPE_DRAWING;
+                               _drawing_item_clicked_cb((void *)app_data, NULL, NULL);
+                               goto ACTIVATE;
                        } else if (!strcmp(context, "input_reply")) {
                                app_data->app_type = APP_TYPE_REPLY;
                        }
@@ -1201,7 +1445,6 @@ ACTIVATE :
                free(context);
 }
 
-
 void _app_pause(void* user_data)
 {
        PRINTFUNC(DLOG_DEBUG, "");
@@ -1212,6 +1455,16 @@ void _app_resume(void* user_data)
 {
        PRINTFUNC(DLOG_DEBUG, "");
        resume_voice();
+
+       if (g_set_mimetype_in_app_resume) {
+               app_control_destroy(app_data->source_app_control);
+               app_data->source_app_control = NULL;
+               ui_app_exit();
+       }
+
+       if (g_set_mimetype_in_app_service) {
+               g_set_mimetype_in_app_resume = true;
+       }
 }
 
 void _app_terminate(void* user_data)