summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSangyoon Jang <s89.jang@samsung.com>2015-08-13 11:29:56 +0900
committerSangyoon Jang <s89.jang@samsung.com>2015-08-13 11:32:38 +0900
commitde2c48ed89ab7b910590659394bf8896762a960f (patch)
tree4aea2d922bf682113bc3b111cbdc11198e96c6aa
parentda2ea52161d148be8ef0d552865c54514a513dff (diff)
downloadaul-1-de2c48ed89ab7b910590659394bf8896762a960f.tar.gz
aul-1-de2c48ed89ab7b910590659394bf8896762a960f.tar.bz2
aul-1-de2c48ed89ab7b910590659394bf8896762a960f.zip
Return AUL_R_ENOAPP when cannot find requested app
Change-Id: Ibc0ecf59433ae333415f5966e046e411bcf9b920 Signed-off-by: Sangyoon Jang <s89.jang@samsung.com>
-rw-r--r--am_daemon/amd_launch.c3
-rw-r--r--src/launch.c153
2 files changed, 48 insertions, 108 deletions
diff --git a/am_daemon/amd_launch.c b/am_daemon/amd_launch.c
index 6c097af8..7d8938fb 100644
--- a/am_daemon/amd_launch.c
+++ b/am_daemon/amd_launch.c
@@ -24,6 +24,7 @@
#include <aul.h>
#include <glib.h>
#include <string.h>
+#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
#include <sys/prctl.h>
@@ -552,7 +553,7 @@ int _start_app(char* appid, bundle* kb, int cmd, int caller_pid, uid_t caller_ui
ai = appinfo_find(caller_uid, appid);
if (ai == NULL) {
_D("cannot find appinfo of %s", appid);
- __real_send(fd, -1);
+ __real_send(fd, -ENOENT);
return -1;
}
diff --git a/src/launch.c b/src/launch.c
index e9ecd067..289358d4 100644
--- a/src/launch.c
+++ b/src/launch.c
@@ -113,6 +113,44 @@ static int app_pause(void)
return 0;
}
+static int __get_aul_error(int res)
+{
+ int ret;
+
+ switch (res) {
+ case -EREJECTED:
+ ret = AUL_R_EREJECTED;
+ break;
+ case -ENOENT:
+ ret = AUL_R_ENOAPP;
+ break;
+ case -ENOLAUNCHPAD:
+ ret = AUL_R_ENOLAUNCHPAD;
+ break;
+ case -ETERMINATING:
+ ret = AUL_R_ETERMINATING;
+ break;
+ case -EILLEGALACCESS:
+ ret = AUL_R_EILLACC;
+ break;
+ case -ELOCALLAUNCH_ID:
+ ret = AUL_R_LOCAL;
+ break;
+ case -EAGAIN:
+ ret = AUL_R_ETIMEOUT;
+ break;
+ case -EINVAL:
+ ret = AUL_R_EINVAL;
+ break;
+ case -ECOMM:
+ ret = AUL_R_ECOMM;
+ break;
+ default:
+ ret = AUL_R_ERROR;
+ }
+
+ return ret;
+}
/**
* @brief encode kb and send it to 'pid'
@@ -127,36 +165,8 @@ SLPAPI int app_agent_send_cmd(int uid, int cmd, bundle *kb)
int res;
bundle_encode(kb, &kb_data, &datalen);
- if ((res = __app_agent_send_raw(uid, cmd, kb_data, datalen)) < 0) {
- switch (res) {
- case -EINVAL:
- res = AUL_R_EINVAL;
- break;
- case -ECOMM:
- res = AUL_R_ECOMM;
- break;
- case -EAGAIN:
- res = AUL_R_ETIMEOUT;
- break;
- case -ELOCALLAUNCH_ID:
- res = AUL_R_LOCAL;
- break;
- case -EILLEGALACCESS:
- res = AUL_R_EILLACC;
- break;
- case -ETERMINATING:
- res = AUL_R_ETERMINATING;
- break;
- case -ENOLAUNCHPAD:
- res = AUL_R_ENOLAUNCHPAD;
- break;
- case -EREJECTED:
- res = AUL_R_EREJECTED;
- break;
- default:
- res = AUL_R_ERROR;
- }
- }
+ if ((res = __app_agent_send_raw(uid, cmd, kb_data, datalen)) < 0)
+ res = __get_aul_error(res);
free(kb_data);
return res;
@@ -169,40 +179,13 @@ SLPAPI int app_agent_send_cmd_with_noreply(int uid, int cmd, bundle *kb)
int res;
bundle_encode(kb, &kb_data, &datalen);
- if ((res = __app_send_raw_with_noreply(uid, cmd, kb_data, datalen)) < 0) {
- switch (res) {
- case -EINVAL:
- res = AUL_R_EINVAL;
- break;
- case -ECOMM:
- res = AUL_R_ECOMM;
- break;
- case -EAGAIN:
- res = AUL_R_ETIMEOUT;
- break;
- case -ELOCALLAUNCH_ID:
- res = AUL_R_LOCAL;
- break;
- case -EILLEGALACCESS:
- res = AUL_R_EILLACC;
- break;
- default:
- res = AUL_R_ERROR;
- }
- }
+ if ((res = __app_send_raw_with_noreply(uid, cmd, kb_data, datalen)) < 0)
+ res = __get_aul_error(res);
free(kb_data);
return res;
}
-
-
-
-
-
-
-
-
/**
* @brief encode kb and send it to 'pid'
* @param[in] pid receiver's pid
@@ -216,33 +199,8 @@ SLPAPI int app_send_cmd(int pid, int cmd, bundle *kb)
int res;
bundle_encode(kb, &kb_data, &datalen);
- if ((res = __app_send_raw(pid, cmd, kb_data, datalen)) < 0) {
- switch (res) {
- case -EINVAL:
- res = AUL_R_EINVAL;
- break;
- case -ECOMM:
- res = AUL_R_ECOMM;
- break;
- case -EAGAIN:
- res = AUL_R_ETIMEOUT;
- break;
- case -ELOCALLAUNCH_ID:
- res = AUL_R_LOCAL;
- break;
- case -EILLEGALACCESS:
- res = AUL_R_EILLACC;
- break;
- case -ETERMINATING:
- res = AUL_R_ETERMINATING;
- break;
- case -ENOLAUNCHPAD:
- res = AUL_R_ENOLAUNCHPAD;
- break;
- default:
- res = AUL_R_ERROR;
- }
- }
+ if ((res = __app_send_raw(pid, cmd, kb_data, datalen)) < 0)
+ res = __get_aul_error(res);
free(kb_data);
return res;
@@ -255,27 +213,8 @@ SLPAPI int app_send_cmd_with_noreply(int pid, int cmd, bundle *kb)
int res;
bundle_encode(kb, &kb_data, &datalen);
- if ((res = __app_send_raw_with_noreply(pid, cmd, kb_data, datalen)) < 0) {
- switch (res) {
- case -EINVAL:
- res = AUL_R_EINVAL;
- break;
- case -ECOMM:
- res = AUL_R_ECOMM;
- break;
- case -EAGAIN:
- res = AUL_R_ETIMEOUT;
- break;
- case -ELOCALLAUNCH_ID:
- res = AUL_R_LOCAL;
- break;
- case -EILLEGALACCESS:
- res = AUL_R_EILLACC;
- break;
- default:
- res = AUL_R_ERROR;
- }
- }
+ if ((res = __app_send_raw_with_noreply(pid, cmd, kb_data, datalen)) < 0)
+ res = __get_aul_error(res);
free(kb_data);
return res;