From 89d64bb34602d2eba0d3ee69815c59615d5f68fe Mon Sep 17 00:00:00 2001 From: Schneider Victor-tulias Date: Thu, 14 Sep 2023 12:24:29 -0400 Subject: [PATCH] Add overview button rate-limiter to fix recurring bug Processing the TYPE_TOGGLE command immediately makes it relatively easy to start overlapping animations that clobber each other and prevent clean up callbacks from running. This would cause a janky overview animation, a full command queue that can't be emptied and a recents tile than gets stuck on the screen. Added a rate limiter to (hopefully) prevent this type of bug from recurring. Flag: not needed Fixes: 298792963 Test: quickly and repeatedly pressed the overview button, checked logs to check that the error case never occurs anymore and rate-limiter procs instead. Change-Id: I1575c932bb24d2405792539e8a14ed8d4171f5ae --- .../quickstep/BaseActivityInterface.java | 4 +++- .../quickstep/OverviewCommandHelper.java | 19 ++++++++++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/quickstep/src/com/android/quickstep/BaseActivityInterface.java b/quickstep/src/com/android/quickstep/BaseActivityInterface.java index 5a9d80d630..2354491bba 100644 --- a/quickstep/src/com/android/quickstep/BaseActivityInterface.java +++ b/quickstep/src/com/android/quickstep/BaseActivityInterface.java @@ -437,11 +437,13 @@ public abstract class BaseActivityInterface scheduleNextTask(cmd)); + callbackList.add(() -> { + scheduleNextTask(cmd); + mWaitForToggleCommandComplete = false; + }); return false; } else { recents.startHome(); + mWaitForToggleCommandComplete = false; return true; } } @@ -178,6 +191,9 @@ public class OverviewCommandHelper { * task is deferred until {@link #scheduleNextTask} is called */ private > boolean executeCommand(CommandInfo cmd) { + if (mWaitForToggleCommandComplete && cmd.type == TYPE_TOGGLE) { + return true; + } BaseActivityInterface activityInterface = mOverviewComponentObserver.getActivityInterface(); RecentsView recents = activityInterface.getVisibleRecentsView(); @@ -359,6 +375,7 @@ public class OverviewCommandHelper { pw.println(" pendingCommandType=" + mPendingCommands.get(0).type); } pw.println(" mTaskFocusIndexOverride=" + mTaskFocusIndexOverride); + pw.println(" mWaitForToggleCommandComplete=" + mWaitForToggleCommandComplete); } private static class CommandInfo {