From 35c7dae0ef59f59f6ceeaeef5545cb799b3a40db Mon Sep 17 00:00:00 2001 From: Schneider Victor-Tulias Date: Tue, 10 Dec 2024 16:15:26 -0500 Subject: [PATCH] Update LauncherSwipeUpHandlerV2Test setup to account for RecentsWindowFactory Flag: com.android.launcher3.enable_fallback_overview_in_window Fixes: 383375436 Test: LauncherSwipeHandlerV2Test Change-Id: Ifd8f10f55a6c1e43ce7e5e410f77d47d845b216d --- .../android/quickstep/LauncherSwipeHandlerV2Test.kt | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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 =