port some APIs from 2.4 to 3.0 27/51227/3
authorJunghoon, Park <jh9216.park@samsung.com>
Thu, 5 Nov 2015 11:15:20 +0000 (20:15 +0900)
committerJunghoon, Park <jh9216.park@samsung.com>
Thu, 5 Nov 2015 11:52:45 +0000 (20:52 +0900)
- add aul_set_preinit_window()
- add aul_get_preinit_window()
- add aul_set_preinit_background()
- add aul_get_preinit_background()
- add aul_set_preinit_conformant()
- add aul_get_preinit_conformant()
- add aul_set_preinit_appid()
- add aul_set_preinit_pkgid()

Change-Id: I48dc0029835e8efe3d5d6642b853d10dd6b01b89
Signed-off-by: Junghoon, Park <jh9216.park@samsung.com>
am_daemon/amd_launch.c
include/aul.h
src/launch.c
src/pkginfo.c

index 68e9d66..a5a962e 100644 (file)
@@ -89,6 +89,7 @@ int _start_app_local_with_bundle(uid_t uid, const char *appid, bundle *kb)
        const struct appinfo *ai;
        const char *app_path;
        const char *pkg_type;
+       const char *pkg_id;
        const char *hwacc;
        char tmpbuf[MAX_PID_STR_BUFSZ];
 
@@ -113,11 +114,13 @@ int _start_app_local_with_bundle(uid_t uid, const char *appid, bundle *kb)
        hwacc = appinfo_get_value(ai, AIT_HWACC);
        app_path = appinfo_get_value(ai, AIT_EXEC);
        pkg_type = appinfo_get_value(ai, AIT_TYPE);
+       pkg_id = appinfo_get_value(ai, AIT_PKGID);
 
        __set_stime(kb);
        bundle_add_str(kb, AUL_K_HWACC, hwacc);
        bundle_add_str(kb, AUL_K_EXEC, app_path);
        bundle_add_str(kb, AUL_K_PACKAGETYPE, pkg_type);
+       bundle_add_str(kb, AUL_K_PKGID, pkg_id);
 
        pid = app_agent_send_cmd(uid, APP_START, kb);
        if (pid > 0)
