summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSabera Djelti (sdi2) <sabera.djelti@open.eurogiciel.org>2014-07-01 15:19:35 +0200
committerSabera Djelti (sdi2) <sabera.djelti@open.eurogiciel.org>2014-08-11 15:48:52 +0200
commit2397f8df2fb06ed0222bd07cbac24eaf3d29ea66 (patch)
treebc1124408ee690729180ec1ea1666abf851b4b88
parent35b19df9d1cc8fe299fe29ea450cb9ec9c464d31 (diff)
downloadaul-1-2397f8df2fb06ed0222bd07cbac24eaf3d29ea66.tar.gz
aul-1-2397f8df2fb06ed0222bd07cbac24eaf3d29ea66.tar.bz2
aul-1-2397f8df2fb06ed0222bd07cbac24eaf3d29ea66.zip
->Add/Use Usr App related fonctions instead of Global App related Functions Change-Id: I7c5cfb48ed6725f118c0117cc0482cccaf333669 Signed-off-by: Sabera Djelti (sdi2) <sabera.djelti@open.eurogiciel.org> Signed-off-by: Baptiste DURAND <baptiste.durand@open.eurogiciel.org>
-rwxr-xr-xam_daemon/amd_appinfo.c22
-rwxr-xr-xam_daemon/amd_launch.c7
-rwxr-xr-xam_daemon/amd_main.c5
-rwxr-xr-xinclude/menu_db_util.h49
-rwxr-xr-xinclude/simple_util.h3
-rwxr-xr-xsrc/mime.c32
-rwxr-xr-xsrc/service.c26
7 files changed, 103 insertions, 41 deletions
diff --git a/am_daemon/amd_appinfo.c b/am_daemon/amd_appinfo.c
index 6109cc4d..805899c4 100755
--- a/am_daemon/amd_appinfo.c
+++ b/am_daemon/amd_appinfo.c
@@ -105,7 +105,6 @@ static int __app_info_insert_handler (const pkgmgrinfo_appinfo_h handle, void *d
_E("null app handle");
return -1;
}
-
ret = pkgmgrinfo_appinfo_get_appid(handle, &appid);
if (ret < 0) {
_E("fail to get appinfo");
@@ -217,12 +216,13 @@ static int __app_info_delete_handler (const pkgmgrinfo_appinfo_h handle, void *d
return 0;
}
-static int _read_pkg_info(struct appinfomgr *cf)
+static int _read_pkg_info(struct appinfomgr *cf, uid_t uid)
{
int r;
-
- r = pkgmgrinfo_appinfo_get_install_list(__app_info_insert_handler, cf);
-
+ if(uid != GLOBAL_USER)
+ r = pkgmgrinfo_appinfo_get_usr_install_list(__app_info_insert_handler, uid, cf);
+ else
+ r = pkgmgrinfo_appinfo_get_install_list(__app_info_insert_handler, cf);
return r;
}
@@ -269,7 +269,11 @@ static void __vconf_cb(keynode_t *key, void *data)
_D("appid: [%s]\n", appid);
_D("uid: %d\n", uid);
if ( strncmp(type_string, "create", 6) == 0) {
- ret = pkgmgrinfo_appinfo_get_appinfo_user(appid, uid, &handle);
+ //is_admin
+ if (uid != GLOBAL_USER)
+ ret = pkgmgrinfo_appinfo_get_usr_appinfo(appid, uid, &handle);
+ else
+ ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
if(ret < 0) {
_E("pkgmgrinfo_appinfo_get_appinfo fail");
}
@@ -284,7 +288,7 @@ static void __vconf_cb(keynode_t *key, void *data)
} else if (strncmp(type_string, "update", 6) == 0){
/*REMOVE EXISTING ENTRY & CREATE AGAIN*/
if (g_hash_table_remove(cf->tbl, appid)){
- if (pkgmgrinfo_appinfo_get_appinfo_user(appid, uid, &handle) == PMINFO_R_OK){
+ if (pkgmgrinfo_appinfo_get_usr_appinfo(appid, uid, &handle) == PMINFO_R_OK){
__app_info_insert_handler(handle, data);
pkgmgrinfo_appinfo_destroy_appinfo(handle);
}
@@ -368,7 +372,7 @@ int appinfo_init(struct appinfomgr **cf)
if (!_cf)
return -1;
- r = _read_pkg_info(_cf);
+ r = _read_pkg_info(_cf, getuid());
if (r != PMINFO_R_OK) {
_fini(_cf);
return -1;
@@ -436,7 +440,7 @@ const struct appinfo *appinfo_find(uid_t caller_uid, const char *appid)
pkgmgrinfo_permission_type permission;
int ret;
- ret = pkgmgrinfo_appinfo_get_appinfo( appid, &handle);
+ ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
if (ret != PMINFO_R_OK){
ret = pkgmgrinfo_appinfo_get_appinfo_user(appid , caller_uid , &handle);
if (ret != PMINFO_R_OK){
diff --git a/am_daemon/amd_launch.c b/am_daemon/amd_launch.c
index 2bf833b0..5e50ad50 100755
--- a/am_daemon/amd_launch.c
+++ b/am_daemon/amd_launch.c
@@ -58,6 +58,7 @@
#define SDK_CODE_COVERAGE "CODE_COVERAGE"
#define SDK_DYNAMIC_ANALYSIS "DYNAMIC_ANALYSIS"
#define PATH_DA_SO "/home/developer/sdk_tools/da/da_probe.so"
+#define GLOBAL_USER 0 //#define tzplatform_getenv(TZ_GLOBAL) //TODO
struct appinfomgr *_laf;
struct cginfo *_lcg;
@@ -748,7 +749,11 @@ int _start_app(char* appid, bundle* kb, int cmd, int caller_pid, uid_t caller_ui
caller_ai = appinfo_find(caller_uid, caller_appid);
preload = appinfo_get_value(caller_ai, AIT_PRELOAD);
if( preload && strncmp(preload, "true", 4) != 0 ) {
- pkgmgrinfo_pkginfo_compare_app_cert_info(caller_appid, appid, &compare_result);
+ //is admin is global
+ if(caller_uid != GLOBAL_USER)
+ pkgmgrinfo_pkginfo_compare_usr_app_cert_info(caller_appid, appid, caller_uid, &compare_result);
+ else
+ pkgmgrinfo_pkginfo_compare_app_cert_info(caller_appid, appid, &compare_result);
if(compare_result != PMINFO_CERT_COMPARE_MATCH) {
pid = -EILLEGALACCESS;
__real_send(fd, pid);
diff --git a/am_daemon/amd_main.c b/am_daemon/amd_main.c
index 2c477eca..9dc4aed3 100755
--- a/am_daemon/amd_main.c
+++ b/am_daemon/amd_main.c
@@ -156,8 +156,9 @@ gboolean __add_item_running_list(gpointer user_data)
if(limit>0) __kill_bg_apps(limit-1);
return false;
}
-
- ail_ret = ail_package_get_appinfo(pkgname, &handle);
+ //is admin is global
+ ail_ret = ail_package_get_usr_appinfo(pkgname, user, &handle);
+ //ail_ret = ail_package_get_appinfo(pkgname, &handle);
if (ail_ret != AIL_ERROR_OK) {
_E("ail_get_appinfo with %s failed", pkgname);
return false;
diff --git a/include/menu_db_util.h b/include/menu_db_util.h
index 4bf2c215..954c2792 100755
--- a/include/menu_db_util.h
+++ b/include/menu_db_util.h
@@ -120,20 +120,30 @@ static inline app_info_from_db *_get_app_info_from_db_by_pkgname(
if (menu_info == NULL) {
return NULL;
}
-
- ret = ail_get_appinfo(pkgname, &handle);
+ //is_admin is global
+ if (getuid() != GLOBAL_USER)
+ ret = ail_get_usr_appinfo(pkgname, getuid(), &handle);
+ else
+ ret = ail_get_appinfo(pkgname, &handle);
+
if (ret != AIL_ERROR_OK) {
_free_app_info_from_db(menu_info);
return NULL;
}
-
- ret = ail_appinfo_get_str(handle, AIL_PROP_PACKAGE_STR, &str);
+//is admin is global
+ if (getuid() != GLOBAL_USER)
+ ret = ail_appinfo_get_usr_str(handle, AIL_PROP_PACKAGE_STR, getuid(), &str);
+ else
+ ret = ail_appinfo_get_str(handle, AIL_PROP_PACKAGE_STR, &str);
if (str) {
menu_info->pkg_name = strdup(str);
str = NULL;
}
-
- ret = ail_appinfo_get_str(handle, AIL_PROP_EXEC_STR, &str);
+ //is_admin is global
+ if (getuid() != GLOBAL_USER)
+ ret = ail_appinfo_get_usr_str(handle, AIL_PROP_EXEC_STR, getuid(), &str);
+ else
+ ret = ail_appinfo_get_str(handle, AIL_PROP_EXEC_STR, &str);
if (str) {
menu_info->app_path = strdup(str);
str = NULL;
@@ -141,8 +151,12 @@ static inline app_info_from_db *_get_app_info_from_db_by_pkgname(
if (menu_info->app_path != NULL)
menu_info->original_app_path = strdup(menu_info->app_path);
-
- ret = ail_appinfo_get_str(handle, AIL_PROP_X_SLP_PACKAGETYPE_STR, &str);
+ //is_admin is gobal
+ if (getuid() != GLOBAL_USER)
+ ret = ail_appinfo_get_usr_str(handle, AIL_PROP_X_SLP_PACKAGETYPE_STR, getuid(), &str);
+ else
+ ret = ail_appinfo_get_str(handle, AIL_PROP_X_SLP_PACKAGETYPE_STR, &str);
+
if (str) {
menu_info->pkg_type = strdup(str);
str = NULL;
@@ -169,8 +183,11 @@ static inline ail_cb_ret_e __appinfo_func(const ail_appinfo_h appinfo, void *use
if (!menu_info)
return ret;
-
- ail_appinfo_get_str(appinfo, AIL_PROP_PACKAGE_STR, &package);
+ //is_admin is global
+ if (getuid() != GLOBAL_USER)
+ ail_appinfo_get_usr_str(appinfo, AIL_PROP_PACKAGE_STR, getuid(), &package);
+ else
+ ail_appinfo_get_str(appinfo, AIL_PROP_PACKAGE_STR, &package);
if (package) {
menu_info->pkg_name = strdup(package);
ret = AIL_CB_RET_CANCEL;
@@ -207,7 +224,10 @@ static inline app_info_from_db *_get_app_info_from_db_by_apppath(
return NULL;
}
- ret = ail_filter_count_appinfo(filter, &count);
+ if (getuid() != GLOBAL_USER)
+ ret = ail_filter_count_usr_appinfo(filter, &count, getuid());
+ else
+ ret = ail_filter_count_appinfo(filter, &count);
if (ret != AIL_ERROR_OK) {
ail_filter_destroy(filter);
_free_app_info_from_db(menu_info);
@@ -218,8 +238,11 @@ static inline app_info_from_db *_get_app_info_from_db_by_apppath(
_free_app_info_from_db(menu_info);
return NULL;
}
-
- ail_filter_list_appinfo_foreach(filter, __appinfo_func, (void *)menu_info);
+//is_admin is global
+ if (getuid() != GLOBAL_USER)
+ ail_filter_list_usr_appinfo_foreach(filter, __appinfo_func, (void *)menu_info, getuid());
+ else
+ ail_filter_list_appinfo_foreach(filter, __appinfo_func, (void *)menu_info);
ail_filter_destroy(filter);
diff --git a/include/simple_util.h b/include/simple_util.h
index 600ab94a..efd01ad4 100755
--- a/include/simple_util.h
+++ b/include/simple_util.h
@@ -27,6 +27,9 @@
#include <ctype.h>
#include <dlog.h>
+#define GLOBAL_USER 0 //#define tzplatform_getenv(TZ_GLOBAL) //TODO
+
+
#undef LOG_TAG
#define LOG_TAG "AUL"
diff --git a/src/mime.c b/src/mime.c
index 0715a744..9beb917b 100755
--- a/src/mime.c
+++ b/src/mime.c
@@ -224,9 +224,11 @@ static ail_cb_ret_e __defapp_with_mime_func(
{
char **package = (char **)user_data;
char *str;
-
- ail_appinfo_get_str(appinfo, AIL_PROP_PACKAGE_STR, &str);
-
+//is_admin is_global
+ if (getuid() != GLOBAL_USER)
+ ail_appinfo_get_usr_str(appinfo, AIL_PROP_PACKAGE_STR, getuid(), &str);
+ else
+ ail_appinfo_get_str(appinfo, AIL_PROP_PACKAGE_STR, &str);
_D("defapp from desktop = %s", str);
*package = strdup(str);
@@ -250,14 +252,22 @@ static int get_defapp_from_desktop(const char *mimetype, char *defapp, int len)
ret = -1;
goto out;
}
-
- ail_filter_count_appinfo(filter, &pkg_count);
+
+ if (getuid() != GLOBAL_USER)
+ ail_filter_count_usr_appinfo(filter, &pkg_count, getuid());
+ else
+ ail_filter_count_appinfo(filter, &pkg_count);
if (pkg_count == 1) {
- ail_filter_list_appinfo_foreach(filter,
- __defapp_with_mime_func, (void *)&tmp);
- if(tmp) {
+ if (getuid() != GLOBAL_USER)
+ ail_filter_list_usr_appinfo_foreach(filter,
+ __defapp_with_mime_func, (void *)&tmp, getuid());
+ else
+ ail_filter_list_appinfo_foreach(filter,
+ __defapp_with_mime_func, (void *)&tmp);
+
+ if(tmp) {
strncpy(defapp,tmp,len);
_D("defapp from desktop = %s", defapp);
aul_set_defapp_with_mime(mimetype, defapp);
@@ -361,7 +371,11 @@ static int __launch_with_defapp(const char *mime_type, const char *mime_content)
if (ret > 0)
ret = 0;
} else {
- ail_ret = ail_get_appinfo(defapp, &handle);
+
+ if (getuid() != GLOBAL_USER)
+ ail_ret = ail_get_usr_appinfo(defapp, getuid(), &handle);
+ else
+ ail_ret = ail_get_appinfo(defapp, &handle);
if (ail_ret == AIL_ERROR_OK) {
ail_destroy_appinfo(handle);
diff --git a/src/service.c b/src/service.c
index 6634d234..53ad8026 100755
--- a/src/service.c
+++ b/src/service.c
@@ -63,7 +63,10 @@ static ail_cb_ret_e __defapp_with_service_func(
char **package = (char **)user_data;
char *str;
- ail_appinfo_get_str(appinfo, AIL_PROP_PACKAGE_STR, &str);
+ if (getuid() != GLOBAL_USER)
+ ail_appinfo_get_usr_str(appinfo, AIL_PROP_PACKAGE_STR, getuid(), &str);
+ else
+ ail_appinfo_get_str(appinfo, AIL_PROP_PACKAGE_STR, &str);
_D("defapp from desktop = %s", str);
@@ -92,14 +95,19 @@ static int __get_defapp_from_desktop(const char *svcname, char *defapp, int len)
_E("ail_filter_add_str failed");
goto out;
}
-
- ail_filter_count_appinfo(filter, &pkg_count);
-
-
+ if (getuid() != GLOBAL_USER)
+ ail_filter_count_usr_appinfo(filter, &pkg_count, getuid());
+ else
+ ail_filter_count_appinfo(filter, &pkg_count);
/* TODO: Prioritizing inhouse app depending on the UX policy */
if (pkg_count == 1) {
- ail_filter_list_appinfo_foreach(filter,
- __defapp_with_service_func, (void *)&pkgname);
+
+ if (getuid() != GLOBAL_USER)
+ ail_filter_list_usr_appinfo_foreach(filter,
+ __defapp_with_service_func, (void *)&pkgname, getuid());
+ else
+ ail_filter_list_appinfo_foreach(filter,
+ __defapp_with_service_func, (void *)&pkgname);
if(pkgname) {
strncpy(defapp,pkgname,len);
@@ -172,6 +180,10 @@ SLPAPI int aul_open_service(const char *svcname, bundle *kb,
}
return ret;
} else {
+
+ if (getuid() != GLOBAL_USER)
+ ail_ret = ail_get_usr_appinfo(defapp, getuid(), &handle);
+ else
ail_ret = ail_get_appinfo(defapp, &handle);
if (ail_ret == AIL_ERROR_OK) {