From e3b24c3115f75927539ebbc66e6d36121fd03131 Mon Sep 17 00:00:00 2001 From: Yunjin Lee Date: Mon, 9 Nov 2020 19:07:29 +0900 Subject: [PATCH] Send responses when receiving app_control from another caller app - 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 --- common/include/common_utils.h | 1 + ui/src/app_main.c | 19 ++++++++++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/common/include/common_utils.h b/common/include/common_utils.h index a99dba4..3da570a 100644 --- a/common/include/common_utils.h +++ b/common/include/common_utils.h @@ -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); diff --git a/ui/src/app_main.c b/ui/src/app_main.c index 2e8e498..e268534 100644 --- a/ui/src/app_main.c +++ b/ui/src/app_main.c @@ -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); } -- 2.7.4