Only cancel CoroutineScope of TaskThumbnailView instead of removing from RV.

Removing TVs from RV was causing failures of CUJs (only in tests) when enabling TTV flag.

Bug: 390156722
Flag: com.android.launcher3.enable_refactor_task_thumbnail
Test: TaplTestsQuickstep.testOverview
Test: TaplTestsKeyboardQuickSwitch.testLaunchOverviewTask_fromHomeAllApps
Change-Id: I0aae99891941c04b543d1e29db9d6d87bc89ed8e
This commit is contained in:
Uwais Ashraf committed 2025-01-23 16:56:13 +00:00
1 parent e3220bec92
commit b7a66372ff
4 files changed
+17 -6

No files matched your search

@@ -146,8 +146,8 @@ class TaskThumbnailView : FrameLayout, ViewPool.Reusable {
}
}
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
// TODO(b/391842220): Cancel scope in onDetach instead of having a specific method for this.
fun destroyScopes() {
val scopeToCancel = viewAttachedScope
recentsCoroutineScope.launch(dispatcherProvider.background) {
scopeToCancel.cancel("TaskThumbnailView detaching from window")