From 353c0f1b18ea69182a02b629828d6930209e0d7c Mon Sep 17 00:00:00 2001 From: Junghoon Park Date: Wed, 27 Jan 2016 11:39:17 +0900 Subject: [PATCH] Use preinitialized app root path - Launchpad loader will prepare preinitialized app root path to improve performance. Change-Id: I880826babcb9c3593784e7eaf5a84cd006d3ad44 Signed-off-by: Junghoon Park --- include/aul.h | 12 ++++++++++++ src/aul_path.c | 11 +++++++++++ src/pkginfo.c | 11 +++++++++++ 3 files changed, 34 insertions(+) diff --git a/include/aul.h b/include/aul.h index ed7cb08..8f26a41 100644 --- a/include/aul.h +++ b/include/aul.h @@ -181,6 +181,8 @@ typedef enum _aul_type{ #define AUL_K_COM_FILTER "__AUL_COM_FILTER__" /** AUL internal private key */ #define AUL_K_COM_RESULT "__AUL_COM_RESULT__" +/** AUL internal private key */ +#define AUL_K_ROOT_PATH "__AUL_ROOT_PATH__" /** * @brief This is callback function for aul_launch_init @@ -1774,6 +1776,16 @@ void aul_set_preinit_pkgid(const char *pkgid); /* * This API is only for Appfw internally. */ +void aul_set_preinit_root_path(const char *root_path); + +/* + * This API is only for Appfw internally. + */ +const char *aul_get_preinit_root_path(void); + +/* + * This API is only for Appfw internally. + */ int aul_update_freezer_status(int pid, const char* type); /* diff --git a/src/aul_path.c b/src/aul_path.c index 50e9f45..400a0e7 100644 --- a/src/aul_path.c +++ b/src/aul_path.c @@ -140,6 +140,17 @@ static int __get_path_from_db(char **path, const char *appid, const char *dir_na int ret; pkgmgrinfo_pkginfo_h pkginfo; int len; + const char *root_path; + + root_path = aul_get_preinit_root_path(); + if (appid == NULL && root_path) { + len = root_path ? strlen(root_path) : 0; + snprintf(buf, sizeof(buf), "%s%s%s", root_path, + root_path[len - 1] == '/' ? "" : "/", + dir_name ? dir_name : ""); + *path = strdup(buf); + return AUL_R_OK; + } ret = __get_pkgid(pkgid, sizeof(pkgid), appid, uid); if (ret != AUL_R_OK) diff --git a/src/pkginfo.c b/src/pkginfo.c index 826f8d0..accd99b 100644 --- a/src/pkginfo.c +++ b/src/pkginfo.c @@ -33,6 +33,7 @@ typedef struct _internal_param_t { static const char *__appid = NULL; static const char *__pkgid = NULL; +static const char *__root_path = NULL; API int aul_app_get_pid(const char *appid) { @@ -114,6 +115,16 @@ API void aul_set_preinit_pkgid(const char *pkgid) __pkgid = pkgid; } +API void aul_set_preinit_root_path(const char *root_path) +{ + __root_path = root_path; +} + +API const char *aul_get_preinit_root_path(void) +{ + return __root_path; +} + static int __get_info_bypid(int pid, char *appid, int len, int cmd) { char *result; -- 2.7.4