From 7d640afaba2a4378e5ef737f8ccd250ea57665de Mon Sep 17 00:00:00 2001 From: Uwais Ashraf Date: Fri, 23 May 2025 10:50:38 +0000 Subject: [PATCH] Don't launch a coroutine job if no jobs to cancel Flag: com.android.launcher3.enable_coroutine_threading_improvements Bug: 417598777 Test: Presubmits Change-Id: I474e3e12faf2886b593571e9625a1d16df742c0d --- quickstep/src/com/android/quickstep/views/TaskView.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/quickstep/src/com/android/quickstep/views/TaskView.kt b/quickstep/src/com/android/quickstep/views/TaskView.kt index 2d24250594..29c2dda6cf 100644 --- a/quickstep/src/com/android/quickstep/views/TaskView.kt +++ b/quickstep/src/com/android/quickstep/views/TaskView.kt @@ -952,7 +952,9 @@ constructor( // onAttach or another moment in the lifecycle. val coroutineJobsToCancel = coroutineJobs.toList() coroutineJobs.clear() - if (enableCoroutineThreadingImprovements() && coroutineJobsToCancel.isNotEmpty()) { + if (coroutineJobsToCancel.isEmpty()) return + + if (enableCoroutineThreadingImprovements()) { // TODO(b/391842220): This should ideally be handled in the completion block of the // jobs above to be cancelled. taskContainers.forEach {