Merge "Fix test Dagger initialization deadlock in RecentsDisplayModel" into main

This commit is contained in:
Schneider Victor-tulias
2025-01-08 07:16:41 -08:00
committed by Android (Google) Code Review
3 changed files with 30 additions and 30 deletions

View File

@@ -25,7 +25,6 @@ import com.android.launcher3.dagger.LauncherAppModule
import com.android.launcher3.dagger.LauncherAppSingleton
import com.android.launcher3.util.LauncherModelHelper
import com.android.launcher3.util.MSDLPlayerWrapper
import com.android.quickstep.fallback.window.RecentsDisplayModel
import com.android.systemui.contextualeducation.GestureType
import com.android.systemui.shared.system.InputConsumerController
import dagger.BindsInstance
@@ -67,9 +66,7 @@ class LauncherSwipeHandlerV2Test {
@Before
fun setup() {
sandboxContext.initDaggerComponent(
DaggerTestComponent.builder()
.bindSystemUiProxy(systemUiProxy)
.bindRecentsDisplayModel(RecentsDisplayModel(sandboxContext))
DaggerTestComponent.builder().bindSystemUiProxy(systemUiProxy)
)
sandboxContext.putObject(
RotationTouchHelper.INSTANCE,
@@ -122,8 +119,6 @@ interface TestComponent : LauncherAppComponent {
interface Builder : LauncherAppComponent.Builder {
@BindsInstance fun bindSystemUiProxy(proxy: SystemUiProxy): Builder
@BindsInstance fun bindRecentsDisplayModel(model: RecentsDisplayModel): Builder
override fun build(): TestComponent
}
}

View File

@@ -28,14 +28,9 @@ import androidx.test.filters.SmallTest
import androidx.test.platform.app.InstrumentationRegistry
import com.android.launcher3.Flags.FLAG_ENABLE_FALLBACK_OVERVIEW_IN_WINDOW
import com.android.launcher3.Flags.FLAG_ENABLE_LAUNCHER_OVERVIEW_IN_WINDOW
import com.android.launcher3.dagger.LauncherAppComponent
import com.android.launcher3.dagger.LauncherAppModule
import com.android.launcher3.dagger.LauncherAppSingleton
import com.android.launcher3.util.LauncherModelHelper
import com.android.launcher3.util.window.CachedDisplayInfo
import com.android.quickstep.fallback.window.RecentsDisplayModel
import dagger.BindsInstance
import dagger.Component
import org.junit.Assert
import org.junit.Before
import org.junit.Rule
@@ -75,10 +70,6 @@ class RecentsDisplayModelTest {
whenever(displayManager.getDisplay(anyInt())).thenReturn(display)
runOnMainSync { recentsDisplayModel = RecentsDisplayModel.INSTANCE.get(context) }
context.initDaggerComponent(
DaggerRecentsDisplayModelComponent.builder()
.bindRecentsDisplayModel(recentsDisplayModel)
)
}
@Test
@@ -125,14 +116,3 @@ class RecentsDisplayModelTest {
InstrumentationRegistry.getInstrumentation().runOnMainSync { f.run() }
}
}
@LauncherAppSingleton
@Component(modules = [LauncherAppModule::class])
interface RecentsDisplayModelComponent : LauncherAppComponent {
@Component.Builder
interface Builder : LauncherAppComponent.Builder {
@BindsInstance fun bindRecentsDisplayModel(model: RecentsDisplayModel): Builder
override fun build(): RecentsDisplayModelComponent
}
}