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

Commit 38d0f0db authored by Matt Pietal's avatar Matt Pietal
Browse files

Update keyguard clipping

This resolves an issue with pulling down the QS shade directly over
lockscreen, and unsures that the view is only clipped if the
notficiations scrim is actually visible.

Test: manual - use foldable in both portrait and landscape, and pull
down both QS and QQS shades
Test: atest ScrimControllerTest
Fixes: 322159355
Flag: ACONFIG com.android.systemui.keyguard_shade_migration_nssl
DEVELOPMENT

Change-Id: I2ce6e78a3e3e12cc948454c9027e3a8df1b4f0fd
parent ee460a7a
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -763,10 +763,15 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump
            // see: b/186644628
            mNotificationsScrim.setDrawableBounds(left - 1, top, right + 1, bottom);
            mScrimBehind.setBottomEdgePosition((int) top);
        } else {
            mNotificationsScrim.setDrawableBounds(left, top, right, bottom);
        }

        // Only clip if the notif scrim is visible
        if (mNotificationsAlpha > 0f) {
            mKeyguardInteractor.setTopClippingBounds((int) top);
        } else {
            mKeyguardInteractor.setTopClippingBounds(null);
            mNotificationsScrim.setDrawableBounds(left, top, right, bottom);
        }
    }

+21 −0
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ import static org.mockito.ArgumentMatchers.anyFloat;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.anyLong;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
@@ -1682,6 +1683,26 @@ public class ScrimControllerTest extends SysuiTestCase {
        assertThat(mScrimInFront.getTranslationY()).isEqualTo(0);
    }

    @Test
    public void notificationBoundsTopGetsPassedToKeyguard() {
        mScrimController.transitionTo(SHADE_LOCKED);
        mScrimController.setQsPosition(1f, 0);
        finishAnimationsImmediately();

        mScrimController.setNotificationsBounds(0f, 100f, 0f, 0f);
        verify(mKeyguardInteractor).setTopClippingBounds(eq(100));
    }

    @Test
    public void notificationBoundsTopDoesNotGetPassedToKeyguardWhenNotifScrimIsNotVisible() {
        mScrimController.setKeyguardOccluded(true);
        mScrimController.transitionTo(ScrimState.KEYGUARD);
        finishAnimationsImmediately();

        mScrimController.setNotificationsBounds(0f, 100f, 0f, 0f);
        verify(mKeyguardInteractor).setTopClippingBounds(eq(null));
    }

    @Test
    public void transitionToDreaming() {
        mScrimController.setRawPanelExpansionFraction(0f);