apply to unregiter account_type(provider information) of User App on multi-user. 85/47885/2 tizen_3.0.m1_mobile tizen_3.0.m1_tv accepted/tizen/mobile/20150910.110416 accepted/tizen/tv/20150910.110727 submit/tizen_common/20151023.083358 submit/tizen_common/20151026.085049 submit/tizen_mobile/20150910.105308 submit/tizen_tv/20150910.105317 tizen_3.0.m1_mobile_release tizen_3.0.m1_tv_release
authorjiseob.jang <jiseob.jang@samsung.com>
Wed, 9 Sep 2015 14:01:13 +0000 (23:01 +0900)
committerjiseob.jang <jiseob.jang@samsung.com>
Thu, 10 Sep 2015 09:16:24 +0000 (18:16 +0900)
Change-Id: I337f5a9f7fdace3c5fd3e0d418d985198811a443
Signed-off-by: jiseob.jang <jiseob.jang@samsung.com>
CMakeLists.txt
packaging/account-parser.spec
src/account.c

index 0e5fc00..315424c 100644 (file)
@@ -10,6 +10,7 @@ pkg_check_modules(account_pkgs REQUIRED
        glib-2.0
        accounts-svc
        capi-appfw-app-manager
+       libtzplatform-config
 )
 
 FOREACH(flag ${account_pkgs_CFLAGS})
index 4567b7e..5370ca7 100644 (file)
@@ -1,6 +1,6 @@
 Name:          account-parser
 Summary:       Account Parser Library
-Version:       0.0.11
+Version:       0.0.12
 Release:       0
 Group:         Social & Content/Other
 License:       Apache-2.0
@@ -15,6 +15,7 @@ BuildRequires:  pkgconfig(glib-2.0)
 BuildRequires:  pkgconfig(pkgmgr)
 BuildRequires:  pkgconfig(pkgmgr-info)
 BuildRequires:  pkgconfig(capi-appfw-app-manager)
+BuildRequires:  pkgconfig(libtzplatform-config)
 
 %description
 account parser C library of package manager to install account application.
index f9ce435..68d6817 100644 (file)
@@ -24,6 +24,7 @@
 #include <account_internal.h>
 #include <pkgmgr-info.h>
 #include <app_manager.h>
+#include <tzplatform_config.h>
 
 #include "account-dlog.h"
 
@@ -32,6 +33,8 @@
 #define EXPORT_API __attribute__((visibility("default")))
 #endif
 
+#define OWNER_ROOT 0
+#define GLOBAL_USER tzplatform_getuid(TZ_SYS_GLOBALAPP_USER)
 
 static const xmlChar _NODE_ACCOUNT_PROVIDER[]                          = "account-provider";
 static const xmlChar _NODE_ICON[]                                                      = "icon";
@@ -549,11 +552,23 @@ int PKGMGR_PARSER_PLUGIN_UNINSTALL(xmlDocPtr docPtr, const char* packageId)
        _D("PKGMGR_PARSER_PLUGIN_UNINSTALL");
 
        pkgmgrinfo_pkginfo_h package_info_handle = NULL;
+       int ret = -1;
+       uid_t uid = 0;
 
-       int ret = pkgmgrinfo_pkginfo_get_pkginfo(packageId, &package_info_handle);
+       uid = getuid();
+       if (uid == OWNER_ROOT || uid == GLOBAL_USER) {
+               ret = pkgmgrinfo_pkginfo_get_pkginfo(packageId, &package_info_handle);
+       } else {
+               ret = pkgmgrinfo_pkginfo_get_usr_pkginfo(packageId, uid, &package_info_handle);
+       }
        retvm_if(ret != PMINFO_R_OK, ret, "[%d]Failed to pkgmgrinfo_pkginfo_get_pkginfo().", ret);
 
-       ret = pkgmgrinfo_appinfo_get_list(package_info_handle, PMINFO_UI_APP, _unregister_account_provider, NULL);
+       if (uid == OWNER_ROOT || uid == GLOBAL_USER) {
+        ret = pkgmgrinfo_appinfo_get_list(package_info_handle, PMINFO_ALL_APP, _unregister_account_provider, NULL);
+       } else {
+               ret = pkgmgrinfo_appinfo_get_usr_list(package_info_handle, PMINFO_ALL_APP, _unregister_account_provider, NULL, uid);
+       }
+
        if(ret != PMINFO_R_OK) {
                _D("Failed to get the application information list.");
                pkgmgrinfo_pkginfo_destroy_pkginfo(package_info_handle);
@@ -574,11 +589,23 @@ int PKGMGR_PARSER_PLUGIN_PRE_UPGRADE(const char* packageId)
        memset(__old_account_provider_app_id, 0x00, sizeof(__old_account_provider_app_id));
 
        pkgmgrinfo_pkginfo_h package_info_handle = NULL;
+       int ret = -1;
+       uid_t uid = 0;
 
-       int ret = pkgmgrinfo_pkginfo_get_pkginfo(packageId, &package_info_handle);
+       uid = getuid();
+       if (uid == OWNER_ROOT || uid == GLOBAL_USER) {
+               ret = pkgmgrinfo_pkginfo_get_pkginfo(packageId, &package_info_handle);
+       } else {
+               ret = pkgmgrinfo_pkginfo_get_usr_pkginfo(packageId, uid, &package_info_handle);
+       }
        retvm_if(ret != PMINFO_R_OK, ret, "[%d]Failed to pkgmgrinfo_pkginfo_get_pkginfo().", ret);
 
-       ret = pkgmgrinfo_appinfo_get_list(package_info_handle, PMINFO_UI_APP, _on_package_app_list_received_cb, NULL);
+       if (uid == OWNER_ROOT || uid == GLOBAL_USER) {
+        ret = pkgmgrinfo_appinfo_get_list(package_info_handle, PMINFO_ALL_APP, _on_package_app_list_received_cb, NULL);
+       } else {
+               ret = pkgmgrinfo_appinfo_get_usr_list(package_info_handle, PMINFO_ALL_APP, _on_package_app_list_received_cb, NULL, uid);
+       }
+
        if(ret != PMINFO_R_OK) {
                _D("Failed to get the application information list.");
                pkgmgrinfo_pkginfo_destroy_pkginfo(package_info_handle);