From f5b0f560e5a797dc6d104a12f5d8dbd2b30009c4 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Mon, 26 Nov 2018 13:20:35 +0900 Subject: [PATCH] Fix a bug about aul_app_is_running functions If the running application is dying, the aul_app_is_running() function has to return "false". Change-Id: I737f77370d662f08ee6fa4b88c20aa1a27189f09 Signed-off-by: Hwankyu Jhun --- src/pkginfo.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/pkginfo.c b/src/pkginfo.c index 0f20b27..f327622 100644 --- a/src/pkginfo.c +++ b/src/pkginfo.c @@ -76,8 +76,25 @@ API int aul_app_is_running(const char *appid) API int aul_app_is_running_for_uid(const char *appid, uid_t uid) { int ret; + char buf[MAX_PID_STR_BUFSZ]; + bundle *b; + + if (appid == NULL) + return 0; - ret = aul_app_get_pid_for_uid(appid, uid); + b = bundle_create(); + if (b == NULL) { + _E("out of memory"); + return 0; + } + + snprintf(buf, sizeof(buf), "%d", uid); + bundle_add(b, AUL_K_APPID, appid); + bundle_add(b, AUL_K_TARGET_UID, buf); + + ret = aul_sock_send_bundle(AUL_UTIL_PID, uid, APP_IS_RUNNING, + b, AUL_SOCK_NONE); + bundle_free(b); if (ret > 0) return true; -- 2.7.4