Fix some returns in alarm set/get api 75/69575/1 accepted/tizen/common/20160517.173921 accepted/tizen/ivi/20160517.032508 accepted/tizen/mobile/20160517.032550 accepted/tizen/tv/20160517.032525 accepted/tizen/wearable/20160517.032536 submit/tizen/20160516.093613
authorJiwoong Im <jiwoong.im@samsung.com>
Mon, 16 May 2016 02:49:00 +0000 (11:49 +0900)
committerJiwoong Im <jiwoong.im@samsung.com>
Mon, 16 May 2016 02:51:23 +0000 (11:51 +0900)
Change-Id: I40101a3bdd1071765290172d916cd55abb7152d5
Signed-off-by: Jiwoong Im <jiwoong.im@samsung.com>
alarm-manager.c
src/alarm-lib.c

index 46a5246..96697e6 100644 (file)
@@ -2933,10 +2933,10 @@ gboolean alarm_manager_alarm_set_global(AlarmManager *pObject, GDBusMethodInvoca
                ALARM_MGR_LOG_PRINT("The alarm pkgid : %s.", callee_pkgid);
 
                pkgmgrinfo_pkginfo_h handle;
-               retval = pkgmgrinfo_pkginfo_get_pkginfo(callee_pkgid, &handle);
+               retval = pkgmgrinfo_pkginfo_get_usr_pkginfo(callee_pkgid, uid, &handle);
                if (retval != PMINFO_R_OK) {
-                       ALARM_MGR_EXCEPTION_PRINT("The alarm(%d) is not permitted to set global.", alarm_id);
-                       return_code = ERR_ALARM_INVALID_ID; /* TODO change error code */
+                       ALARM_MGR_EXCEPTION_PRINT("Failed to get pkginfo\n");
+                       return_code = ERR_ALARM_INVALID_ID;
                } else {
                        bool is_global = 0;
                        retval = pkgmgrinfo_pkginfo_is_global(handle, &is_global);
index 3f3a0a3..9aaa838 100644 (file)
@@ -1631,6 +1631,9 @@ EXPORT_API int alarmmgr_set_global(const alarm_id_t alarm_id,
        int error_code;
        ALARM_MGR_LOG_PRINT("[alarm-lib]:alarmmgr_set_global() is called.");
 
+       if (__sub_init() < 0)
+               return ERR_ALARM_SYSTEM_FAIL;
+
        if (!_send_alarm_set_global(alarm_context, alarm_id, global, &error_code))
                return error_code;
 
@@ -1644,6 +1647,9 @@ EXPORT_API int alarmmgr_get_global(const alarm_id_t alarm_id,
        bool _global;
        int error_code;
 
+       if (__sub_init() < 0)
+               return ERR_ALARM_SYSTEM_FAIL;
+
        if (global == NULL)
                return ERR_ALARM_INVALID_PARAM;