summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHwankyu Jhun <h.jhun@samsung.com>2015-12-16 08:33:21 +0900
committerHwankyu Jhun <h.jhun@samsung.com>2015-12-16 09:21:31 +0900
commite9eada61304bc8aa696926f504bf5660934ce6ec (patch)
tree0da4e7835ae493e40b87340d1903198b9fc6e1ce
parent1288739a40f2278b700f98cc8708c763e07c6a93 (diff)
downloadaul-1-e9eada61304bc8aa696926f504bf5660934ce6ec.tar.gz
aul-1-e9eada61304bc8aa696926f504bf5660934ce6ec.tar.bz2
aul-1-e9eada61304bc8aa696926f504bf5660934ce6ec.zip
- add effective appid feature - fix code intent - add the space after struct definition Change-Id: I526e7306cf2adb9f0a92905e7825fbb3e3d8c92e Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
-rw-r--r--am_daemon/amd_appinfo.c51
-rw-r--r--am_daemon/amd_appinfo.h1
-rw-r--r--am_daemon/amd_request.c37
-rw-r--r--am_daemon/amd_status.c4
4 files changed, 73 insertions, 20 deletions
diff --git a/am_daemon/amd_appinfo.c b/am_daemon/amd_appinfo.c
index 293f7d67..ffd8377e 100644
--- a/am_daemon/amd_appinfo.c
+++ b/am_daemon/amd_appinfo.c
@@ -63,6 +63,7 @@ enum _appinfo_idx {
_AI_BG_CATEGORY,
_AI_LAUNCH_MODE,
_AI_GLOBAL,
+ _AI_EFFECTIVE_APPID,
_AI_MAX,
};
#define _AI_START _AI_NAME /* start index */
@@ -423,25 +424,41 @@ static int __appinfo_add_global(const pkgmgrinfo_appinfo_h handle, struct appinf
return 0;
}
+static int __appinfo_add_effective_appid(const pkgmgrinfo_appinfo_h handle, struct appinfo *info, void *data)
+{
+ char *effective_appid = NULL;
+
+ if (pkgmgrinfo_appinfo_get_effective_appid(handle, &effective_appid) != PMINFO_R_OK) {
+ _D("Failed to get effective appid");
+ info->val[_AI_EFFECTIVE_APPID] = NULL;
+ } else {
+ if (effective_appid && strlen(effective_appid) > 0)
+ info->val[_AI_EFFECTIVE_APPID] = strdup(effective_appid);
+ }
+
+ return 0;
+}
+
static struct appinfo_t _appinfos[] = {
- [_AI_NAME] = { "Name", AIT_NAME, __appinfo_add_name },
- [_AI_EXEC] = { "Exec", AIT_EXEC, __appinfo_add_exec },
- [_AI_TYPE] = { "PkgType", AIT_TYPE, __appinfo_add_type },
- [_AI_ONBOOT] = { "StartOnBoot", AIT_ONBOOT, __appinfo_add_onboot },
- [_AI_RESTART] = { "AutoRestart", AIT_RESTART, __appinfo_add_restart },
- [_AI_MULTI] = { "Multiple", AIT_MULTI, __appinfo_add_multi },
- [_AI_HWACC] = { "Hwacceleration", AIT_HWACC, __appinfo_add_hwacc },
- [_AI_PERM] = { "PermissionType", AIT_PERM, __appinfo_add_perm },
- [_AI_PKGID] = { "PackageId", AIT_PKGID, __appinfo_add_pkgid },
- [_AI_PRELOAD] = { "Preload", AIT_PRELOAD, __appinfo_add_preload },
- [_AI_STATUS] = { "Status", AIT_STATUS, __appinfo_add_status },
- [_AI_POOL] = { "ProcessPool", AIT_POOL, __appinfo_add_pool },
- [_AI_COMPTYPE] = { "ComponentType", AIT_COMPTYPE, __appinfo_add_comptype },
+ [_AI_NAME] = {"Name", AIT_NAME, __appinfo_add_name},
+ [_AI_EXEC] = {"Exec", AIT_EXEC, __appinfo_add_exec},
+ [_AI_TYPE] = {"PkgType", AIT_TYPE, __appinfo_add_type},
+ [_AI_ONBOOT] = {"StartOnBoot", AIT_ONBOOT, __appinfo_add_onboot},
+ [_AI_RESTART] = {"AutoRestart", AIT_RESTART, __appinfo_add_restart},
+ [_AI_MULTI] = {"Multiple", AIT_MULTI, __appinfo_add_multi},
+ [_AI_HWACC] = {"Hwacceleration", AIT_HWACC, __appinfo_add_hwacc},
+ [_AI_PERM] = {"PermissionType", AIT_PERM, __appinfo_add_perm},
+ [_AI_PKGID] = {"PackageId", AIT_PKGID, __appinfo_add_pkgid},
+ [_AI_PRELOAD] = {"Preload", AIT_PRELOAD, __appinfo_add_preload},
+ [_AI_STATUS] = {"Status", AIT_STATUS, __appinfo_add_status},
+ [_AI_POOL] = {"ProcessPool", AIT_POOL, __appinfo_add_pool},
+ [_AI_COMPTYPE] = {"ComponentType", AIT_COMPTYPE, __appinfo_add_comptype},
[_AI_TEP] = {"Tep", AIT_TEP, __appinfo_add_tep},
- [_AI_STORAGE_TYPE] = {"StorageType", AIT_STORAGE_TYPE, __appinfo_add_storage_type },
- [_AI_BG_CATEGORY] = { "BackgroundCategory", AIT_BG_CATEGORY, __appinfo_add_bg_category },
- [_AI_LAUNCH_MODE] = {"launch_mode", AIT_LAUNCH_MODE, __appinfo_add_launch_mode },
- [_AI_GLOBAL] = {"global", AIT_GLOBAL, __appinfo_add_global },
+ [_AI_STORAGE_TYPE] = {"StorageType", AIT_STORAGE_TYPE, __appinfo_add_storage_type},
+ [_AI_BG_CATEGORY] = {"BackgroundCategory", AIT_BG_CATEGORY, __appinfo_add_bg_category},
+ [_AI_LAUNCH_MODE] = {"launch_mode", AIT_LAUNCH_MODE, __appinfo_add_launch_mode},
+ [_AI_GLOBAL] = {"global", AIT_GLOBAL, __appinfo_add_global},
+ [_AI_EFFECTIVE_APPID] = {"effective-appid", AIT_EFFECTIVE_APPID, __appinfo_add_effective_appid},
};
static int __appinfo_insert_handler (const pkgmgrinfo_appinfo_h handle,
diff --git a/am_daemon/amd_appinfo.h b/am_daemon/amd_appinfo.h
index 764b56a3..f08a1693 100644
--- a/am_daemon/amd_appinfo.h
+++ b/am_daemon/amd_appinfo.h
@@ -41,6 +41,7 @@ enum appinfo_type {
AIT_BG_CATEGORY,
AIT_LAUNCH_MODE,
AIT_GLOBAL,
+ AIT_EFFECTIVE_APPID,
AIT_MAX
};
diff --git a/am_daemon/amd_request.c b/am_daemon/amd_request.c
index 6dfaec6f..029f2ffb 100644
--- a/am_daemon/amd_request.c
+++ b/am_daemon/amd_request.c
@@ -324,6 +324,40 @@ static int __app_process_by_pid(int cmd,
return ret;
}
+static void __set_effective_appid(uid_t uid, bundle *kb)
+{
+ const struct appinfo *ai;
+ const struct appinfo *effective_ai;
+ const char *appid;
+ const char *effective_appid;
+ const char *pkgid;
+ const char *effective_pkgid;
+
+ appid = bundle_get_val(kb, AUL_K_APPID);
+ if (appid == NULL)
+ return;
+
+ ai = appinfo_find(uid, appid);
+ if (ai == NULL)
+ return;
+
+ effective_appid = appinfo_get_value(ai, AIT_EFFECTIVE_APPID);
+ if (effective_appid == NULL)
+ return;
+
+ effective_ai = appinfo_find(uid, effective_appid);
+ if (effective_ai == NULL)
+ return;
+
+ pkgid = appinfo_get_value(ai, AIT_PKGID);
+ effective_pkgid = appinfo_get_value(effective_ai, AIT_PKGID);
+ if (pkgid && effective_pkgid && strcmp(pkgid, effective_pkgid) == 0) {
+ _D("use effective appid instead of the real appid");
+ bundle_del(kb, AUL_K_APPID);
+ bundle_add(kb, AUL_K_APPID, effective_appid);
+ }
+}
+
static gboolean __add_history_handler(gpointer user_data)
{
struct rua_rec rec;
@@ -337,7 +371,6 @@ static gboolean __add_history_handler(gpointer user_data)
return FALSE;
if (!pkt->is_group_app) {
-
ai = (struct appinfo *)appinfo_find(pkt->uid, pkt->appid);;
app_path = (char *)appinfo_get_value(ai, AIT_EXEC);
@@ -672,6 +705,8 @@ static int __dispatch_app_start(int clifd, const app_pkt_t *pkt, struct ucred *c
return -1;
}
+ __set_effective_appid(cr->uid, kb);
+
appid = bundle_get_val(kb, AUL_K_APPID);
if (cr->uid < REGULAR_UID_MIN) {
target_uid = bundle_get_val(kb, AUL_K_TARGET_UID);
diff --git a/am_daemon/amd_status.c b/am_daemon/amd_status.c
index 822aa5f7..9d3b5229 100644
--- a/am_daemon/amd_status.c
+++ b/am_daemon/amd_status.c
@@ -44,10 +44,10 @@ typedef struct _pkg_status_info_t {
char *pkgid;
int status;
GSList *ui_list;
- GSList *svc_list;
+ GSList *svc_list;
} pkg_status_info_t;
-typedef struct _app_status_info_t{
+typedef struct _app_status_info_t {
char *appid;
char *app_path;
char *pkgid;