Send responses when receiving app_control from another caller app 71/247271/1
authorYunjin Lee <yunjin-.lee@samsung.com>
Mon, 9 Nov 2020 10:07:29 +0000 (19:07 +0900)
committerYunjin Lee <yunjin-.lee@samsung.com>
Mon, 9 Nov 2020 10:07:29 +0000 (19:07 +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: I0956c7839d0271f546ed84335c07805f81ec4af1
Signed-off-by: Yunjin Lee <yunjin-.lee@samsung.com>
common/include/common_utils.h
ui/src/app_main.c

index a99dba4..3da570a 100644 (file)
@@ -103,6 +103,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 2e8e498..e268534 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);
        }