Fix the problem in which camera app blocked 54/11754/2
authorTaeyoung Kim <ty317.kim@samsung.com>
Fri, 28 Jun 2013 14:36:16 +0000 (23:36 +0900)
committerJacek Pielaszkiewicz <j.pielaszkie@samsung.com>
Tue, 5 Nov 2013 08:55:41 +0000 (09:55 +0100)
- all popups are terminated after releasing all resources using idler

tizendev.org synchronization with tizen.org.

Change-Id: I39ad0a85f998070b4e9302d0e62b4760e3017775
Signed-off-by: Taeyoung Kim <ty317.kim@samsung.com>
Signed-off-by: Jacek Pielaszkiewicz <j.pielaszkie@samsung.com>
lowbatt-popup/src/lowbatt.c
lowmem-popup/src/lowmem.c
mmc-popup/src/mmc.c
poweroff-popup/src/poweroff.c
usb-popup/src/usb-syspopup.c
usbotg-popup/src/usbotg-syspopup.c

index 0c9cf9f..eb0653e 100755 (executable)
@@ -54,17 +54,31 @@ syspopup_handler handler = {
        .def_timeout_fn = mytimeout
 };
 
+static Eina_Bool exit_idler_cb(void *data)
+{
+       elm_exit();
+       return ECORE_CALLBACK_CANCEL;
+}
+
+void popup_terminate(void)
+{
+       if (ecore_idler_add(exit_idler_cb, NULL))
+               return;
+
+       exit_idler_cb(NULL);
+}
+
 /* App Life cycle funtions */
 static void win_del(void *data, Evas_Object * obj, void *event)
 {
-       elm_exit();
+       popup_terminate();
 }
 
 /* Quit  */
 static void main_quit_cb(void *data, Evas_Object *obj, const char *emission,
                             const char *source)
 {
-       elm_exit();
+       popup_terminate();
 }
 
 /* Update text font */
@@ -189,7 +203,7 @@ static int app_reset(bundle *b, void *data)
                syspopup_reset(b);
        } else {
                if(option == CHECK_ACT) {
-                       exit(0);
+                       popup_terminate();
                }
                syspopup_create(b, &handler, ad->win_main, ad);
                evas_object_show(ad->win_main);
@@ -227,7 +241,7 @@ void lowbatt_cleanup(struct appdata *ad)
 static void bg_clicked_cb(void *data, Evas * e, Evas_Object * obj, void *event_info)
 {
        system_print("\n system-popup : Inside bg clicked \n");
-       exit(0);
+       popup_terminate();
 }
 
 static void bg_noti_cb(void *data)
@@ -258,7 +272,7 @@ void lowbatt_timeout_func(void *data)
                }
        }
        /* Now get lost */
-       exit(0);
+       popup_terminate();
 }
 
 /* Basic popup widget */
index 78270dc..068e026 100755 (executable)
@@ -65,17 +65,31 @@ static struct text_part main_txt[] = {
        {"txt_mesg", N_(""),},
 };
 
+static Eina_Bool exit_idler_cb(void *data)
+{
+       elm_exit();
+       return ECORE_CALLBACK_CANCEL;
+}
+
+void popup_terminate(void)
+{
+       if (ecore_idler_add(exit_idler_cb, NULL))
+               return;
+
+       exit_idler_cb(NULL);
+}
+
 /* App Life cycle funtions */
 static void win_del(void *data, Evas_Object *obj, void *event)
 {
-       elm_exit();
+       popup_terminate();
 }
 
 /* Quit  */
 static void main_quit_cb(void *data, Evas_Object *obj, const char *emission,
             const char *source)
 {
-       elm_exit();
+       popup_terminate();
 }
 
 /* Update text font */
@@ -224,7 +238,7 @@ void bg_clicked_cb(void *data, Evas * e, Evas_Object * obj, void *event_info)
 {
        system_print("\n system-popup : In BG Noti \n");
        fflush(stdout);
-       exit(0);
+       popup_terminate();
 }
 
 void lowmem_clicked_cb(void *data, Evas * e, Evas_Object * obj,
@@ -232,8 +246,7 @@ void lowmem_clicked_cb(void *data, Evas * e, Evas_Object * obj,
 {
        system_print("\n system-popup : Screen clicked \n");
        fflush(stdout);
-       elm_exit();
-       exit(0);
+       popup_terminate();
 }
 
 /* Create indicator bar */
@@ -272,7 +285,7 @@ void lowmem_timeout_func(void *data)
        lowmem_cleanup(data);
 
        /* Now get lost */
-       exit(0);
+       popup_terminate();
 }
 
 /* Basic popup widget */
index 7fa1c0f..5fcd43d 100755 (executable)
@@ -52,10 +52,24 @@ syspopup_handler handler = {
        .def_timeout_fn = mytimeout
 };
 
+static Eina_Bool exit_idler_cb(void *data)
+{
+       elm_exit();
+       return ECORE_CALLBACK_CANCEL;
+}
+
+void popup_terminate(void)
+{
+       if (ecore_idler_add(exit_idler_cb, NULL))
+               return;
+
+       exit_idler_cb(NULL);
+}
+
 /* App Life cycle funtions */
 static void win_del(void *data, Evas_Object * obj, void *event)
 {
-       elm_exit();
+       popup_terminate();
 }
 
 /* Create main window */
@@ -157,7 +171,7 @@ void mmc_response(void *data)
        if (data != NULL)
                mmc_cleanup(data);
 
-       exit(0);
+       popup_terminate();
 }
 
 /* Basic popup widget */
