From: Sangyoon Jang Date: Mon, 11 May 2015 10:29:35 +0000 (+0900) Subject: Add missing api: aul_terminate_pid_async X-Git-Tag: accepted/tizen/common/20150520.133244^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F84%2F39184%2F1;p=platform%2Fcore%2Fappfw%2Faul-1.git Add missing api: aul_terminate_pid_async Change-Id: Ia2b6c7247aaf939e0d45cc84b81a6d1c4d597a64 Signed-off-by: Sangyoon Jang --- diff --git a/am_daemon/amd_request.c b/am_daemon/amd_request.c index f49cab2..01bfaed 100644 --- a/am_daemon/amd_request.c +++ b/am_daemon/amd_request.c @@ -155,6 +155,13 @@ static int __app_process_by_pid(int cmd, if ((ret = __app_send_raw(pid, APP_TERM_REQ_BY_PID, (unsigned char *)&dummy, sizeof(int))) < 0) { _D("terminate req packet send error"); } + break; + case APP_TERM_BY_PID_ASYNC: + if ((ret = __app_send_raw_with_noreply(pid, cmd, (unsigned char *)&dummy, sizeof(int))) < 0) { + _D("terminate req packet send error"); + } + __real_send(clifd, ret); + break; } return ret; @@ -303,6 +310,7 @@ static gboolean __request_handler(gpointer data) case APP_RESUME_BY_PID: case APP_KILL_BY_PID: case APP_TERM_REQ_BY_PID: + case APP_TERM_BY_PID_ASYNC: kb = bundle_decode(pkt->data, pkt->len); appid = (char *)bundle_get_val(kb, AUL_K_APPID); ret = __app_process_by_pid(pkt->cmd, appid, &cr, clifd); diff --git a/include/app_sock.h b/include/app_sock.h index 7b70ac1..78f5536 100644 --- a/include/app_sock.h +++ b/include/app_sock.h @@ -52,6 +52,7 @@ enum app_cmd { APP_RELEASED, APP_RUNNING_LIST_UPDATE, APP_TERM_REQ_BY_PID, + APP_TERM_BY_PID_ASYNC, /* reserved for AMD Agent */ APP_DEAD_SIGNAL, @@ -67,6 +68,7 @@ enum app_cmd { #define EILLEGALACCESS 127 #define ETERMINATING 126 #define ENOLAUNCHPAD 125 +#define EREJECTED 123 typedef struct _app_pkt_t { int cmd; diff --git a/include/aul.h b/include/aul.h index c02f9fb..39b1564 100644 --- a/include/aul.h +++ b/include/aul.h @@ -71,7 +71,9 @@ extern "C" { * @brief Return values in AUL. */ typedef enum _aul_return_val { - AUL_R_ENOAPP = -11, /**< Failed to find app ID or pkg ID */ + AUL_R_EREJECTED = -14, /**< App disable for mode */ + AUL_R_ENOAPP = -13, /**< Failed to find app ID or pkg ID */ + AUL_R_EHIDDENFORGUEST = -11, /**< App hidden for guest mode */ AUL_R_ENOLAUNCHPAD = -10, /**< no launchpad */ AUL_R_ETERMINATING = -9, /**< application terminating */ AUL_R_EILLACC = -8, /**< Illegal Access */ @@ -620,6 +622,7 @@ int aul_resume_pid(int pid); * If you have not the permission, this API return AUL_R_ERROR. \n */ int aul_terminate_pid(int pid); +int aul_terminate_pid_async(int pid); /** @} */ diff --git a/src/launch.c b/src/launch.c index 6ea4070..347f174 100644 --- a/src/launch.c +++ b/src/launch.c @@ -140,6 +140,9 @@ SLPAPI int app_agent_send_cmd(int uid, int cmd, bundle *kb) case -ENOLAUNCHPAD: res = AUL_R_ENOLAUNCHPAD; break; + case -EREJECTED: + res = AUL_R_EREJECTED; + break; default: res = AUL_R_ERROR; } @@ -411,7 +414,7 @@ int aul_sock_handler(int fd) return -1; } - if (pkt->cmd != APP_RESULT && pkt->cmd != APP_CANCEL) { + if (pkt->cmd != APP_RESULT && pkt->cmd != APP_CANCEL && pkt->cmd != APP_TERM_BY_PID_ASYNC) { ret = __send_result_to_launchpad(clifd, 0); if (ret < 0) { free(pkt); @@ -438,6 +441,7 @@ int aul_sock_handler(int fd) break; case APP_TERM_BY_PID: /* run in callee */ + case APP_TERM_BY_PID_ASYNC: app_terminate(); break; @@ -621,6 +625,19 @@ SLPAPI int aul_terminate_pid(int pid) return ret; } +SLPAPI int aul_terminate_pid_async(int pid) +{ + char pkgname[MAX_PID_STR_BUFSZ]; + int ret; + + if (pid <= 0) + return AUL_R_EINVAL; + + snprintf(pkgname, MAX_PID_STR_BUFSZ, "%d", pid); + ret = app_request_to_launchpad(APP_TERM_BY_PID_ASYNC, pkgname, NULL); + return ret; +} + SLPAPI int aul_kill_pid(int pid) { char pkgname[MAX_PID_STR_BUFSZ];