From dfd69242749b6184792e34787e35c9ef9a00dd9a Mon Sep 17 00:00:00 2001 From: Jordan Silva Date: Tue, 3 Sep 2024 14:37:57 +0100 Subject: [PATCH] Fix Square Recent button unresponsiveness This CL adds a fix to prevent OverviewCommandHelper adding and running a new command when a previous command is already running. In some cases OverviewCommandHelper queue gets cleared, ignoring if a command is still running. This behavior allows a new command to be added in the queue and executed right away, even that an old command is still waiting for callback. This results in the queue to be stuck due to an invalid state. To prevent this, we implement the following changes: - Prevent calling onTaskLaunchedInLiveTileMode from RecentsView when recents animation controller is null. - Fix clearPendingCommands to clear only the pending commands from the queue, and not the running command. Fix: 352046797 Flag: EXEMPT bugfix. Test: Manual. Change-Id: Ia6afc86424d298353a7ad6755e9a98275330d4ce --- quickstep/src/com/android/quickstep/OverviewCommandHelper.kt | 4 ++-- quickstep/src/com/android/quickstep/views/TaskView.kt | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/quickstep/src/com/android/quickstep/OverviewCommandHelper.kt b/quickstep/src/com/android/quickstep/OverviewCommandHelper.kt index 5e29139e5b..9a2b7ce610 100644 --- a/quickstep/src/com/android/quickstep/OverviewCommandHelper.kt +++ b/quickstep/src/com/android/quickstep/OverviewCommandHelper.kt @@ -96,10 +96,10 @@ class OverviewCommandHelper( fun canStartHomeSafely(): Boolean = commandQueue.isEmpty() || commandQueue.first().type == HOME - /** Clear pending commands from the queue */ + /** Clear pending or completed commands from the queue */ fun clearPendingCommands() { Log.d(TAG, "clearing pending commands: $commandQueue") - commandQueue.clear() + commandQueue.removeAll { it.status != CommandStatus.PROCESSING } } /** diff --git a/quickstep/src/com/android/quickstep/views/TaskView.kt b/quickstep/src/com/android/quickstep/views/TaskView.kt index 815f8fa422..fc12b73e8b 100644 --- a/quickstep/src/com/android/quickstep/views/TaskView.kt +++ b/quickstep/src/com/android/quickstep/views/TaskView.kt @@ -1034,7 +1034,10 @@ constructor( ActiveGestureErrorDetector.GestureEvent.EXPECTING_TASK_APPEARED ) val recentsView = recentsView ?: return null - if (recentsView.runningTaskViewId != -1) { + if ( + recentsView.runningTaskViewId != -1 && + recentsView.mRecentsAnimationController != null + ) { recentsView.onTaskLaunchedInLiveTileMode() // Return a fresh callback in the live tile case, so that it's not accidentally