index cfbbd70..a8e82b8 100755 (executable)
@@ -56,17 +56,31 @@ syspopup_handler handler = {
        .def_timeout_fn = mytimeout
 };
 
+static Eina_Bool exit_idler_cb(void *data)
+{
+       elm_exit();
+       return ECORE_CALLBACK_CANCEL;
+}
+
+void popup_terminate(void)
+{
+       if (ecore_idler_add(exit_idler_cb, NULL))
+               return;
+
+       exit_idler_cb(NULL);
+}
+
 /* App Life cycle funtions */
 static void win_del(void *data, Evas_Object * obj, void *event)
 {
-       elm_exit();
+       popup_terminate();
 }
 
 /* Quit  */
 static void main_quit_cb(void *data, Evas_Object * obj, const char *emission,
                         const char *source)
 {
-       elm_exit();
+       popup_terminate();
 }
 
 /* Update text font */
@@ -209,7 +223,7 @@ static void bg_clicked_cb(void *data, Evas * e, Evas_Object * obj, void *event_i
 {
        system_print("\n system-popup : In BG Noti \n");
        fflush(stdout);
-       exit(0);
+       popup_terminate();
 }
 
 static void poweroff_popup_direct_cancel(keynode_t *key, void *data)
@@ -221,7 +235,7 @@ static void poweroff_popup_direct_cancel(keynode_t *key, void *data)
                vconf_ignore_key_changed(VCONFKEY_PM_STATE,(void*)poweroff_popup_direct_cancel);
                if (ad != NULL)
                        poweroff_cleanup(ad);
-               exit(0);
+               popup_terminate();
        }
        else
                return;
@@ -250,7 +264,7 @@ void poweroff_response_no_cb_min(void *data, Evas_Object * obj, void *event_info
        vconf_ignore_key_changed(VCONFKEY_PM_STATE,(void*)poweroff_popup_direct_cancel);
        if(data != NULL)
                poweroff_cleanup(data);
-       exit(0);
+       popup_terminate();
 }
 
 int create_and_show_basic_popup_min(struct appdata *ad)
index 529a220..088bc19 100644 (file)
 #define HOST_IDVENDOR    "_HOST_IDVENDOR"
 #define HOST_IDPRODUCT   "_HOST_IDPRODUCT"
 
+static Eina_Bool exit_idler_cb(void *data)
+{
+       elm_exit();
+       return ECORE_CALLBACK_CANCEL;
+}
+
+static void popup_terminate(void)
+{
+       if (ecore_idler_add(exit_idler_cb, NULL))
+               return;
+
+       exit_idler_cb(NULL);
+}
+
 static int ipc_socket_client_init()
 {
        __USB_FUNC_ENTER__ ;
@@ -69,7 +83,7 @@ static int ipc_socket_client_init()
 static void __win_del(void *data, Evas_Object * obj, void *event)
 {
        __USB_FUNC_ENTER__ ;
-       elm_exit();
+       popup_terminate();
        __USB_FUNC_EXIT__ ;
 }
 
@@ -109,7 +123,7 @@ static void usp_usbclient_chgdet_cb(keynode_t *key, void *data)
        ret = vconf_get_int(VCONFKEY_SYSMAN_USB_STATUS, &usb_status);
        if (0 == ret && usb_status == VCONFKEY_SYSMAN_USB_DISCONNECTED) {
                USB_LOG("USB cable is not connected");
-               elm_exit();
+               popup_terminate();
        }
        __USB_FUNC_EXIT__ ;
 }
@@ -123,7 +137,7 @@ static void usp_usbhost_chgdet_cb(keynode_t *key, void *data)
        ret = vconf_get_int(VCONFKEY_SYSMAN_USB_HOST_STATUS, &usb_status);
        if (0 == ret && usb_status == VCONFKEY_SYSMAN_USB_HOST_DISCONNECTED) {
                USB_LOG("USB host is not connected");
-               elm_exit();
+               popup_terminate();
        }
        __USB_FUNC_EXIT__ ;
 }
