Change from getuid() to TZ_SYS_DEFAULT_USER 37/69737/5 accepted/tizen/common/20160518.124851 accepted/tizen/ivi/20160518.004226 accepted/tizen/mobile/20160518.004352 accepted/tizen/tv/20160518.004243 accepted/tizen/wearable/20160518.004212 submit/tizen/20160517.005404 submit/tizen/20160517.084446
authorseungha.son <seungha.son@samsung.com>
Mon, 16 May 2016 12:34:51 +0000 (21:34 +0900)
committerseungha.son <seungha.son@samsung.com>
Tue, 17 May 2016 00:55:53 +0000 (09:55 +0900)
Add tzplatform_config.h file

Signed-off-by: seungha.son <seungha.son@samsung.com>
Change-Id: I74fc61700e84e87131f055a5b4e91895ed50f2c3

src/notification_setting.c

index 0b34177..a90274f 100755 (executable)
@@ -21,6 +21,7 @@
 #include <package_manager.h>
 #include <pkgmgr-info.h>
 #include <tizen_type.h>
+#include <tzplatform_config.h>
 
 #include <notification.h>
 #include <notification_db.h>
@@ -34,8 +35,6 @@
 
 #define NOTIFICATION_PRIVILEGE "http://tizen.org/privilege/notification"
 
-
-
 EXPORT_API int notification_setting_get_setting_array(notification_setting_h *setting_array, int *count)
 {
        int ret = NOTIFICATION_ERROR_NONE;
@@ -392,7 +391,6 @@ EXPORT_API int notification_setting_refresh_setting_table()
        int sqlite3_ret = SQLITE_OK;
        int pkgmgr_ret = PACKAGE_MANAGER_ERROR_NONE;
        pkgmgrinfo_pkginfo_filter_h filter;
-       uid_t current_uid;
 
        sqlite3_ret = db_util_open(DBPATH, &db, 0);
 
@@ -418,9 +416,11 @@ EXPORT_API int notification_setting_refresh_setting_table()
                goto out;
        }
 
-       current_uid = getuid();
-
-       pkgmgr_ret = pkgmgrinfo_pkginfo_usr_filter_foreach_pkginfo(filter, foreach_package_info_callback, db, current_uid);
+       /*
+        * DEFAULT_UID is owner's uid(5001)
+        * currently this api do not support multi-user.
+       */
+       pkgmgr_ret = pkgmgrinfo_pkginfo_usr_filter_foreach_pkginfo(filter, foreach_package_info_callback, db, tzplatform_getuid(TZ_SYS_DEFAULT_USER));
        if (pkgmgr_ret != PMINFO_R_OK) {
                NOTIFICATION_ERR("pkgmgrinfo_pkginfo_usr_filter_foreach_pkginfo failed [%d]", pkgmgr_ret);
                err = NOTIFICATION_ERROR_FROM_DB;