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

Commit 4cc106f8 authored by Lucas Silva's avatar Lucas Silva
Browse files

Fix swiping up bouncer on GH

The bouncer gesture is being interrupted by a call from
SharedNotificationContainerViewModel to update the max number of
notifications, which has the downstream effect of hiding the bouncer.
SharedNotificationContainerViewModel won't update the max number of
notifications if the user is interacting with the shade however, but we
don't currently set that state in the GH bouncer touch handling. This
change updates the user gesture state in ShadeRepository so that all
downstream consumers know the user is interacting with the shade when
expanding the bouncer on GH

Fixes: 391411581
Test: atest SystemUiRoboTests:BouncerSwipeTouchHandlerTest
Flag: EXEMPT bugfix
Change-Id: Id66dee4d24bb7e8754d6f887e84b342e23121d93
parent 72acca4e
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -64,12 +64,12 @@ import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;

import java.util.List;
import java.util.Optional;

import platform.test.runner.parameterized.ParameterizedAndroidJunit4;
import platform.test.runner.parameterized.Parameters;

import java.util.List;
import java.util.Optional;

@SmallTest
@RunWith(ParameterizedAndroidJunit4.class)
@EnableFlags(Flags.FLAG_HUBMODE_FULLSCREEN_VERTICAL_SWIPE_FIX)
@@ -171,6 +171,7 @@ public class BouncerFullscreenSwipeTouchHandlerTest extends SysuiTestCase {
                mActivityStarter,
                mKeyguardInteractor,
                mSceneInteractor,
                mKosmos.getShadeRepository(),
                Optional.of(() -> mWindowRootView));

        when(mScrimManager.getCurrentController()).thenReturn(mScrimController);
+20 −3
Original line number Diff line number Diff line
@@ -74,12 +74,12 @@ import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;

import java.util.List;
import java.util.Optional;

import platform.test.runner.parameterized.ParameterizedAndroidJunit4;
import platform.test.runner.parameterized.Parameters;

import java.util.List;
import java.util.Optional;

@SmallTest
@RunWith(ParameterizedAndroidJunit4.class)
@DisableFlags(Flags.FLAG_HUBMODE_FULLSCREEN_VERTICAL_SWIPE_FIX)
@@ -187,6 +187,7 @@ public class BouncerSwipeTouchHandlerTest extends SysuiTestCase {
                mActivityStarter,
                mKeyguardInteractor,
                mSceneInteractor,
                mKosmos.getShadeRepository(),
                Optional.of(() -> mWindowRootView)
        );

@@ -627,6 +628,22 @@ public class BouncerSwipeTouchHandlerTest extends SysuiTestCase {
        onRemovedCallbackCaptor.getValue().onRemoved();
    }

    @Test
    public void testTouchSessionStart_notifiesShadeOfUserInteraction() {
        mTouchHandler.onSessionStart(mTouchSession);

        mKosmos.getTestScope().getTestScheduler().runCurrent();
        assertThat(mKosmos.getShadeRepository().getLegacyShadeTracking().getValue()).isTrue();

        ArgumentCaptor<TouchHandler.TouchSession.Callback> onRemovedCallbackCaptor =
                ArgumentCaptor.forClass(TouchHandler.TouchSession.Callback.class);
        verify(mTouchSession).registerCallback(onRemovedCallbackCaptor.capture());
        onRemovedCallbackCaptor.getValue().onRemoved();

        mKosmos.getTestScope().getTestScheduler().runCurrent();
        assertThat(mKosmos.getShadeRepository().getLegacyShadeTracking().getValue()).isFalse();
    }

    private void swipeToPosition(float percent, float velocityY) {
        Mockito.clearInvocations(mTouchSession);
        mTouchHandler.onSessionStart(mTouchSession);
+5 −0
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@ import com.android.systemui.scene.domain.interactor.SceneInteractor
import com.android.systemui.scene.shared.flag.SceneContainerFlag
import com.android.systemui.scene.ui.view.WindowRootView
import com.android.systemui.shade.ShadeExpansionChangeEvent
import com.android.systemui.shade.data.repository.ShadeRepository
import com.android.systemui.statusbar.NotificationShadeWindowController
import com.android.systemui.statusbar.phone.CentralSurfaces
import com.android.wm.shell.animation.FlingAnimationUtils
@@ -79,6 +80,7 @@ constructor(
    private val activityStarter: ActivityStarter,
    private val keyguardInteractor: KeyguardInteractor,
    private val sceneInteractor: SceneInteractor,
    private val shadeRepository: ShadeRepository,
    private val windowRootViewProvider: Optional<Provider<WindowRootView>>,
) : TouchHandler {
    /** An interface for creating ValueAnimators. */
@@ -260,6 +262,8 @@ constructor(
        }
        scrimManager.addCallback(scrimManagerCallback)
        currentScrimController = scrimManager.currentController

        shadeRepository.setLegacyShadeTracking(true)
        session.registerCallback {
            velocityTracker?.apply { recycle() }
            velocityTracker = null
@@ -270,6 +274,7 @@ constructor(
            if (!Flags.communalBouncerDoNotModifyPluginOpen()) {
                notificationShadeWindowController.setForcePluginOpen(false, this)
            }
            shadeRepository.setLegacyShadeTracking(false)
        }
        session.registerGestureListener(onGestureListener)
        session.registerInputListener { ev: InputEvent -> onMotionEvent(ev) }