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

Commit 4957c9d7 authored by William Xiao's avatar William Xiao
Browse files

Clean up hubmode_fullscreen_vertical_swipe_fix flag

Flag has been launched to the public.

Bug: 340177049
Test: atest BouncerSwipeTouchHandlerTest ShadeTouchHandlerTest GlanceableHubContainerControllerTest
      also manually verified on device
Flag: EXEMPT removing com.android.systemui.hubmode_fullscreen_vertical_swipe_fix
Change-Id: Ie21c8132bc9a202d00dc8eeb9db3706b9ffa2952
parent 0fd609c4
Loading
Loading
Loading
Loading
+0 −21
Original line number Diff line number Diff line
@@ -1547,27 +1547,6 @@ flag {
  bug: "352600066"
}

flag {
  name: "hubmode_fullscreen_vertical_swipe"
  namespace: "systemui"
  description: "Enables fullscreen vertical swiping in hub mode to bring up and down the bouncer and shade"
  bug: "340177049"
  metadata {
      purpose: PURPOSE_BUGFIX
  }
}

flag {
  name: "hubmode_fullscreen_vertical_swipe_fix"
  namespace: "systemui"
  description: "Bug fix that enables fullscreen vertical swiping in hub mode to bring up and down the bouncer and shade"
  bug: "340177049"
  metadata {
      purpose: PURPOSE_BUGFIX
  }
}


