From 5a0d39ac2b0410d07a9c2fbd7fddc9331aa599bb Mon Sep 17 00:00:00 2001 From: "Junseok, Kim" Date: Tue, 27 Oct 2020 16:35:38 +0900 Subject: [PATCH] e_appinfo: Delete E_Appinfo at compositor unbind instead of tzpol, tzlaunch_appinfo unbind. The tizen_policy and tizen_launch_appinfo unbind can called by client when the client launching. Since the E_Appinfo is removed at this time and re-created later, the base_output_resolution could not work properly. For fix this issue, delete E_Appinfo when the compositor unbind callback called. And added the E_Appinfo_Owner for recognize the E_Appinfo is created by client or server. The E_Appinfo that created by client, will be destroyed at deregister_pid/appid request callback. The others that created by server, will be destroyed at compositor unbind. Change-Id: Id97ab328bc7a8a7ff97455d33f8b72c720b3b56b Signed-off-by: Junseok, Kim --- src/bin/e_appinfo.c | 18 ++++++++++++++++++ src/bin/e_appinfo.h | 8 ++++++++ src/bin/e_comp_wl.c | 7 +++++++ src/bin/e_policy_wl.c | 19 +++++-------------- 4 files changed, 38 insertions(+), 14 deletions(-) diff --git a/src/bin/e_appinfo.c b/src/bin/e_appinfo.c index 4ba6c290d6..928c125e65 100644 --- a/src/bin/e_appinfo.c +++ b/src/bin/e_appinfo.c @@ -20,6 +20,7 @@ struct _E_Appinfo Eina_Bool base_output_available; int base_output_width; int base_output_height; + E_Appinfo_Owner owner; }; static void @@ -65,6 +66,7 @@ e_appinfo_new(void) eai->pid = -1; eai->appid = NULL; + eai->owner = E_APPINFO_OWNER_SERVER; appinfo_list = eina_list_append(appinfo_list, eai); @@ -217,6 +219,22 @@ e_appinfo_base_output_resolution_get(E_Appinfo *eai, int *width, int *height) return EINA_TRUE; } +EINTERN E_Appinfo_Owner +e_appinfo_owner_get(E_Appinfo *eai) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(eai, E_APPINFO_OWNER_SERVER); + + return eai->owner; +} + +EINTERN void +e_appinfo_owner_set(E_Appinfo *eai, E_Appinfo_Owner owner) +{ + EINA_SAFETY_ON_NULL_RETURN(eai); + + eai->owner = owner; +} + E_API E_Appinfo * e_appinfo_find_with_pid(pid_t pid) { diff --git a/src/bin/e_appinfo.h b/src/bin/e_appinfo.h index 566fc2feb4..2a6d03532e 100644 --- a/src/bin/e_appinfo.h +++ b/src/bin/e_appinfo.h @@ -24,6 +24,12 @@ struct _E_Appinfo_Hook unsigned char delete_me : 1; }; +typedef enum _E_Appinfo_Owner +{ + E_APPINFO_OWNER_SERVER, + E_APPINFO_OWNER_CLIENT, +} E_Appinfo_Owner; + EINTERN E_Appinfo *e_appinfo_new(void); EINTERN void e_appinfo_del(E_Appinfo *eai); EINTERN pid_t e_appinfo_pid_get(E_Appinfo *epai); @@ -31,6 +37,8 @@ EINTERN Eina_Bool e_appinfo_pid_set(E_Appinfo *eai, pid_t pid); EINTERN Eina_Bool e_appinfo_appid_set(E_Appinfo *eai, const char *appid); EINTERN void e_appinfo_ready_metadata(E_Appinfo *eai, pid_t pid); EINTERN Eina_Bool e_appinfo_base_output_resolution_get(E_Appinfo *eai, int *width, int *height); +EINTERN E_Appinfo_Owner e_appinfo_owner_get(E_Appinfo *eai); +EINTERN void e_appinfo_owner_set(E_Appinfo *eai, E_Appinfo_Owner owner); E_API E_Appinfo *e_appinfo_find_with_pid(pid_t pid); E_API E_Appinfo *e_appinfo_find_with_appid(const char *appid); diff --git a/src/bin/e_comp_wl.c b/src/bin/e_comp_wl.c index c9e5a29571..50cfd387ba 100644 --- a/src/bin/e_comp_wl.c +++ b/src/bin/e_comp_wl.c @@ -3365,6 +3365,7 @@ _e_comp_wl_pname_print(pid_t pid) static void _e_comp_wl_compositor_cb_unbind(struct wl_resource *res_comp) { + E_Appinfo *eai = NULL; struct wl_client *client; pid_t pid = 0; uid_t uid = 0; @@ -3403,6 +3404,12 @@ _e_comp_wl_compositor_cb_unbind(struct wl_resource *res_comp) E_FREE(cinfo); } } + + eai = e_appinfo_find_with_pid(pid); + if (e_appinfo_owner_get(eai) == E_APPINFO_OWNER_SERVER) + { + e_appinfo_del(eai); + } } static void diff --git a/src/bin/e_policy_wl.c b/src/bin/e_policy_wl.c index 5dbb29593f..f7987277f0 100644 --- a/src/bin/e_policy_wl.c +++ b/src/bin/e_policy_wl.c @@ -3192,6 +3192,7 @@ _tzpol_iface_cb_set_appid(struct wl_client *client, struct wl_resource *res_tzpo { eai = e_appinfo_new(); e_appinfo_appid_set(eai, appid); + e_appinfo_owner_set(eai, E_APPINFO_OWNER_CLIENT); } EINA_SAFETY_ON_NULL_RETURN(eai); @@ -3249,13 +3250,6 @@ static void _tzpol_cb_unbind(struct wl_resource *res_tzpol) { E_Policy_Wl_Tzpol *tzpol; - E_Appinfo *eai = NULL; - pid_t pid = -1; - - wl_client_get_credentials(wl_resource_get_client(res_tzpol), &pid, NULL, NULL); - eai = e_appinfo_find_with_pid(pid); - if (eai) - e_appinfo_del(eai); tzpol = _e_policy_wl_tzpol_get(res_tzpol); EINA_SAFETY_ON_NULL_RETURN(tzpol); @@ -6507,6 +6501,8 @@ _tzlaunch_appinfo_iface_cb_register_pid(struct wl_client *client, struct wl_reso e_appinfo_del(eai); return; } + + e_appinfo_owner_set(eai, E_APPINFO_OWNER_CLIENT); } static void @@ -6668,6 +6664,8 @@ _tzlaunch_appinfo_iface_cb_register_appid(struct wl_client *client, struct wl_re e_appinfo_del(eai); return; } + + e_appinfo_owner_set(eai, E_APPINFO_OWNER_CLIENT); } static void @@ -6808,13 +6806,6 @@ _tzlaunch_appinfo_cb_unbind(struct wl_resource *res_tzlaunch_appinfo) { E_Policy_Wl_Tzlaunch_Appinfo *tzlaunch_appinfo = NULL; Eina_List *l, *ll; - E_Appinfo *eai = NULL; - pid_t pid = -1; - - wl_client_get_credentials(wl_resource_get_client(res_tzlaunch_appinfo), &pid, NULL, NULL); - eai = e_appinfo_find_with_pid(pid); - if (eai) - e_appinfo_del(eai); EINA_LIST_FOREACH_SAFE(polwl->tzlaunch_appinfo, l, ll, tzlaunch_appinfo) { -- 2.34.1