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

Commit 19f1e289 authored by Bryce Lee's avatar Bryce Lee
Browse files

Do not modify notification shade plugin state.

This change removes logic from the BouncerSwipeTouchHandler
where the notification shade plugin state was being forced open
on the beginning of a touch session.

Test: atest BouncerSwipeTouchHandlerTest
Flag: ACONFIG com.android.systemui.communal_bouncer_do_not_modify_plugin_open disabled
Fixes: 338252661
Change-Id: I7146d3ffcfd7f0eed71ae2404c0fdf0a6975072c
parent 9590dca4
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -852,3 +852,13 @@ flag {
    purpose: PURPOSE_BUGFIX
  }
}

flag {
  name: "communal_bouncer_do_not_modify_plugin_open"
  namespace: "systemui"
  description: "do not modify notification shade when handling bouncer expansion."
  bug: "338252661"
  metadata {
    purpose: PURPOSE_BUGFIX
  }
}
+28 −0
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.reset;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.Mockito.when;

import android.animation.AnimatorListenerAdapter;
@@ -163,6 +164,7 @@ public class BouncerSwipeTouchHandlerTest extends SysuiTestCase {
     * Ensures expansion only happens when touch down happens in valid part of the screen.
     */
    @Test
    @DisableFlags(Flags.FLAG_COMMUNAL_BOUNCER_DO_NOT_MODIFY_PLUGIN_OPEN)
    public void testSessionStart() {
        mTouchHandler.getTouchInitiationRegion(SCREEN_BOUNDS, mRegion, null);

@@ -193,7 +195,31 @@ public class BouncerSwipeTouchHandlerTest extends SysuiTestCase {
                        2)).isTrue();
    }


    /**
     * Ensures expansion only happens when touch down happens in valid part of the screen.
     */
    @Test
    @EnableFlags(Flags.FLAG_COMMUNAL_BOUNCER_DO_NOT_MODIFY_PLUGIN_OPEN)
    public void testSessionStart_doesNotModifyNotificationShadeWindow() {
        mTouchHandler.getTouchInitiationRegion(SCREEN_BOUNDS, mRegion, null);

        verify(mRegion).union(mRectCaptor.capture());
        final Rect bounds = mRectCaptor.getValue();

        final Rect expected = new Rect();

        expected.set(0, Math.round(SCREEN_HEIGHT_PX * (1 - TOUCH_REGION)), SCREEN_WIDTH_PX,
                SCREEN_HEIGHT_PX);

        assertThat(bounds).isEqualTo(expected);

        mTouchHandler.onSessionStart(mTouchSession);
        verifyNoMoreInteractions(mNotificationShadeWindowController);
    }

    @Test
    @DisableFlags(Flags.FLAG_COMMUNAL_BOUNCER_DO_NOT_MODIFY_PLUGIN_OPEN)
    public void testSwipeUp_whenBouncerInitiallyShowing_reduceHeightWithExclusionRects() {
        mTouchHandler.getTouchInitiationRegion(SCREEN_BOUNDS, mRegion,
                new Rect(0, 0, SCREEN_WIDTH_PX, SCREEN_HEIGHT_PX));
@@ -213,6 +239,7 @@ public class BouncerSwipeTouchHandlerTest extends SysuiTestCase {
    }

    @Test
    @DisableFlags(Flags.FLAG_COMMUNAL_BOUNCER_DO_NOT_MODIFY_PLUGIN_OPEN)
    public void testSwipeUp_exclusionRectAtTop_doesNotIntersectGestureArea() {
        mTouchHandler.getTouchInitiationRegion(SCREEN_BOUNDS, mRegion,
                new Rect(0, 0, SCREEN_WIDTH_PX, SCREEN_HEIGHT_PX / 4));
@@ -228,6 +255,7 @@ public class BouncerSwipeTouchHandlerTest extends SysuiTestCase {
    }

    @Test
    @DisableFlags(Flags.FLAG_COMMUNAL_BOUNCER_DO_NOT_MODIFY_PLUGIN_OPEN)
    public void testSwipeUp_exclusionRectBetweenNormalAndMinimumSwipeArea() {
        final int normalSwipeAreaTop = SCREEN_HEIGHT_PX
                - Math.round(SCREEN_HEIGHT_PX * TOUCH_REGION);
+9 −2
Original line number Diff line number Diff line
@@ -254,7 +254,11 @@ public class BouncerSwipeTouchHandler implements TouchHandler {
        mVelocityTracker = mVelocityTrackerFactory.obtain();
        mTouchSession = session;
        mVelocityTracker.clear();

        if (!Flags.communalBouncerDoNotModifyPluginOpen()) {
            mNotificationShadeWindowController.setForcePluginOpen(true, this);
        }

        mScrimManager.addCallback(mScrimManagerCallback);
        mCurrentScrimController = mScrimManager.getCurrentController();

@@ -265,7 +269,10 @@ public class BouncerSwipeTouchHandler implements TouchHandler {
            }
            mScrimManager.removeCallback(mScrimManagerCallback);
            mCapture = null;

            if (!Flags.communalBouncerDoNotModifyPluginOpen()) {
                mNotificationShadeWindowController.setForcePluginOpen(false, this);
            }
        });

        session.registerGestureListener(mOnGestureListener);