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:
@@ -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")
|
||||
|
||||
@@ -2693,16 +2693,17 @@ public abstract class RecentsView<
|
||||
}
|
||||
|
||||
private void onReset() {
|
||||
if (enableRefactorTaskThumbnail()) {
|
||||
mRecentsViewModel.onReset();
|
||||
removeAllViews();
|
||||
}
|
||||
unloadVisibleTaskData(TaskView.FLAG_UPDATE_ALL);
|
||||
setCurrentPage(0);
|
||||
LayoutUtils.setViewEnabled(mActionsView, true);
|
||||
if (mOrientationState.setGestureActive(false)) {
|
||||
updateOrientationHandler(/* forceRecreateDragLayerControllers = */ false);
|
||||
}
|
||||
if (enableRefactorTaskThumbnail()) {
|
||||
mRecentsViewModel.onReset();
|
||||
// TODO(b/391842220) Remove TaskViews rather than calling specific logic to cancel scope
|
||||
getTaskViews().forEach(TaskView::destroyScopes);
|
||||
}
|
||||
}
|
||||
|
||||
public int getRunningTaskViewId() {
|
||||
|
||||
@@ -141,6 +141,11 @@ class TaskContainer(
|
||||
}
|
||||
}
|
||||
|
||||
// TODO(b/391842220): Cancel scope in onDetach instead of having a specific method for this.
|
||||
fun destroyScopes() {
|
||||
thumbnailView.destroyScopes()
|
||||
}
|
||||
|
||||
fun bindThumbnailView() {
|
||||
taskThumbnailViewModel.bind(task.key.id)
|
||||
}
|
||||
|
||||
@@ -617,6 +617,11 @@ constructor(
|
||||
taskContainers.forEach { it.destroy() }
|
||||
}
|
||||
|
||||
fun destroyScopes() {
|
||||
// TODO(b/391842220): Cancel scope in onDetach instead of having a specific method for this.
|
||||
taskContainers.forEach { it.destroyScopes() }
|
||||
}
|
||||
|
||||
// TODO: Clip-out the icon region from the thumbnail, since they are overlapping.
|
||||
override fun hasOverlappingRendering() = false
|
||||
|
||||
|
||||
Reference in New Issue
Block a user