Fix not to show duplicated zone indicator icons 71/77071/3
authorSungbae Yoo <sungbae.yoo@samsung.com>
Tue, 28 Jun 2016 09:29:04 +0000 (18:29 +0900)
committerSungbae Yoo <sungbae.yoo@samsung.com>
Wed, 29 Jun 2016 06:04:07 +0000 (15:04 +0900)
Signed-off-by: Sungbae Yoo <sungbae.yoo@samsung.com>
Change-Id: Ibe2362f3672d95d7cc35114674ad8b7c3f4efa5d

server/zone/zone.cpp

index 8c443df..2f7bc11 100644 (file)
@@ -265,7 +265,7 @@ void initializeCreatedZoneList() {
 #define NT_ICON      NOTIFICATION_IMAGE_TYPE_ICON
 #define NT_INDICATOR NOTIFICATION_IMAGE_TYPE_ICON_FOR_INDICATOR
 #define NT_NONE      NOTIFICATION_VARIABLE_TYPE_NONE
-#define NT_EVENT     NOTIFICATION_LY_ONGOING_EVENT
+#define NT_EVENT     NOTIFICATION_LY_ONGOING_PROGRESS
 #define NT_APP       NOTIFICATION_DISPLAY_APP_INDICATOR
 
 #define NT_ICON_PATH DATA_PATH "/zone_indicator_icon.png"
@@ -280,6 +280,7 @@ void zoneProcessCallback(GDBusConnection *connection,
                             GVariant *params, gpointer userData)
 {
     static runtime::User owner(ZONE_DEFAULT_OWNER);
+    static std::atomic<bool> isNotiShown(false);
     int pid, status;
 
     notification_h noti = reinterpret_cast<notification_h>(userData);
@@ -297,11 +298,16 @@ void zoneProcessCallback(GDBusConnection *connection,
     }
 
     if ((st.st_uid >= ZONE_UID_MIN) && (st.st_uid < ZONE_UID_MAX)) {
-        notification_set_text(noti, NT_CONTENT, NT_APPINFO, NULL, NT_NONE);
-
-        notification_post_for_uid(noti, owner.getUid());
+        if (!isNotiShown) {
+            notification_set_text(noti, NT_CONTENT, NT_APPINFO, NULL, NT_NONE);
+            notification_post_for_uid(noti, owner.getUid());
+            isNotiShown = true;
+        }
     } else {
-        notification_delete_for_uid(noti, owner.getUid());
+        if (isNotiShown) {
+            notification_delete_for_uid(noti, owner.getUid());
+            isNotiShown = false;
+        }
     }
 }