Add missing api: aul_terminate_pid_async 84/39184/1 accepted/tizen/common/20150520.133244 accepted/tizen/mobile/20150521.005931 accepted/tizen/tv/20150521.005315 accepted/tizen/wearable/20150521.005616 submit/tizen/20150512.054616
authorSangyoon Jang <s89.jang@samsung.com>
Mon, 11 May 2015 10:29:35 +0000 (19:29 +0900)
committerSangyoon Jang <s89.jang@samsung.com>
Mon, 11 May 2015 10:30:16 +0000 (19:30 +0900)
Change-Id: Ia2b6c7247aaf939e0d45cc84b81a6d1c4d597a64
Signed-off-by: Sangyoon Jang <s89.jang@samsung.com>
am_daemon/amd_request.c
include/app_sock.h
include/aul.h
src/launch.c

index f49cab2..01bfaed 100644 (file)
@@ -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);
index 7b70ac1..78f5536 100644 (file)
@@ -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;
index c02f9fb..39b1564 100644 (file)
@@ -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);
 
 /** @} */
 
index 6ea4070..347f174 100644 (file)
@@ -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];