From b88b98477ae725092c27dfe52f7fca3d4f29913e Mon Sep 17 00:00:00 2001 From: Selim Cinek Date: Fri, 26 Feb 2016 09:25:33 -0800 Subject: [PATCH] Fixed a bug where notifications could stay dark 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 --- .../systemui/statusbar/NotificationContentView.java | 8 ++------ .../notification/NotificationCustomViewWrapper.java | 2 +- .../notification/NotificationHeaderViewWrapper.java | 2 +- .../notification/NotificationTemplateViewWrapper.java | 2 +- .../statusbar/notification/NotificationViewWrapper.java | 4 +++- 5 files changed, 8 insertions(+), 10 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java index 977b37ea13ea6..7c1116170ec3d 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java @@ -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() { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationCustomViewWrapper.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationCustomViewWrapper.java index aa001ed2057c9..7f8f20f7a8f0c 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationCustomViewWrapper.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationCustomViewWrapper.java @@ -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); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationHeaderViewWrapper.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationHeaderViewWrapper.java index 000f957f49bbf..842bd22cf4ccc 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationHeaderViewWrapper.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationHeaderViewWrapper.java @@ -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); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationTemplateViewWrapper.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationTemplateViewWrapper.java index fd4eca8cad91f..78e23fce1a3ea 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationTemplateViewWrapper.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationTemplateViewWrapper.java @@ -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); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationViewWrapper.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationViewWrapper.java index d3503e7516dff..c5e44a2b95c49 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationViewWrapper.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationViewWrapper.java @@ -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; }; /**