Send responses when receiving app_control from another caller app 93/245993/1
authorYunjin Lee <yunjin-.lee@samsung.com>
Wed, 21 Oct 2020 09:49:01 +0000 (18:49 +0900)
committerYunjin Lee <yunjin-.lee@samsung.com>
Wed, 21 Oct 2020 09:49:01 +0000 (18:49 +0900)
- When launching popup in launch mode 'single', if it receives
app_control of another caller app then send responses for the requests
of the previous app (If there's not answered requests then they are
treated as 'deny once')

Change-Id: I622fba70ddb7898df6183ffdb408e260cbeb69dd
Signed-off-by: Yunjin Lee <yunjin-.lee@samsung.com>
common/include/common_utils.h
ui/src/app_main.c

index 50ae4bf678db4feac2413afc55e49138d44193d3..d2b6e1f0cda02180a25df8ac33c524edb88eeedc 100644 (file)
@@ -101,6 +101,7 @@ typedef struct _app_data_s {
 } app_data_s;
 
 privacy_data_s* new_privacy_data();
+void free_privacy_data(gpointer pd);
 
 void init_app_data(app_data_s *ad);
 void free_app_data(app_data_s *ad);
index 7895a0170a942b45c1ddb37c4cdd34799c46b3a3..6bf17fb8a8b31444ab665a655ab5f9f2f7a91e04 100644 (file)
@@ -28,6 +28,8 @@
 #include "common_utils.h"
 #include "view.h"
 
+static bool send_response(app_data_s* ad, int idx);
+
 static void win_delete_request_cb(void *data, Evas_Object * obj, void *event_info)
 {
        LOGD("win del req");
@@ -101,6 +103,7 @@ static void app_control(app_control_h app_control, void *data)
                LOGE("app_control_get_launch_mode() failed. Terminate. ret = %d", ret);
                ui_app_exit();
        }
+       LOGD("launch_mode: %s", ad->mode == APP_CONTROL_LAUNCH_MODE_SINGLE ? "single" : "group");
 
        app_info_h app_info;
        ret = app_info_create(caller_appid, &app_info);
@@ -123,9 +126,19 @@ static void app_control(app_control_h app_control, void *data)
                free(caller_pkgid);
        } else {
                if (strcmp(caller_pkgid, ad->caller_pkgid) != 0) {
-                       LOGE("Received data isn't from the same caller app! Orig: %s, New: %s", ad->caller_pkgid, caller_pkgid);
-                       free(caller_pkgid);
-                       ui_app_exit();
+                       LOGI("Received data isn't from the same caller app! Orig: %s, New: %s", ad->caller_pkgid, caller_pkgid);
+                       LOGI("Send responses for requests of previous app: %s", ad->caller_pkgid);
+                       int i = 0;
+                       for (i = 0; i < ad->popup_num; ++i) {
+                               if (!send_response(ad, i))
+                                       LOGE("send_response() failed.");
+                               free(ad->popups[i].launch_type);
+                               g_list_free_full(ad->popups[i].privacy_list, free_privacy_data);
+                       }
+                       ad->popup_num = 0;
+                       ad->popup_idx = 0;
+                       free(ad->caller_pkgid);
+                       ad->caller_pkgid = g_strdup(caller_pkgid);
                }
                free(caller_pkgid);
        }