Use preinitialized app root path 28/58028/1 accepted/tizen/mobile/20160128.010547 accepted/tizen/tv/20160128.010602 accepted/tizen/wearable/20160128.010630 submit/tizen/20160127.083815
authorJunghoon Park <jh9216.park@samsung.com>
Wed, 27 Jan 2016 02:39:17 +0000 (11:39 +0900)
committerJunghoon Park <jh9216.park@samsung.com>
Wed, 27 Jan 2016 02:39:17 +0000 (11:39 +0900)
- Launchpad loader will prepare preinitialized app root path to improve
  performance.

Change-Id: I880826babcb9c3593784e7eaf5a84cd006d3ad44
Signed-off-by: Junghoon Park <jh9216.park@samsung.com>
include/aul.h
src/aul_path.c
src/pkginfo.c

index ed7cb08..8f26a41 100644 (file)
@@ -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);
 
 /*
index 50e9f45..400a0e7 100644 (file)
@@ -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)
index 826f8d0..accd99b 100644 (file)
@@ -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;