Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d2adae5b authored by Lyn Han's avatar Lyn Han
Browse files

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
parent 7315b727
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -288,11 +288,11 @@ public class NotificationStackScrollLayoutController {


        @Override
        @Override
        public void onThemeChanged() {
        public void onThemeChanged() {
            updateShowEmptyShadeView();
            mView.updateCornerRadius();
            mView.updateCornerRadius();
            mView.updateBgColor();
            mView.updateBgColor();
            mView.updateDecorViews();
            mView.updateDecorViews();
            mView.reinflateViews();
            mView.reinflateViews();
            updateShowEmptyShadeView();
            updateFooter();
            updateFooter();
        }
        }


+5 −0
Original line number Original line Diff line number Diff line
@@ -376,6 +376,11 @@ public class StackScrollAlgorithm {


        final float stackHeight = ambientState.getStackHeight()  - shelfHeight - scrimPadding;
        final float stackHeight = ambientState.getStackHeight()  - shelfHeight - scrimPadding;
        final float stackEndHeight = ambientState.getStackEndHeight() - 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;
        return stackHeight / stackEndHeight;
    }
    }