[Alarm] Fixed the behaviour change introduced during SVACE issues fixing 43/211443/2
authorPiotr Kosko/Native/Web API (PLT) /SRPOL/Professional/삼성전자 <p.kosko@samsung.com>
Mon, 5 Aug 2019 05:53:03 +0000 (07:53 +0200)
committerPiotr Kosko/Native/Web API (PLT) /SRPOL/Professional/삼성전자 <p.kosko@samsung.com>
Mon, 5 Aug 2019 05:57:38 +0000 (07:57 +0200)
[Bug] Issue was introduced in commit 1b4d5c8e8e760140c3e5c93e59ff23bde99f9862
https://review.tizen.org/gerrit/#/c/platform/core/api/webapi-plugins/+/207226/

Alarm TCT - 12 fails

[Verification] Alarm TCT after fix - 100% (tizen-unified_20190804.1_mobile-wayland-armv7l-tm1)

Change-Id: I343bf2d20d2f88f6d3ac37eb2631a0db395daecb

src/alarm/alarm_manager.cc

index db2e035..d90bdcd 100644 (file)
@@ -551,13 +551,11 @@ PlatformResult AlarmManager::GetAlarm(int id, picojson::object& obj) {
     notification_free(notification_handle);
   };
 
-  ret = alarm_get_app_control(id, &app_control);
-  if (ALARM_ERROR_NONE != ret) {
-    return LogAndCreateResult(ErrorCode::UNKNOWN_ERR, "Unknown error occurred.",
-                              ("Getting data failed: %d (%s)", ret, get_error_message(ret)));
-  } else {
-    ret = alarm_get_notification(id, &notification_handle);
-    if (ALARM_ERROR_NONE != ret) {
+  if (ALARM_ERROR_NONE != alarm_get_app_control(id, &app_control)) {
+    // This is a special kind of alarm, which has the notification instead of an app_control handle.
+    // In case of error during app_control gathering, we check if it has notification. If both calls
+    // end with error, then we report NOT_FOUND_ERROR
+    if (ALARM_ERROR_NONE != alarm_get_notification(id, &notification_handle)) {
       return LogAndCreateResult(ErrorCode::NOT_FOUND_ERR, "Alarm not found.",
                                 ("Alarm not found: %d (%s)", ret, get_error_message(ret)));
     } else {