Added a type
authorJaeho Lee <jaeho81.lee@samsung.com>
Wed, 20 Mar 2013 06:56:49 +0000 (15:56 +0900)
committerJaeho Lee <jaeho81.lee@samsung.com>
Wed, 20 Mar 2013 07:18:31 +0000 (16:18 +0900)
Signed-off-by: Jaeho Lee <jaeho81.lee@samsung.com>
Change-Id: I7bd850a0df0f4e2189920f35b1d32123acd22079

alarm-lib.c
alarm-manager.c
include/alarm.h
packaging/alarm-manager.spec

index 5977851..d2deab5 100755 (executable)
@@ -595,6 +595,7 @@ EXPORT_API int alarmmgr_add_alarm_appsvc_with_localtime(alarm_entry_t *alarm, vo
        alarm_info_t *alarm_info = NULL;        /* = (alarm_info_t*)alarm; */
        const char *operation = NULL;
        int error_code = 0;
+       char *appid = NULL;
 
        bundle *b=(bundle *)bundle_data;
 
@@ -623,6 +624,14 @@ EXPORT_API int alarmmgr_add_alarm_appsvc_with_localtime(alarm_entry_t *alarm, vo
 
        alarm_info = (alarm_info_t *) alarm;
 
+       appid = appsvc_get_appid(b);
+
+       if (NULL == appid && (alarm_info->alarm_type & ALARM_TYPE_NOLAUNCH) )
+       {
+               ALARM_MGR_EXCEPTION_PRINT("Invalid parameter\n");
+               return ERR_ALARM_INVALID_PARAM;
+       }
+
        if (alarm_info == NULL || alarm_id == NULL) {
                ALARM_MGR_EXCEPTION_PRINT("Invalid parameter\n");
                return ERR_ALARM_INVALID_PARAM;
@@ -779,6 +788,7 @@ EXPORT_API int alarmmgr_add_alarm_appsvc(int alarm_type, time_t trigger_at_time,
        struct tm duetime_tm;
        alarm_info_t alarm_info;
        const char *operation = NULL;
+       char *appid = NULL;
 
        bundle *b=(bundle *)bundle_data;
 
@@ -795,6 +805,14 @@ EXPORT_API int alarmmgr_add_alarm_appsvc(int alarm_type, time_t trigger_at_time,
                return ERR_ALARM_INVALID_PARAM;
        }
 
+       appid = appsvc_get_appid(b);
+
+       if (NULL == appid && (alarm_type & ALARM_TYPE_NOLAUNCH) )
+       {
+               ALARM_MGR_EXCEPTION_PRINT("Invalid parameter\n");
+               return ERR_ALARM_INVALID_PARAM;
+       }
+
        if (__alarmmgr_init_appsvc() < 0)
        {
                ALARM_MGR_EXCEPTION_PRINT("Unable to initialize dbus!!!\n");
index 4f72033..f65e23c 100755 (executable)
@@ -1346,6 +1346,7 @@ static void __alarm_expired()
        char alarm_id_val[32]={0,};
        int b_len = 0;
        bundle *b = NULL;
+       char *appid = NULL;
 
        ALARM_MGR_LOG_PRINT("[alarm-server]: Enter \n");
 
@@ -1397,13 +1398,21 @@ static void __alarm_expired()
                                        }
                                        else
                                        {
-                                               if ( appsvc_run_service(b, 0, NULL, NULL) < 0)
+                                               appid = appsvc_get_appid(b);
+                                               if( (__alarm_info->alarm_info.alarm_type & ALARM_TYPE_NOLAUNCH) && !aul_app_is_running(appid))
                                                {
-                                                       ALARM_MGR_EXCEPTION_PRINT("Unable to run app svc\n");
+                                                       ALARM_MGR_EXCEPTION_PRINT("This alarm is ignored\n");
                                                }
                                                else
                                                {
-                                                       ALARM_MGR_LOG_PRINT("Successfuly ran app svc\n");
+                                                       if ( appsvc_run_service(b, 0, NULL, NULL) < 0)
+                                                       {
+                                                               ALARM_MGR_EXCEPTION_PRINT("Unable to run app svc\n");
+                                                       }
+                                                       else
+                                                       {
+                                                               ALARM_MGR_LOG_PRINT("Successfuly ran app svc\n");
+                                                       }
                                                }
                                        }
                                        bundle_free(b);
index 63c3940..d58e8b0 100644 (file)
@@ -217,6 +217,7 @@ typedef enum {
 
 #define ALARM_TYPE_DEFAULT     0x0     /*< non volatile */
 #define ALARM_TYPE_VOLATILE    0x02    /*< volatile */
+#define ALARM_TYPE_NOLAUNCH 0x04       /*<without launch */
 
 
 /**
index 245e672..d16de76 100644 (file)
@@ -1,7 +1,7 @@
 Name:       alarm-manager
 Summary:    Alarm library
-Version:    0.4.66
-Release:    2
+Version:    0.4.65
+Release:    1
 Group:      System/Libraries
 License:    Apache License, Version 2.0
 Source0:    %{name}-%{version}.tar.gz