flag {
   namespace: "systemui"
   name: "remove_update_listener_in_qs_icon_view_impl"
+1 −1
Original line number Diff line number Diff line
@@ -323,7 +323,7 @@ fun CommunalHub(
                    }
                }
                // Nested scroll for full screen swipe to get to shade and bouncer
                .thenIf(!viewModel.isEditMode && Flags.hubmodeFullscreenVerticalSwipeFix()) {
                .thenIf(!viewModel.isEditMode) {
                    Modifier.nestedScroll(nestedScrollConnection).pointerInput(viewModel) {
                        awaitPointerEventScope {
                            while (true) {
+0 −318
Original line number Diff line number Diff line
/*
 * Copyright (C) 2024 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.systemui.ambient.touch;

import static com.google.common.truth.Truth.assertThat;

import static kotlinx.coroutines.flow.StateFlowKt.MutableStateFlow;

import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyFloat;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

import android.animation.ValueAnimator;
import android.content.pm.UserInfo;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Rect;
import android.platform.test.annotations.DisableFlags;
import android.platform.test.annotations.EnableFlags;
import android.platform.test.flag.junit.FlagsParameterization;
import android.view.GestureDetector;
import android.view.GestureDetector.OnGestureListener;
import android.view.MotionEvent;
import android.view.VelocityTracker;

import androidx.test.filters.SmallTest;

import com.android.internal.logging.UiEventLogger;
import com.android.systemui.Flags;
import com.android.systemui.SysuiTestCase;
import com.android.systemui.ambient.touch.scrim.ScrimController;
import com.android.systemui.ambient.touch.scrim.ScrimManager;
import com.android.systemui.communal.ui.viewmodel.CommunalViewModel;
import com.android.systemui.flags.SceneContainerFlagParameterizationKt;
import com.android.systemui.keyguard.domain.interactor.KeyguardInteractor;
import com.android.systemui.kosmos.KosmosJavaAdapter;
import com.android.systemui.plugins.ActivityStarter;
import com.android.systemui.scene.domain.interactor.SceneInteractor;
import com.android.systemui.scene.ui.view.WindowRootView;
import com.android.systemui.shared.system.InputChannelCompat;
import com.android.systemui.statusbar.NotificationShadeWindowController;
import com.android.systemui.statusbar.phone.CentralSurfaces;
import com.android.systemui.statusbar.policy.KeyguardStateController;
import com.android.wm.shell.animation.FlingAnimationUtils;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;

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)
@DisableFlags(Flags.FLAG_COMMUNAL_BOUNCER_DO_NOT_MODIFY_PLUGIN_OPEN)
public class BouncerFullscreenSwipeTouchHandlerTest extends SysuiTestCase {
    private KosmosJavaAdapter mKosmos;

    @Mock
    CentralSurfaces mCentralSurfaces;

    @Mock
    ScrimManager mScrimManager;

    @Mock
    ScrimController mScrimController;

    @Mock
    NotificationShadeWindowController mNotificationShadeWindowController;

    @Mock
    FlingAnimationUtils mFlingAnimationUtils;

    @Mock
    FlingAnimationUtils mFlingAnimationUtilsClosing;

    @Mock
    TouchHandler.TouchSession mTouchSession;

    BouncerSwipeTouchHandler mTouchHandler;

    @Mock
    BouncerSwipeTouchHandler.ValueAnimatorCreator mValueAnimatorCreator;

    @Mock
    ValueAnimator mValueAnimator;

    @Mock
    BouncerSwipeTouchHandler.VelocityTrackerFactory mVelocityTrackerFactory;

    @Mock
    VelocityTracker mVelocityTracker;

    @Mock
    UiEventLogger mUiEventLogger;

    @Mock
    ActivityStarter mActivityStarter;

    @Mock
    CommunalViewModel mCommunalViewModel;

    @Mock
    KeyguardInteractor mKeyguardInteractor;

    @Mock
    WindowRootView mWindowRootView;

    @Mock
    Resources mResources;

    private SceneInteractor mSceneInteractor;

    private KeyguardStateController mKeyguardStateController;

    private static final float TOUCH_REGION = .3f;
    private static final float MIN_BOUNCER_HEIGHT = .05f;
    private final Configuration mConfiguration = new Configuration();

    private static final Rect SCREEN_BOUNDS = new Rect(0, 0, 1024, 100);
    private static final UserInfo CURRENT_USER_INFO = new UserInfo(
            10,
            /* name= */ "user10",
            /* flags= */ 0
    );

    @Parameters(name = "{0}")
    public static List<FlagsParameterization> getParams() {
        return SceneContainerFlagParameterizationKt.parameterizeSceneContainerFlag();
    }

    public BouncerFullscreenSwipeTouchHandlerTest(FlagsParameterization flags) {
        super();
        mSetFlagsRule.setFlagsParameterization(flags);
    }

    @Before
    public void setup() {
        mKosmos = new KosmosJavaAdapter(this);
        mSceneInteractor = spy(mKosmos.getSceneInteractor());
        mKeyguardStateController = mKosmos.getKeyguardStateController();
        mConfiguration.orientation = Configuration.ORIENTATION_PORTRAIT;

        MockitoAnnotations.initMocks(this);
        mTouchHandler = new BouncerSwipeTouchHandler(
                mKosmos.getTestScope(),
                mScrimManager,
                Optional.of(mCentralSurfaces),
                mNotificationShadeWindowController,
                mValueAnimatorCreator,
                mVelocityTrackerFactory,
                mCommunalViewModel,
                mFlingAnimationUtils,
                mFlingAnimationUtilsClosing,
                TOUCH_REGION,
                MIN_BOUNCER_HEIGHT,
                mUiEventLogger,
                mActivityStarter,
                mKeyguardInteractor,
                mSceneInteractor,
                mKosmos.getShadeRepository(),
                Optional.of(() -> mWindowRootView),
                mKeyguardStateController,
                mKosmos.getCommunalSettingsInteractor());

        when(mScrimManager.getCurrentController()).thenReturn(mScrimController);
        when(mValueAnimatorCreator.create(anyFloat(), anyFloat())).thenReturn(mValueAnimator);
        when(mVelocityTrackerFactory.obtain()).thenReturn(mVelocityTracker);
        when(mFlingAnimationUtils.getMinVelocityPxPerSecond()).thenReturn(Float.MAX_VALUE);
        when(mTouchSession.getBounds()).thenReturn(SCREEN_BOUNDS);
        when(mKeyguardInteractor.isKeyguardDismissible()).thenReturn(MutableStateFlow(false));
        when(mKeyguardStateController.isKeyguardScreenRotationAllowed()).thenReturn(true);
        when(mWindowRootView.getResources()).thenReturn(mResources);
        when(mResources.getConfiguration()).thenReturn(mConfiguration);
    }

    /**
     * Makes sure that touches go to the scene container when the flag is on.
     */
    @Test
    @EnableFlags(Flags.FLAG_SCENE_CONTAINER)
    public void testSwipeUp_sendsTouchesToWindowRootView() {
        mTouchHandler.onGlanceableTouchAvailable(true);
        mTouchHandler.onSessionStart(mTouchSession);
        ArgumentCaptor<GestureDetector.OnGestureListener> gestureListenerCaptor =
                ArgumentCaptor.forClass(GestureDetector.OnGestureListener.class);
        verify(mTouchSession).registerGestureListener(gestureListenerCaptor.capture());

        final OnGestureListener gestureListener = gestureListenerCaptor.getValue();

        final int screenHeight = 100;
        final float distanceY = screenHeight * 0.42f;

        final MotionEvent event1 = MotionEvent.obtain(0, 0, MotionEvent.ACTION_MOVE,
                0, screenHeight, 0);
        final MotionEvent event2 = MotionEvent.obtain(0, 0, MotionEvent.ACTION_MOVE,
                0, screenHeight - distanceY, 0);

        assertThat(gestureListener.onScroll(event1, event2, 0,
                distanceY))
                .isTrue();

        // Ensure only called once
        verify(mSceneInteractor).onRemoteUserInputStarted(any());
        verify(mWindowRootView).dispatchTouchEvent(event1);
        verify(mWindowRootView).dispatchTouchEvent(event2);
    }

    /**
     * Ensures expansion does not happen for full vertical swipes when touch is not available.
     */
    @Test
    public void testFullSwipe_notInitiatedWhenNotAvailable() {
        mTouchHandler.onGlanceableTouchAvailable(false);
        mTouchHandler.onSessionStart(mTouchSession);
        ArgumentCaptor<OnGestureListener> gestureListenerCaptor =
                ArgumentCaptor.forClass(OnGestureListener.class);
        verify(mTouchSession).registerGestureListener(gestureListenerCaptor.capture());

        // A touch within range at the bottom of the screen should trigger listening
        assertThat(gestureListenerCaptor.getValue()
                .onScroll(Mockito.mock(MotionEvent.class),
                        Mockito.mock(MotionEvent.class),
                        1,
                        2)).isFalse();
    }

    /**
     * Ensures expansion only happens for full vertical swipes when touch is available.
     */
    @Test
    public void testFullSwipe_initiatedWhenAvailable() {
        mTouchHandler.onGlanceableTouchAvailable(true);
        mTouchHandler.onSessionStart(mTouchSession);
        ArgumentCaptor<OnGestureListener> gestureListenerCaptor =
                ArgumentCaptor.forClass(OnGestureListener.class);
        verify(mTouchSession).registerGestureListener(gestureListenerCaptor.capture());

        // A touch within range at the bottom of the screen should trigger listening
        assertThat(gestureListenerCaptor.getValue()
                .onScroll(Mockito.mock(MotionEvent.class),
                        Mockito.mock(MotionEvent.class),
                        1,
                        2)).isTrue();
    }

    @Test
    public void testFullSwipe_motionUpResetsTouchState() {
        mTouchHandler.onGlanceableTouchAvailable(true);
        mTouchHandler.onSessionStart(mTouchSession);
        ArgumentCaptor<OnGestureListener> gestureListenerCaptor =
                ArgumentCaptor.forClass(OnGestureListener.class);
        ArgumentCaptor<InputChannelCompat.InputEventListener> inputListenerCaptor =
                ArgumentCaptor.forClass(InputChannelCompat.InputEventListener.class);
        verify(mTouchSession).registerGestureListener(gestureListenerCaptor.capture());
        verify(mTouchSession).registerInputListener(inputListenerCaptor.capture());

        // A touch within range at the bottom of the screen should trigger listening
        assertThat(gestureListenerCaptor.getValue()
                .onScroll(Mockito.mock(MotionEvent.class),
                        Mockito.mock(MotionEvent.class),
                        1,
                        2)).isTrue();

        MotionEvent upEvent = Mockito.mock(MotionEvent.class);
        when(upEvent.getAction()).thenReturn(MotionEvent.ACTION_UP);
        inputListenerCaptor.getValue().onInputEvent(upEvent);
        verify(mCommunalViewModel).onResetTouchState();
    }

    @Test
    public void testFullSwipe_motionCancelResetsTouchState() {
        mTouchHandler.onGlanceableTouchAvailable(true);
        mTouchHandler.onSessionStart(mTouchSession);
        ArgumentCaptor<OnGestureListener> gestureListenerCaptor =
                ArgumentCaptor.forClass(OnGestureListener.class);
        ArgumentCaptor<InputChannelCompat.InputEventListener> inputListenerCaptor =
                ArgumentCaptor.forClass(InputChannelCompat.InputEventListener.class);
        verify(mTouchSession).registerGestureListener(gestureListenerCaptor.capture());
        verify(mTouchSession).registerInputListener(inputListenerCaptor.capture());

        // A touch within range at the bottom of the screen should trigger listening
        assertThat(gestureListenerCaptor.getValue()
                .onScroll(Mockito.mock(MotionEvent.class),
                        Mockito.mock(MotionEvent.class),
                        1,
                        2)).isTrue();

        MotionEvent upEvent = Mockito.mock(MotionEvent.class);
        when(upEvent.getAction()).thenReturn(MotionEvent.ACTION_CANCEL);
        inputListenerCaptor.getValue().onInputEvent(upEvent);
        verify(mCommunalViewModel).onResetTouchState();
    }
}
+73 −1
Original line number Diff line number Diff line
@@ -89,7 +89,6 @@ import java.util.Optional;

@SmallTest
@RunWith(ParameterizedAndroidJunit4.class)
@DisableFlags(Flags.FLAG_HUBMODE_FULLSCREEN_VERTICAL_SWIPE_FIX)
public class BouncerSwipeTouchHandlerTest extends SysuiTestCase {
    private KosmosJavaAdapter mKosmos;
    @Mock
@@ -221,6 +220,9 @@ public class BouncerSwipeTouchHandlerTest extends SysuiTestCase {
        when(mKeyguardStateController.isKeyguardScreenRotationAllowed()).thenReturn(true);
        when(mWindowRootView.getResources()).thenReturn(mResources);
        setCommunalV2ConfigEnabled(true);

        // Indicate touches are available.
        mTouchHandler.onGlanceableTouchAvailable(true);
    }

    /**
@@ -389,6 +391,26 @@ public class BouncerSwipeTouchHandlerTest extends SysuiTestCase {
        verify(mScrimController, never()).expand(any());
    }

    /**
     * Ensures expansion does not happen for swipes when touch is not available.
     */
    @Test
    public void testSwipe_hubTouchNotAvailable_notInitiated() {
        // Hub touch is not available.
        mTouchHandler.onGlanceableTouchAvailable(false);
        mTouchHandler.onSessionStart(mTouchSession);
        ArgumentCaptor<OnGestureListener> gestureListenerCaptor =
                ArgumentCaptor.forClass(OnGestureListener.class);
        verify(mTouchSession).registerGestureListener(gestureListenerCaptor.capture());

        // A touch within range at the bottom of the screen should trigger listening.
        assertThat(gestureListenerCaptor.getValue()
                .onScroll(Mockito.mock(MotionEvent.class),
                        Mockito.mock(MotionEvent.class),
                        1,
                        2)).isFalse();
    }

    /**
     * Makes sure swiping down when bouncer initially hidden doesn't change the expansion amount.
     */
@@ -705,6 +727,56 @@ public class BouncerSwipeTouchHandlerTest extends SysuiTestCase {
        assertThat(mKosmos.getShadeRepository().getLegacyShadeTracking().getValue()).isFalse();
    }

    // Verifies that communal touch state is reset when gesture ends in ACTION_UP.
    @Test
    public void testFullSwipe_motionUpResetsTouchState() {
        mTouchHandler.onGlanceableTouchAvailable(true);
        mTouchHandler.onSessionStart(mTouchSession);
        ArgumentCaptor<OnGestureListener> gestureListenerCaptor =
                ArgumentCaptor.forClass(OnGestureListener.class);
        ArgumentCaptor<InputChannelCompat.InputEventListener> inputListenerCaptor =
                ArgumentCaptor.forClass(InputChannelCompat.InputEventListener.class);
        verify(mTouchSession).registerGestureListener(gestureListenerCaptor.capture());
        verify(mTouchSession).registerInputListener(inputListenerCaptor.capture());

        // A touch within range at the bottom of the screen should trigger listening
        assertThat(gestureListenerCaptor.getValue()
                .onScroll(Mockito.mock(MotionEvent.class),
                        Mockito.mock(MotionEvent.class),
                        1,
                        2)).isTrue();

        MotionEvent upEvent = Mockito.mock(MotionEvent.class);
        when(upEvent.getAction()).thenReturn(MotionEvent.ACTION_UP);
        inputListenerCaptor.getValue().onInputEvent(upEvent);
        verify(mCommunalViewModel).onResetTouchState();
    }

    // Verifies that communal touch state is reset when gesture ends in ACTION_CANCEL.
    @Test
    public void testFullSwipe_motionCancelResetsTouchState() {
        mTouchHandler.onGlanceableTouchAvailable(true);
        mTouchHandler.onSessionStart(mTouchSession);
        ArgumentCaptor<OnGestureListener> gestureListenerCaptor =
                ArgumentCaptor.forClass(OnGestureListener.class);
        ArgumentCaptor<InputChannelCompat.InputEventListener> inputListenerCaptor =
                ArgumentCaptor.forClass(InputChannelCompat.InputEventListener.class);
        verify(mTouchSession).registerGestureListener(gestureListenerCaptor.capture());
        verify(mTouchSession).registerInputListener(inputListenerCaptor.capture());

        // A touch within range at the bottom of the screen should trigger listening
        assertThat(gestureListenerCaptor.getValue()
                .onScroll(Mockito.mock(MotionEvent.class),
                        Mockito.mock(MotionEvent.class),
                        1,
                        2)).isTrue();

        MotionEvent upEvent = Mockito.mock(MotionEvent.class);
        when(upEvent.getAction()).thenReturn(MotionEvent.ACTION_CANCEL);
        inputListenerCaptor.getValue().onInputEvent(upEvent);
        verify(mCommunalViewModel).onResetTouchState();
    }

    private void swipeToPosition(float percent, float velocityY) {
        Mockito.clearInvocations(mTouchSession);
        mTouchHandler.onSessionStart(mTouchSession);
+17 −46
Original line number Diff line number Diff line
@@ -38,7 +38,6 @@ import com.android.systemui.shade.ShadeViewController
import com.android.systemui.shared.system.InputChannelCompat
import com.android.systemui.statusbar.phone.CentralSurfaces
import com.android.systemui.testKosmos
import com.google.common.truth.Truth
import com.google.common.truth.Truth.assertThat
import java.util.Optional
import javax.inject.Provider
@@ -90,29 +89,30 @@ class ShadeTouchHandlerTest(flags: FlagsParameterization) : SysuiTestCase() {
                Optional.of(Provider<WindowRootView> { windowRootView }),
                TOUCH_HEIGHT,
            )

        // Indicate touches are available.
        mTouchHandler.onGlanceableTouchAvailable(true)
    }

    // Verifies that a swipe down in the gesture region is captured by the shade touch handler.
    // Verifies that a swipe down is captured by the shade touch handler.
    @Test
    @DisableFlags(Flags.FLAG_HUBMODE_FULLSCREEN_VERTICAL_SWIPE_FIX)
    fun testSwipeDown_captured() {
    fun testSwipeDown_initiatedWhenAvailable() {
        val captured = swipe(Direction.DOWN)
        Truth.assertThat(captured).isTrue()
        assertThat(captured).isTrue()
    }

    // Verifies that a swipe in the upward direction is not captured.
    @Test
    @DisableFlags(Flags.FLAG_HUBMODE_FULLSCREEN_VERTICAL_SWIPE_FIX)
    fun testSwipeUp_notCaptured() {
        val captured = swipe(Direction.UP)

        // Motion events not captured as the swipe is going in the wrong direction.
        Truth.assertThat(captured).isFalse()
        assertThat(captured).isFalse()
    }

    // Verifies that a swipe down forwards captured touches to central surfaces for handling.
    @Test
    @DisableFlags(Flags.FLAG_HUBMODE_FULLSCREEN_VERTICAL_SWIPE_FIX, Flags.FLAG_SCENE_CONTAINER)
    @DisableFlags(Flags.FLAG_SCENE_CONTAINER)
    @EnableFlags(Flags.FLAG_COMMUNAL_HUB)
    fun testSwipeDown_communalEnabled_sentToCentralSurfaces() {
        kosmos.fakeFeatureFlagsClassic.set(COMMUNAL_SERVICE_ENABLED, true)
@@ -125,12 +125,7 @@ class ShadeTouchHandlerTest(flags: FlagsParameterization) : SysuiTestCase() {

    // Verifies that a swipe down forwards captured touches to the shade view for handling.
    @Test
    @DisableFlags(
        Flags.FLAG_COMMUNAL_HUB,
        Flags.FLAG_GLANCEABLE_HUB_V2,
        Flags.FLAG_HUBMODE_FULLSCREEN_VERTICAL_SWIPE_FIX,
        Flags.FLAG_SCENE_CONTAINER,
    )
    @DisableFlags(Flags.FLAG_COMMUNAL_HUB, Flags.FLAG_GLANCEABLE_HUB_V2, Flags.FLAG_SCENE_CONTAINER)
    fun testSwipeDown_communalDisabled_sentToShadeView() {
        swipe(Direction.DOWN)

@@ -141,7 +136,7 @@ class ShadeTouchHandlerTest(flags: FlagsParameterization) : SysuiTestCase() {
    // Verifies that a swipe down while dreaming forwards captured touches to the shade view for
    // handling.
    @Test
    @DisableFlags(Flags.FLAG_HUBMODE_FULLSCREEN_VERTICAL_SWIPE_FIX, Flags.FLAG_SCENE_CONTAINER)
    @DisableFlags(Flags.FLAG_SCENE_CONTAINER)
    fun testSwipeDown_dreaming_sentToShadeView() {
        whenever(mDreamManager.isDreaming).thenReturn(true)
        swipe(Direction.DOWN)
@@ -152,11 +147,7 @@ class ShadeTouchHandlerTest(flags: FlagsParameterization) : SysuiTestCase() {

    // Verifies that a swipe down forwards captured touches to the window root view for handling.
    @Test
    @EnableFlags(
        Flags.FLAG_COMMUNAL_HUB,
        Flags.FLAG_SCENE_CONTAINER,
        Flags.FLAG_HUBMODE_FULLSCREEN_VERTICAL_SWIPE_FIX,
    )
    @EnableFlags(Flags.FLAG_COMMUNAL_HUB, Flags.FLAG_SCENE_CONTAINER)
    fun testSwipeDown_sceneContainerEnabled_sentToWindowRootView() {
        mTouchHandler.onGlanceableTouchAvailable(true)

@@ -171,7 +162,6 @@ class ShadeTouchHandlerTest(flags: FlagsParameterization) : SysuiTestCase() {
    // for handling.
    @Test
    @EnableFlags(Flags.FLAG_SCENE_CONTAINER)
    @DisableFlags(Flags.FLAG_HUBMODE_FULLSCREEN_VERTICAL_SWIPE_FIX)
    fun testSwipeDown_sceneContainerEnabledFullscreenSwipeDisabled_sentToWindowRootView() {
        swipe(Direction.DOWN)

@@ -182,7 +172,7 @@ class ShadeTouchHandlerTest(flags: FlagsParameterization) : SysuiTestCase() {

    // Verifies that a swipe up is not forwarded to central surfaces.
    @Test
    @DisableFlags(Flags.FLAG_HUBMODE_FULLSCREEN_VERTICAL_SWIPE_FIX, Flags.FLAG_SCENE_CONTAINER)
    @DisableFlags(Flags.FLAG_SCENE_CONTAINER)
    @EnableFlags(Flags.FLAG_COMMUNAL_HUB)
    fun testSwipeUp_communalEnabled_touchesNotSent() {
        kosmos.fakeFeatureFlagsClassic.set(COMMUNAL_SERVICE_ENABLED, true)
@@ -196,11 +186,7 @@ class ShadeTouchHandlerTest(flags: FlagsParameterization) : SysuiTestCase() {

    // Verifies that a swipe up is not forwarded to the shade view.
    @Test
    @DisableFlags(
        Flags.FLAG_COMMUNAL_HUB,
        Flags.FLAG_HUBMODE_FULLSCREEN_VERTICAL_SWIPE_FIX,
        Flags.FLAG_SCENE_CONTAINER,
    )
    @DisableFlags(Flags.FLAG_COMMUNAL_HUB, Flags.FLAG_SCENE_CONTAINER)
    fun testSwipeUp_communalDisabled_touchesNotSent() {
        swipe(Direction.UP)

@@ -221,7 +207,6 @@ class ShadeTouchHandlerTest(flags: FlagsParameterization) : SysuiTestCase() {
    }

    @Test
    @DisableFlags(Flags.FLAG_HUBMODE_FULLSCREEN_VERTICAL_SWIPE_FIX)
    fun testCancelMotionEvent_popsTouchSession() {
        swipe(Direction.DOWN)
        val event = MotionEvent.obtain(0, 0, MotionEvent.ACTION_CANCEL, 0f, 0f, 0)
@@ -230,30 +215,17 @@ class ShadeTouchHandlerTest(flags: FlagsParameterization) : SysuiTestCase() {
    }

    @Test
    @EnableFlags(Flags.FLAG_HUBMODE_FULLSCREEN_VERTICAL_SWIPE_FIX)
    fun testFullVerticalSwipe_initiatedWhenAvailable() {
        // Indicate touches are available
        mTouchHandler.onGlanceableTouchAvailable(true)

        // Verify swipe is handled
        val captured = swipe(Direction.DOWN)
        Truth.assertThat(captured).isTrue()
    }

    @Test
    @EnableFlags(Flags.FLAG_HUBMODE_FULLSCREEN_VERTICAL_SWIPE_FIX)
    fun testFullVerticalSwipe_notInitiatedWhenNotAvailable() {
    fun testSwipeDown_notInitiatedWhenNotAvailable() {
        // Indicate touches aren't available
        mTouchHandler.onGlanceableTouchAvailable(false)

        // Verify swipe is not handled
        val captured = swipe(Direction.DOWN)
        Truth.assertThat(captured).isFalse()
        assertThat(captured).isFalse()
    }

    @Test
    @EnableFlags(Flags.FLAG_HUBMODE_FULLSCREEN_VERTICAL_SWIPE_FIX)
    fun testFullVerticalSwipe_resetsTouchStateOnUp() {
    fun testSwipeDown_resetsTouchStateOnUp() {
        // Indicate touches are available
        mTouchHandler.onGlanceableTouchAvailable(true)

@@ -268,8 +240,7 @@ class ShadeTouchHandlerTest(flags: FlagsParameterization) : SysuiTestCase() {
    }

    @Test
    @EnableFlags(Flags.FLAG_HUBMODE_FULLSCREEN_VERTICAL_SWIPE_FIX)
    fun testFullVerticalSwipe_resetsTouchStateOnCancel() {
    fun testSwipeDown_resetsTouchStateOnCancel() {
        // Indicate touches are available
        mTouchHandler.onGlanceableTouchAvailable(true)

Loading