diff --git a/quickstep/tests/multivalentTests/src/com/android/quickstep/LauncherSwipeHandlerV2Test.kt b/quickstep/tests/multivalentTests/src/com/android/quickstep/LauncherSwipeHandlerV2Test.kt index 32b5b859ae..73187597a0 100644 --- a/quickstep/tests/multivalentTests/src/com/android/quickstep/LauncherSwipeHandlerV2Test.kt +++ b/quickstep/tests/multivalentTests/src/com/android/quickstep/LauncherSwipeHandlerV2Test.kt @@ -19,11 +19,14 @@ package com.android.quickstep import android.graphics.PointF import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest +import androidx.test.platform.app.InstrumentationRegistry +import com.android.launcher3.Flags.enableLauncherOverviewInWindow import com.android.launcher3.R import com.android.launcher3.dagger.LauncherAppComponent import com.android.launcher3.dagger.LauncherAppSingleton import com.android.launcher3.util.LauncherModelHelper import com.android.quickstep.dagger.QuickStepModule +import com.android.quickstep.fallback.window.RecentsWindowFactory import com.android.systemui.contextualeducation.GestureType import com.android.systemui.shared.system.InputConsumerController import dagger.BindsInstance @@ -68,6 +71,16 @@ class LauncherSwipeHandlerV2Test { ) val deviceState = mock(RecentsAnimationDeviceState::class.java) whenever(deviceState.rotationTouchHelper).thenReturn(mock(RotationTouchHelper::class.java)) + + if (enableLauncherOverviewInWindow()) { + // Initialize an instance of RecentsWindowFactory directly to simulate its + // initialization in TouchInteractionService#onCreate. + // This instance will then be used in OverviewComponentObserver. + InstrumentationRegistry.getInstrumentation().runOnMainSync { + RecentsWindowFactory(sandboxContext) + } + } + gestureState = spy(GestureState(OverviewComponentObserver(sandboxContext, deviceState), 0)) underTest =