From a8535e9ae6d86ffbc5ec717f849321345de585e3 Mon Sep 17 00:00:00 2001 From: Lyn Han Date: Tue, 8 Feb 2022 12:36:02 -0600 Subject: Fix bug where shade is infinitely squishy after wallpaper change This change fixes a bug where opening an empty shade after wallpaper update => messes up qs button unfurling => hides the "no notifications" text This bug happened because => wallpaper change causes theme change => on theme change, NSSLC reinflates EmptyShadeView with visibility=false => nothing resets EmptyShadeView visiblity=true on shade open => AmbientState has 0 visibleChildren during shade open, so stackHeight is 0 and expansionFraction is infinity The solution is to have NSSLC update EmptyShadeView visibility after re-inflation. Fixes: 215038354 Fixes: 218501868 Fixes: 218380326 Test: have no notifications, change wallpaper, open shade => qs button squishiness animates fine => "no notifications" text shows up fine => log squishiness: no infinity or NaN Change-Id: Iaa10605079db7edc79771a1cd9f4cc17f847c4cb (cherry picked from commit d2adae5b5d8a1b6a77386cc7eaf98dafe4b43ce4) (cherry picked from commit cf293657bf6520ea04f0c5eab493ad06f1f472f5) Merged-In:Iaa10605079db7edc79771a1cd9f4cc17f847c4cb --- .../notification/stack/NotificationStackScrollLayoutController.java | 2 +- .../systemui/statusbar/notification/stack/StackScrollAlgorithm.java | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) 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 f14cc93c2046..9f440606a365 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 @@ -279,11 +279,11 @@ public class NotificationStackScrollLayoutController { @Override public void onThemeChanged() { - updateShowEmptyShadeView(); mView.updateCornerRadius(); mView.updateBgColor(); mView.updateDecorViews(); mView.reinflateViews(); + updateShowEmptyShadeView(); updateFooter(); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithm.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithm.java index 2c70a5fd9ce7..c4567df914f0 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithm.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithm.java @@ -376,6 +376,11 @@ public class StackScrollAlgorithm { final float stackHeight = ambientState.getStackHeight() - shelfHeight - scrimPadding; final float stackEndHeight = ambientState.getStackEndHeight() - shelfHeight - scrimPadding; + if (stackEndHeight == 0f) { + // This should not happen, since even when the shade is empty we show EmptyShadeView + // but check just in case, so we don't return infinity or NaN. + return 0f; + } return stackHeight / stackEndHeight; } -- cgit v1.2.3-59-g8ed1b