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
This commit is contained in:
Jordan Silva
2024-09-03 14:37:57 +01:00
parent ebfae18529
commit dfd6924274
2 changed files with 6 additions and 3 deletions

View File

@@ -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 }
}
/**

View File

@@ -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