@@ -566,6 +569,7 @@ int _start_app(const char* appid, bundle* kb, int cmd, int caller_pid,
        const char *multiple = NULL;
        const char *app_path = NULL;
        const char *pkg_type = NULL;
+       const char *pkg_id = NULL;
        int pid = -1;
        char tmpbuf[MAX_PID_STR_BUFSZ];
        const char *hwacc;
@@ -614,6 +618,7 @@ int _start_app(const char* appid, bundle* kb, int cmd, int caller_pid,
 
        app_path = appinfo_get_value(ai, AIT_EXEC);
        pkg_type = appinfo_get_value(ai, AIT_TYPE);
+       pkg_id = appinfo_get_value(ai, AIT_PKGID);
 
        if ((ret = __compare_signature(ai, cmd, caller_uid, appid, caller_appid, fd)) != 0)
                return ret;
@@ -648,6 +653,7 @@ int _start_app(const char* appid, bundle* kb, int cmd, int caller_pid,
                bundle_add(kb, AUL_K_HWACC, hwacc);
                bundle_add(kb, AUL_K_EXEC, app_path);
                bundle_add(kb, AUL_K_PACKAGETYPE, pkg_type);
+               bundle_add(kb, AUL_K_PKGID, pkg_id);
                pid = app_agent_send_cmd(caller_uid, cmd, kb);
        }
 
index 6e27d9b..3cf8ae1 100644 (file)
@@ -225,7 +225,8 @@ typedef enum _aul_type{
 #define AUL_K_LEADER_PID       "__AUL_LEADER_PID__"
 /** AUL internal private key - To support data control*/
 #define AUL_K_DATA_CONTROL_TYPE   "__AUL_DATA_CONTROL_TYPE__"
-
+/** AUL internal private key */
+#define AUL_K_PKGID            "__AUL_PKGID_"
 
 /**
  * @brief      This is callback function for aul_launch_init
@@ -1522,6 +1523,15 @@ int aul_add_caller_cb(int pid,  void (*caller_cb) (int, void *), void *data);
 int aul_remove_caller_cb(int pid);
 int aul_invoke_caller_cb(int pid);
 
+void aul_set_preinit_window(void *evas_object);
+void* aul_get_preinit_window(const char *win_name);
+void aul_set_preinit_background(void *evas_object);
+void* aul_get_preinit_background(void);
+void aul_set_preinit_conformant(void *evas_object);
+void* aul_get_preinit_conformant(void);
+void aul_set_preinit_appid(const char *appid);
+void aul_set_preinit_pkgid(const char *pkgid);
+
 int aul_update_freezer_status(int pid, const char* type);
 
 int aul_send_app_launch_request_signal(int pid, const char* appid, const char* pkgid, const char* type);
index e3dc7d7..2acb5ad 100644 (file)
 
 static int aul_initialized = 0;
 static int aul_fd;
+static void *__window_object = NULL;
+static void *__bg_object = NULL;
+static void *__conformant_object = NULL;
 
 static int (*_aul_handler) (aul_type type, bundle *kb, void *data) = NULL;
 static void *_aul_data;
 
-
-
 static int app_resume();
 static int app_terminate();
 static void __clear_internal_key(bundle *kb);
@@ -759,6 +760,36 @@ SLPAPI int aul_unset_data_control_provider_cb(void)
        return 0;
 }
 
+SLPAPI void aul_set_preinit_window(void *evas_object)
+{
+        __window_object = evas_object;
+}
+
+SLPAPI void* aul_get_preinit_window(const char *win_name)
+{
+        return __window_object;
+}
+
+SLPAPI void aul_set_preinit_background(void *evas_object)
+{
+        __bg_object = evas_object;
+}
+
+SLPAPI void* aul_get_preinit_background(void)
+{
+        return __bg_object;
+}
+
+SLPAPI void aul_set_preinit_conformant(void *evas_object)
+{
+       __conformant_object = evas_object;
+}
+
+SLPAPI void* aul_get_preinit_conformant(void)
+{
+       return __conformant_object;
+}
+
 SLPAPI int aul_pause_app(const char *appid)
 {
        int ret;
index 3aa3633..bd51e49 100644 (file)
@@ -36,6 +36,9 @@ typedef struct _internal_param_t {
        void *user_param;
 } internal_param_t;
 
+static const char *__appid = NULL;
+static const char *__pkgid = NULL;
+
 SLPAPI int aul_app_is_running(const char *appid)
 {
        int ret = 0;
@@ -43,9 +46,10 @@ SLPAPI int aul_app_is_running(const char *appid)
        if (appid == NULL)
                return 0;
 
-       ret = __app_send_raw(AUL_UTIL_PID, APP_IS_RUNNING, (unsigned char*)appid, strlen(appid));
+       ret = __app_send_raw(AUL_UTIL_PID, APP_IS_RUNNING, (unsigned char*)appid,
+                       strlen(appid));
 
-       if(ret > 0)
+       if (ret > 0)
                return true;
 
        return 0;
@@ -69,7 +73,7 @@ SLPAPI int aul_app_get_running_app_info(aul_app_info_iter_fn enum_fn,
        if (pkt == NULL)
                return AUL_R_ERROR;
 
-       for( pkt_data = (char *)pkt->data; ; pkt_data = NULL) {
+       for ( pkt_data = (char *)pkt->data; ; pkt_data = NULL) {
                token = strtok_r(pkt_data, ";", &saveptr1);
                if (token == NULL)
                        break;
@@ -87,6 +91,16 @@ SLPAPI int aul_app_get_running_app_info(aul_app_info_iter_fn enum_fn,
        return AUL_R_OK;
 }
 
+SLPAPI void aul_set_preinit_appid(const char *appid)
+{
+       __appid = appid;
+}
+
+SLPAPI void aul_set_preinit_pkgid(const char *pkgid)
+{
+       __pkgid = pkgid;
+}
+
 static int __get_info_bypid(int pid, char *appid, int len, int cmd)
 {
        char *result;
@@ -140,8 +154,8 @@ SLPAPI int aul_app_get_appid_bypid(int pid, char *appid, int len)
 
        if (pid != getpid()) {
                pkt = __app_send_cmd_with_result(AUL_UTIL_PID,
-                               APP_GET_APPID_BYPID, (unsigned char *)&pid,
-                               sizeof(pid));
+                       APP_GET_APPID_BYPID, (unsigned char *)&pid,
+                       sizeof(pid));
                if (pkt == NULL)
                        return AUL_R_ERROR;
                if (pkt->cmd == APP_GET_INFO_ERROR) {
@@ -153,6 +167,11 @@ SLPAPI int aul_app_get_appid_bypid(int pid, char *appid, int len)
                free(pkt);
                return AUL_R_OK;
        } else {
+               if (__appid) {
+                       snprintf(appid, len, "%s", __appid);
+                       return AUL_R_OK;
+               }
+
                ret = __get_appid_bypid(pid, appid, len);
                if (ret == 0)
                        return AUL_R_OK;
@@ -171,8 +190,14 @@ SLPAPI int aul_app_get_pkgid_bypid(int pid, char *pkgid, int len)
        app_pkt_t *pkt = NULL;
        int pgid;
        int cmd = APP_GET_PKGID_BYPID;
+       int cpid = getpid();
 
-       if (pid == getpid() || getuid()==0 || geteuid()==0) {
+       if (pid == cpid && __pkgid) {
+               snprintf(pkgid, len, "%s", __pkgid);
+               return AUL_R_OK;
+       }
+
+       if (pid == cpid || getuid() == 0 || geteuid() == 0) {
                if (__get_info_bypid(pid, pkgid, len, cmd) == 0) {
                        SECURE_LOGD("pkgid for %d is %s", pid, pkgid);
                        return AUL_R_OK;
@@ -194,7 +219,7 @@ SLPAPI int aul_app_get_pkgid_bypid(int pid, char *pkgid, int len)
                return AUL_R_EINVAL;
 
        pkt = __app_send_cmd_with_result(AUL_UTIL_PID, cmd,
-                       (unsigned char *)&pid, sizeof(pid));
+                                       (unsigned char *)&pid, sizeof(pid));
 
        if (pkt == NULL)
                return AUL_R_ERROR;
@@ -207,3 +232,4 @@ SLPAPI int aul_app_get_pkgid_bypid(int pid, char *pkgid, int len)
        free(pkt);
        return AUL_R_OK;
 }
+