prevent multiple lowbat or critical popup 03/107003/4 submit/tizen_3.0/20161226.065129
authorlokilee73 <changjoo.lee@samsung.com>
Mon, 26 Dec 2016 06:26:44 +0000 (15:26 +0900)
committerlokilee73 <changjoo.lee@samsung.com>
Mon, 26 Dec 2016 06:44:57 +0000 (15:44 +0900)
Change-Id: I1ecd41d2f68e640d4ac283bdafac114d81acacf6
Signed-off-by: lokilee73 <changjoo.lee@samsung.com>
src/battery/lowbat-handler.c

index 4d5b11e..782daea 100755 (executable)
@@ -353,7 +353,12 @@ direct_launch:
                if (lowbat_popup_option == LOWBAT_OPT_CHECK ||
                        lowbat_popup_option == LOWBAT_OPT_WARNING) {
                        if (active_noti) {
-                               _I("call add_notification(%s) for active noti", active_noti);
+                               if (active_noti_on > 0) {
+                                       ret = remove_notification("BatteryLowCriticalNotiOff", active_noti_on);
+                                       if (ret < 0)
+                                               _E("Failed to launch remove_active_noti : %d", ret);
+                               }
+
                                ret = add_notification(active_noti);
                                if (ret < 0)
                                        _E("Failed to launch active_noti : %d", ret);
@@ -362,7 +367,12 @@ direct_launch:
                        }
 
                        if (event_noti) {
-                               _I("call add_notification(%s) for event noti", event_noti);
+                               if (event_noti_on > 0) {
+                                       ret = remove_notification("BatteryLowCriticalNotiOff", event_noti_on);
+                                       if (ret < 0)
+                                               _E("Failed to launch remove_event_noti : %d", ret);
+                               }
+
                                ret = add_notification(event_noti);
                                if (ret < 0)
                                        _E("Failed to launch event noti : %d", ret);
@@ -464,7 +474,7 @@ void clear_noti_if_needed(const char *old_string, const char *new_string)
        if (old_string == new_string)
                return;
 
-       if (event_noti_on > 0 ) {
+       if (event_noti_on > 0) {
                ret = remove_notification("BatteryLowCriticalNotiOff", event_noti_on);
                if (ret < 0)
                        _E("Failed to launch remove_event_noti : %d", ret);