OSDN Git Service

Fixed a bug where notifications could stay dark
authorSelim Cinek <cinek@google.com>
Fri, 26 Feb 2016 17:25:33 +0000 (09:25 -0800)
committerSelim Cinek <cinek@google.com>
Fri, 26 Feb 2016 21:57:40 +0000 (21:57 +0000)
The check whether dark changed was always done
on the notification itself, ignoring that the
contentviews actually also have a check whether it
changed, leading to potential problems that this state
became out of date. In addition did we assume that whenever
an update comes in the text becomes normal, which is
not true for an inline update. This hopefully fixes things once
and for all! I said once and for all!

Bug: 27147160
Change-Id: Idd68be8da0f648cf79102544b038065618c1d0ff

packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java
packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationCustomViewWrapper.java
packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationHeaderViewWrapper.java
packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationTemplateViewWrapper.java
packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationViewWrapper.java

index 977b37e..7c11161 100644 (file)
@@ -584,11 +584,7 @@ public class NotificationContentView extends FrameLayout {
     }
 
     public void setDark(boolean dark, boolean fade, long delay) {
-        setDark(dark, fade, delay, false /* force */);
-    }
-
-    public void setDark(boolean dark, boolean fade, long delay, boolean force) {
-        if ((!force && mDark == dark) || mContractedChild == null) {
+        if (mContractedChild == null) {
             return;
         }
         mDark = dark;
@@ -645,7 +641,7 @@ public class NotificationContentView extends FrameLayout {
         if (mHeadsUpChild != null) {
             mHeadsUpWrapper.notifyContentUpdated(entry.notification);
         }
-        setDark(mDark, false /* animate */, 0 /* delay */, true /* force */);
+        setDark(mDark, false /* animate */, 0 /* delay */);
     }
 
     private void updateSingleLineView() {
index aa001ed..7f8f20f 100644 (file)
@@ -35,7 +35,7 @@ public class NotificationCustomViewWrapper extends NotificationViewWrapper {
 
     @Override
     public void setDark(boolean dark, boolean fade, long delay) {
-        if (dark == mDark) {
+        if (dark == mDark && mDarkInitialized) {
             return;
         }
         super.setDark(dark, fade, delay);
index 000f957..842bd22 100644 (file)
@@ -148,7 +148,7 @@ public class NotificationHeaderViewWrapper extends NotificationViewWrapper {
 
     @Override
     public void setDark(boolean dark, boolean fade, long delay) {
-        if (dark == mDark) {
+        if (dark == mDark && mDarkInitialized) {
             return;
         }
         super.setDark(dark, fade, delay);
index fd4eca8..78e23fc 100644 (file)
@@ -163,7 +163,7 @@ public class NotificationTemplateViewWrapper extends NotificationHeaderViewWrapp
 
     @Override
     public void setDark(boolean dark, boolean fade, long delay) {
-        if (dark == mDark) {
+        if (dark == mDark && mDarkInitialized) {
             return;
         }
         super.setDark(dark, fade, delay);
index d3503e7..c5e44a2 100644 (file)
@@ -32,6 +32,7 @@ public abstract class NotificationViewWrapper implements TransformableView {
 
     protected final View mView;
     protected boolean mDark;
+    protected boolean mDarkInitialized = false;
 
     public static NotificationViewWrapper wrap(Context ctx, View v) {
         if (v.getId() == com.android.internal.R.id.status_bar_latest_event_content) {
@@ -61,6 +62,7 @@ public abstract class NotificationViewWrapper implements TransformableView {
      */
     public void setDark(boolean dark, boolean fade, long delay) {
         mDark = dark;
+        mDarkInitialized = true;
     }
 
     /**
@@ -68,7 +70,7 @@ public abstract class NotificationViewWrapper implements TransformableView {
      * @param notification
      */
     public void notifyContentUpdated(StatusBarNotification notification) {
-        mDark = false;
+        mDarkInitialized = false;
     };
 
     /**