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
diff --git a/quickstep/src/com/android/quickstep/OverviewCommandHelper.kt b/quickstep/src/com/android/quickstep/OverviewCommandHelper.kt
index 5e29139..9a2b7ce 100644
--- a/quickstep/src/com/android/quickstep/OverviewCommandHelper.kt
+++ b/quickstep/src/com/android/quickstep/OverviewCommandHelper.kt
@@ -96,10 +96,10 @@
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 815f8fa..fc12b73 100644
--- a/quickstep/src/com/android/quickstep/views/TaskView.kt
+++ b/quickstep/src/com/android/quickstep/views/TaskView.kt
@@ -1034,7 +1034,10 @@
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