From: Hwankyu Jhun Date: Fri, 9 Dec 2016 10:24:52 +0000 (+0900) Subject: Fix syspopup launch API X-Git-Tag: accepted/tizen/3.0.m2/mobile/20170104.125445^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F65%2F103765%2F2;p=platform%2Fcore%2Fbase%2Fsyspopup.git Fix syspopup launch API - Remove using sd-login API - Use aul_launch_app_async_for_uid instead of aul_launch_app_for_uid - Requires https://review.tizen.org/gerrit/#/c/102397/ https://review.tizen.org/gerrit/#/c/102399/ Change-Id: Icf6805b6502097ca32c371fff3c90b6662e15d9f Signed-off-by: Hwankyu Jhun --- diff --git a/packaging/syspopup.spec b/packaging/syspopup.spec index 9691792..bb52152 100644 --- a/packaging/syspopup.spec +++ b/packaging/syspopup.spec @@ -32,7 +32,6 @@ BuildRequires: pkgconfig(ecore-x) BuildRequires: pkgconfig(evas) BuildRequires: pkgconfig(elementary) BuildRequires: pkgconfig(libtzplatform-config) -BuildRequires: pkgconfig(libsystemd-daemon) BuildRequires: pkgconfig(aul) %define upgrade_script_path /usr/share/upgrade/scripts diff --git a/syspopup-caller/CMakeLists.txt b/syspopup-caller/CMakeLists.txt index 3ee1a45..aee2857 100644 --- a/syspopup-caller/CMakeLists.txt +++ b/syspopup-caller/CMakeLists.txt @@ -22,7 +22,7 @@ INCLUDE(FindPkgConfig) SET(pc_requires "bundle") -pkg_check_modules(spcpkgs REQUIRED dlog bundle sqlite3 glib-2.0 gio-2.0 libtzplatform-config libsystemd-daemon aul) +pkg_check_modules(spcpkgs REQUIRED dlog bundle sqlite3 glib-2.0 gio-2.0 libtzplatform-config aul) FOREACH(flag ${spcpkgs_CFLAGS}) SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") diff --git a/syspopup-caller/syspopup_caller.c b/syspopup-caller/syspopup_caller.c index 2d513a3..663172f 100755 --- a/syspopup-caller/syspopup_caller.c +++ b/syspopup-caller/syspopup_caller.c @@ -27,7 +27,6 @@ #include #include #include -#include #include #include "syspopup_core.h" @@ -42,11 +41,6 @@ API int syspopup_launch_for_uid(char *popup_name, bundle *b, uid_t uid) syspopup_info_t *info; int ret = -1; int is_bundle = 0; - int uid_max; - int i; - char *state = NULL; - uid_t *uids = NULL; - uid_t cuid = getuid(); if (popup_name == NULL) { _E("popup_name is NULL"); @@ -63,67 +57,37 @@ API int syspopup_launch_for_uid(char *popup_name, bundle *b, uid_t uid) if (b == NULL) { b = bundle_create(); + if (b == NULL) { + _E("out of memory"); + _syspopup_info_free(info); + return -1; + } is_bundle = 1; } if (_syspopup_set_name_to_bundle(b, popup_name) < 0) { _E("bundle set error\n"); _syspopup_info_free(info); - if (is_bundle == 1) + if (is_bundle) bundle_free(b); - return -1; } - if (cuid >= REGULAR_UID_MIN) { - if (cuid != uid) { - _E("Cannot launch syspopup %s in other users", - popup_name); - ret = -1; - goto end; - } - - ret = aul_launch_app_for_uid(info->pkgname, b, uid); - if (ret < 0) - _E("syspopup launch error - %d", ret); - } else { - if (uid >= REGULAR_UID_MIN) { - ret = aul_launch_app_for_uid(info->pkgname, b, uid); - if (ret < 0) - _E("syspopup launch error - %d", ret); - } else { - uid_max = sd_get_uids(&uids); - if (uid_max <= 0) { - _E("Failed to get uid list"); - ret = -1; - goto end; - } - - for (i = 0; i < uid_max; i++) { - if (sd_uid_get_state(uids[i], &state) < 0) - continue; - - if (state && (!strcmp(state, "online") || - !strcmp(state, "opening"))) { - ret = aul_launch_app_for_uid( - info->pkgname, - b, uids[i]); - if (ret < 0) { - _E("syspopup launch error - %d", - ret); - } - } - } - } + ret = aul_launch_app_async_for_uid(info->pkgname, b, uid); + if (ret < 0) { + _E("syspopup launch error - %d", ret); + _syspopup_info_free(info); + if (is_bundle) + bundle_free(b); + return -1; } -end: if (is_bundle) bundle_free(b); _syspopup_info_free(info); - return ret > 0 ? 0 : -1; + return 0; } API int syspopup_launch(char *popup_name, bundle *b)