@@ -397,7 +411,7 @@ static void load_connection_failed_popup_ok_response_cb(void *data, Evas_Object
                return;
        }
 
-       elm_exit();
+       popup_terminate();
 
        __USB_FUNC_EXIT__ ;
 }
@@ -436,7 +450,7 @@ static void request_perm_popup_yes_response_cb(void *data, Evas_Object * obj, vo
                break;
        }
 
-       elm_exit();
+       popup_terminate();
        __USB_FUNC_EXIT__ ;
 }
 
@@ -458,7 +472,7 @@ static void request_perm_popup_no_response_cb(void *data, Evas_Object * obj, voi
                break;
        }
 
-       elm_exit();
+       popup_terminate();
        __USB_FUNC_EXIT__ ;
 }
 
@@ -477,7 +491,7 @@ static void load_connection_failed_popup(void *data)
                        NULL);
        if (0 > ret) {
                USB_LOG("FAIL: load_normal_popup(): %d", ret);
-               elm_exit();
+               popup_terminate();
        }
 
        __USB_FUNC_EXIT__ ;
@@ -498,7 +512,7 @@ static void select_app_popup_cancel_response_cb(void *data, Evas_Object * obj, v
        assert(data);
        struct appdata *ad = (struct appdata *)data;
        unload_popup(ad);
-       elm_exit();
+       popup_terminate();
        __USB_FUNC_EXIT__ ;
 }
 
@@ -559,7 +573,7 @@ static void select_app_popup_gl_select_cb(void *data, Evas_Object *obj, void *ev
                USB_LOG("FAIL: send_sel_pkg_to_usb_server(ad)");
        }
 
-       elm_exit();
+       popup_terminate();
 
        __USB_FUNC_EXIT__ ;
 }
@@ -744,7 +758,7 @@ static void load_select_pkg_for_acc_popup(struct appdata *ad)
        ret = get_accessory_info(ad);
        if (0 > ret) {
                USB_LOG("FAIL: get_accessory_info(ad)");
-               elm_exit();
+               popup_terminate();
                return ;
        }
 
@@ -789,7 +803,7 @@ static void load_select_pkg_for_host_popup(struct appdata *ad)
        ret = get_host_info(ad);
        if (0 > ret) {
                USB_LOG("FAIL: get_host_info(ad)");
-               elm_exit();
+               popup_terminate();
                return ;
        }
 
@@ -831,7 +845,7 @@ void load_request_perm_popup(struct appdata *ad)
                                request_perm_popup_no_response_cb);
        if (0 > ret) {
                USB_LOG("FAIL: load_normal_popup(): %d", ret);
-               elm_exit();
+               popup_terminate();
        }
 
        __USB_FUNC_EXIT__ ;
@@ -857,7 +871,7 @@ static int __app_reset(bundle *b, void *data)
        type = (char *)bundle_get_val(b, SYSPOPUP_TYPE);
        if (!type) {
                USB_LOG("ERROR: Non existing type of popup\n");
-               elm_exit();
+               popup_terminate();
                return -1;
        }
 
@@ -881,7 +895,7 @@ static int __app_reset(bundle *b, void *data)
        default:
                USB_LOG("ERROR: The popup type(%d) does not exist\n", ad->type);
                ad->isClientOrHost = USB_DEVICE_UNKNOWN;
-               elm_exit();
+               popup_terminate();
                return -1;
        }
 
index 6a9031d..4fcc5d9 100755 (executable)
 #define CAMERA_ADD       "camera_add"
 #define CAMERA_REMOVE    "camera_remove"
 
+static Eina_Bool exit_idler_cb(void *data)
+{
+       elm_exit();
+       return ECORE_CALLBACK_CANCEL;
+}
+
+static void popup_terminate(void)
+{
+       if (ecore_idler_add(exit_idler_cb, NULL))
+               return;
+
+       exit_idler_cb(NULL);
+}
+
 static int ipc_socket_client_init()
 {
        __USB_FUNC_ENTER__ ;
@@ -109,7 +123,7 @@ static int request_to_usb_server(int request, char *device, char *answer, int an
 /* App Life cycle funtions */
 static void win_del(void *data, Evas_Object *obj, void *event)
 {
-       elm_exit();
+       popup_terminate();
 }
 
 static void uosp_free_evas_object(Evas_Object **eo)
@@ -133,7 +147,7 @@ static void unload_window(struct appdata *ad)
 
        USB_LOG("unload window");
        uosp_free_evas_object(&(ad->win_main));
-       elm_exit();
+       popup_terminate();
 
        __USB_FUNC_EXIT__;
 }