From 570021475ebdeae8450c9d42d9de243622b20960 Mon Sep 17 00:00:00 2001 From: Lucas Dupin Date: Mon, 22 Feb 2021 11:40:46 -0800 Subject: [PATCH] Update view colors on onOverlayChanged() We were re-inflating some views, but not updating the colors everywhere we needed. The Shelf, for example, had wrong background colors during transitions because mNormalColor of notifications above it were kept untouched. Test: visual Fixes: 178804239 Change-Id: Ieae0ceed99fd9c00b570a40438ce8313e481e3a4 --- .../com/android/systemui/statusbar/NotificationShelf.java | 4 ---- .../notification/row/ActivatableNotificationView.java | 5 ++++- .../notification/stack/NotificationStackScrollLayout.java | 7 ++++++- .../stack/NotificationStackScrollLayoutController.java | 1 + 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java index 20efa32d63c6f..d2ddd212bda69 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java @@ -1002,10 +1002,6 @@ public class NotificationShelf extends ActivatableNotificationView implements return false; } - public void onUiModeChanged() { - updateBackgroundColors(); - } - public void setController(NotificationShelfController notificationShelfController) { mController = notificationShelfController; } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ActivatableNotificationView.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ActivatableNotificationView.java index 724921b3f7c8b..31d052d759980 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ActivatableNotificationView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ActivatableNotificationView.java @@ -191,7 +191,10 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView initDimens(); } - protected void updateBackgroundColors() { + /** + * Reload background colors from resources and invalidate views. + */ + public void updateBackgroundColors() { updateColors(); initBackground(); updateBackgroundTint(); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java index 2c7c5cc911205..732af9293672e 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java @@ -622,7 +622,12 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable mBgColor = Utils.getColorAttr(mContext, android.R.attr.colorBackgroundFloating) .getDefaultColor(); updateBackgroundDimming(); - mShelf.onUiModeChanged(); + for (int i = 0; i < getChildCount(); i++) { + View child = getChildAt(i); + if (child instanceof ActivatableNotificationView) { + ((ActivatableNotificationView) child).updateBackgroundColors(); + } + } } @ShadeViewRefactor(RefactorComponent.DECORATOR) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java index a51674280c1c5..399702869d704 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java @@ -223,6 +223,7 @@ public class NotificationStackScrollLayoutController { updateShowEmptyShadeView(); mView.updateCornerRadius(); mView.updateBgColor(); + mView.updateDecorViews(); mView.reinflateViews(); }