summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xam_daemon/amd_appinfo.c23
-rwxr-xr-xam_daemon/amd_launch.c7
-rwxr-xr-xam_daemon/amd_main.c5
-rwxr-xr-xinclude/menu_db_util.h49
-rwxr-xr-xsrc/mime.c30
-rwxr-xr-xsrc/service.c34
6 files changed, 104 insertions, 44 deletions
diff --git a/am_daemon/amd_appinfo.c b/am_daemon/amd_appinfo.c
index 7b25565e..27facf28 100755
--- a/am_daemon/amd_appinfo.c
+++ b/am_daemon/amd_appinfo.c
@@ -14,6 +14,7 @@
#define SERVICE_GROUP "Service"
+#define GLOBAL_USER 0 //#define tzplatform_getenv(TZ_GLOBAL) //TODO
struct appinfomgr {
GHashTable *tbl; /* key is filename, value is struct appinfo */
@@ -105,7 +106,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 +217,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 +270,9 @@ 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
+ //ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
+ ret = pkgmgrinfo_appinfo_get_usr_appinfo(appid, uid, &handle);
if(ret < 0) {
_E("pkgmgrinfo_appinfo_get_appinfo fail");
}
@@ -284,7 +287,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 +371,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,9 +439,9 @@ 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);
+ ret = pkgmgrinfo_appinfo_get_usr_appinfo(appid , caller_uid , &handle);
}
res = calloc(1, sizeof(*res));
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..bdc51642 100755
--- a/include/menu_db_util.h
+++ b/include/menu_db_util.h
@@ -120,20 +120,29 @@ 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())
+ ret = ail_get_appinfo(pkgname, &handle);
+ else
+ ret = ail_get_usr_appinfo(pkgname, getuid(), &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())
+ 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())
+ 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 +150,11 @@ 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())
+ ret = ail_appinfo_get_str(handle, AIL_PROP_X_SLP_PACKAGETYPE_STR, &str);
+ else
+ ret = ail_appinfo_get_usr_str(handle, AIL_PROP_X_SLP_PACKAGETYPE_STR, getuid(), &str);
if (str) {
menu_info->pkg_type = strdup(str);
str = NULL;
@@ -169,8 +181,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())
+ 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;
@@ -206,8 +221,11 @@ static inline app_info_from_db *_get_app_info_from_db_by_apppath(
_free_app_info_from_db(menu_info);
return NULL;
}
-
- ret = ail_filter_count_appinfo(filter, &count);
+ //is_admin is global
+ if(getuid())
+ 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 +236,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())
+ ail_filter_list_appinfo_foreach(filter, __appinfo_func, (void *)menu_info);
+ else
+ ail_filter_list_usr_appinfo_foreach(filter, __appinfo_func, (void *)menu_info, getuid());
ail_filter_destroy(filter);
diff --git a/src/mime.c b/src/mime.c
index 0715a744..f65fbe7a 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())
+ ail_appinfo_get_str(appinfo, AIL_PROP_PACKAGE_STR, &str);
+ else
+ ail_appinfo_get_usr_str(appinfo, AIL_PROP_PACKAGE_STR, getuid(), &str);
_D("defapp from desktop = %s", str);
*package = strdup(str);
@@ -250,12 +252,20 @@ static int get_defapp_from_desktop(const char *mimetype, char *defapp, int len)
ret = -1;
goto out;
}
-
- ail_filter_count_appinfo(filter, &pkg_count);
+ //is_admin is global
+ if(getuid())
+ 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);
+ //is_admin is global
+ if(!getuid())
+ ail_filter_list_appinfo_foreach(filter,
+ __defapp_with_mime_func, (void *)&tmp);
+ else
+ ail_filter_list_usr_appinfo_foreach(filter,
+ __defapp_with_mime_func, (void *)&tmp, getuid());
if(tmp) {
strncpy(defapp,tmp,len);
@@ -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);
+ //is_admin is global
+ if(!getuid())
+ ail_ret = ail_get_appinfo(defapp, &handle);
+ else
+ ail_ret = ail_get_usr_appinfo(defapp, getuid(), &handle);
if (ail_ret == AIL_ERROR_OK) {
ail_destroy_appinfo(handle);
diff --git a/src/service.c b/src/service.c
index 6634d234..6672b5fc 100755
--- a/src/service.c
+++ b/src/service.c
@@ -62,8 +62,11 @@ 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);
+//isglobal is_admin
+ if(!getuid())
+ ail_appinfo_get_str(appinfo, AIL_PROP_PACKAGE_STR, &str);
+ else
+ ail_appinfo_get_usr_str(appinfo, AIL_PROP_PACKAGE_STR, getuid(), &str);
_D("defapp from desktop = %s", str);
@@ -92,14 +95,23 @@ 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(__isadmin())
+ //{
+ if(!getuid())
+ ail_filter_count_appinfo(filter, &pkg_count);
+// }
+ else
+ ail_filter_count_usr_appinfo(filter, &pkg_count, getuid());
/* 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);
+ //is_admin is global
+ if(!getuid())
+ ail_filter_list_appinfo_foreach(filter,
+ __defapp_with_service_func, (void *)&pkgname);
+
+ else
+ ail_filter_list_usr_appinfo_foreach(filter,
+ __defapp_with_service_func, (void *)&pkgname, getuid());
if(pkgname) {
strncpy(defapp,pkgname,len);
@@ -172,7 +184,11 @@ SLPAPI int aul_open_service(const char *svcname, bundle *kb,
}
return ret;
} else {
- ail_ret = ail_get_appinfo(defapp, &handle);
+ //is_admin is global
+ if(!getuid())
+ ail_ret = ail_get_appinfo(defapp, &handle);
+ else
+ ail_ret = ail_get_usr_appinfo(defapp, getuid(), &handle);
if (ail_ret == AIL_ERROR_OK) {
ail_destroy_appinfo(handle);