From 99bbb21e59cf811475a240c1b8260fb2eacadeee Mon Sep 17 00:00:00 2001 From: Jeff DeCew Date: Thu, 7 Jul 2022 18:23:36 +0000 Subject: [PATCH] Workaround a notification inflation race condition. This bug was resulting in notifications which are inflated at the same time the uiMode changes to have the old background color and the new foreground color, making them very hard to read. Merged-In: Ic13890a4a97628920f5e70d0f0cc24cc00b4829c Change-Id: Ic13890a4a97628920f5e70d0f0cc24cc00b4829c Fixes: 227880269 Fixes: 238037994 Fixes: 238892225 Test: manual --- .../statusbar/notification/row/ExpandableNotificationRow.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java index eb496abad460f..26614ff4ae58d 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java @@ -141,7 +141,9 @@ public class ExpandableNotificationRow extends ActivatableNotificationView public static final float DEFAULT_HEADER_VISIBLE_AMOUNT = 1.0f; private static final long RECENTLY_ALERTED_THRESHOLD_MS = TimeUnit.SECONDS.toMillis(30); - private boolean mUpdateBackgroundOnUpdate; + // We don't correctly track dark mode until the content views are inflated, so always update + // the background on first content update just in case it happens to be during a theme change. + private boolean mUpdateBackgroundOnUpdate = true; private boolean mNotificationTranslationFinished = false; private boolean mIsSnoozed; private boolean mIsFaded;