Update LauncherSwipeUpHandlerV2Test setup to account for RecentsWindowFactory

Flag: com.android.launcher3.enable_fallback_overview_in_window
Fixes: 383375436
Test: LauncherSwipeHandlerV2Test
Change-Id: Ifd8f10f55a6c1e43ce7e5e410f77d47d845b216d
This commit is contained in:
Schneider Victor-Tulias
2024-12-10 16:15:26 -05:00
parent 76e1676c7f
commit 35c7dae0ef

View File

@@ -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 =