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

Commit cda2e0c8 authored by Shawn Lee's avatar Shawn Lee Committed by Android (Google) Code Review
Browse files

Merge "[flexiglass] Fix notification expansion regression" into main

parents f1b5a2d7 60a2bb0d
Loading
Loading
Loading
Loading
+11 −12
Original line number Diff line number Diff line
@@ -952,11 +952,10 @@ public class NotificationStackScrollLayoutControllerTest extends SysuiTestCase {
    @Test
    @EnableSceneContainer
    public void onTouchEvent_stopExpandingNotification_sceneContainerEnabled() {
        boolean touchHandled = stopExpandingNotification();
        stopExpandingNotification();

        verify(mNotificationStackScrollLayout).startOverscrollAfterExpanding();
        verify(mExpandHelper).finishExpanding();
        verify(mNotificationStackScrollLayout, never()).dispatchDownEventToScroller(any());
        assertTrue(touchHandled);
    }

    @Test
@@ -964,11 +963,11 @@ public class NotificationStackScrollLayoutControllerTest extends SysuiTestCase {
    public void onTouchEvent_stopExpandingNotification_sceneContainerDisabled() {
        stopExpandingNotification();

        verify(mNotificationStackScrollLayout, never()).startOverscrollAfterExpanding();
        verify(mExpandHelper, never()).finishExpanding();
        verify(mNotificationStackScrollLayout).dispatchDownEventToScroller(any());
    }

    private boolean stopExpandingNotification() {
    private void stopExpandingNotification() {
        when(mNotificationStackScrollLayout.getExpandHelper()).thenReturn(mExpandHelper);
        when(mNotificationStackScrollLayout.getIsExpanded()).thenReturn(true);
        when(mNotificationStackScrollLayout.getExpandedInThisMotion()).thenReturn(true);
@@ -983,7 +982,7 @@ public class NotificationStackScrollLayoutControllerTest extends SysuiTestCase {
        NotificationStackScrollLayoutController.TouchHandler touchHandler =
                mController.getTouchHandler();

        return touchHandler.onTouchEvent(MotionEvent.obtain(
        touchHandler.onTouchEvent(MotionEvent.obtain(
            /* downTime= */ 0,
            /* eventTime= */ 0,
            MotionEvent.ACTION_DOWN,
+0 −8
Original line number Diff line number Diff line
@@ -3727,14 +3727,6 @@ public class NotificationStackScrollLayout
        downEvent.recycle();
    }

    // Only when scene container is enabled, mark that we are being dragged so that we start
    // dispatching the rest of the gesture to scene container.
    void startOverscrollAfterExpanding() {
        if (SceneContainerFlag.isUnexpectedlyInLegacyMode()) return;
        getExpandHelper().finishExpanding();
        setIsBeingDragged(true);
    }

    // Only when scene container is enabled, mark that we are being dragged so that we start
    // dispatching the rest of the gesture to scene container.
    void startDraggingOnHun() {
+3 −4
Original line number Diff line number Diff line
@@ -2203,11 +2203,10 @@ public class NotificationStackScrollLayoutController implements Dumpable {
                expandingNotification = mView.isExpandingNotification();
                if (mView.getExpandedInThisMotion() && !expandingNotification && wasExpandingBefore
                        && !mView.getDisallowScrollingInThisMotion()) {
                    // We need to dispatch the overscroll differently when Scene Container is on,
                    // since NSSL no longer controls its own scroll.
                    // Finish expansion here, as this gesture will be marked to be sent to
                    // scene container
                    if (SceneContainerFlag.isEnabled() && !isCancelOrUp) {
                        mView.startOverscrollAfterExpanding();
                        return true;
                        expandHelper.finishExpanding();
                    } else {
                        mView.dispatchDownEventToScroller(ev);
                    }
+0 −8
Original line number Diff line number Diff line
@@ -1544,14 +1544,6 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase {
        assertFalse(mStackScroller.mHeadsUpAnimatingAway);
    }

    @Test
    @EnableSceneContainer
    public void finishExpanding_sceneContainerEnabled() {
        mStackScroller.startOverscrollAfterExpanding();
        verify(mStackScroller.getExpandHelper()).finishExpanding();
        assertTrue(mStackScroller.getIsBeingDragged());
    }

    private MotionEvent captureTouchSentToSceneFramework() {
        ArgumentCaptor<MotionEvent> captor = ArgumentCaptor.forClass(MotionEvent.class);
        verify(mStackScrollLayoutController).sendTouchToSceneFramework(captor.capture());