Add extension APIs for exact alarms of service app 91/88891/2 accepted/tizen/common/20160923.161044 accepted/tizen/ivi/20160927.020312 accepted/tizen/mobile/20160927.020154 accepted/tizen/tv/20160927.020234 accepted/tizen/wearable/20160927.020221 submit/tizen/20160923.090258
authorJiwoong Im <jiwoong.im@samsung.com>
Wed, 21 Sep 2016 05:34:36 +0000 (14:34 +0900)
committerJiwoong Im <jiwoong.im@samsung.com>
Fri, 23 Sep 2016 04:11:36 +0000 (21:11 -0700)
Change-Id: I3e4580cd6da4bdef0d221313c86aaaf570ae5499
Signed-off-by: Jiwoong Im <jiwoong.im@samsung.com>
include/alarm.h
src/alarm-lib.c

index 1bbc389..e52563c 100644 (file)
@@ -230,6 +230,7 @@ typedef enum {
 #define ALARM_TYPE_VOLATILE    0x02    /*< volatile */
 #define ALARM_TYPE_NOLAUNCH 0x04       /*<without launch */
 #define ALARM_TYPE_INEXACT 0x08        /*<inexact alarm */
+#define ALARM_TYPE_EXACT_SERVICE_APP 0x10      /*<exact alarm for in-house service app*/
 
 
 /**
index 8b0def5..3c81e44 100644 (file)
@@ -289,6 +289,11 @@ static bool __is_permitted(const char *app_id, int alarm_type)
                char *app_type = NULL;
                ret = pkgmgrinfo_appinfo_get_component_type(handle, &app_type);
                if (app_type && strcmp("uiapp", app_type) == 0) {
+                       if (alarm_type & ALARM_TYPE_EXACT_SERVICE_APP) {
+                               ALARM_MGR_EXCEPTION_PRINT("[%s] is ui application. it is not allowed", app_id);
+                               _return = false;
+                               goto out;
+                       }
                        ALARM_MGR_LOG_PRINT("[%s] is ui application. It is allowed", app_id);
                        _return = true;
                        goto out;
@@ -300,14 +305,14 @@ static bool __is_permitted(const char *app_id, int alarm_type)
                                .has_bg = false
                        };
 
-                       if (alarm_type & ALARM_TYPE_INEXACT) {
+                       if (alarm_type & ALARM_TYPE_INEXACT || alarm_type & ALARM_TYPE_EXACT_SERVICE_APP) {
                                ret = pkgmgrinfo_appinfo_foreach_background_category(handle, __bg_category_func, &info);
                                if (ret == PMINFO_R_OK && info.has_bg) {
-                                       ALARM_MGR_LOG_PRINT("[%s] has background categories.", app_id);
+                                       ALARM_MGR_LOG_PRINT("[%s] has background categories. It is allowed", app_id);
                                        _return = true;
                                        goto out;
                                } else {
-                                       ALARM_MGR_EXCEPTION_PRINT("Failed to foreach background category. [%s] is not allowed\n", app_id);
+                                       ALARM_MGR_EXCEPTION_PRINT("Failed to foreach background category. [%s] is not allowed", app_id);
                                }
                        }
                }