From cb0de752428139bf21de25c67501aa9956bee7ae Mon Sep 17 00:00:00 2001 From: Schneider Victor-tulias Date: Tue, 20 Jun 2023 11:20:58 -0700 Subject: [PATCH] Skip sending user home when the overview command queue is pending. Tapping the overview scrim during an app -> overview transition in 3-button nav can replace that state transition's aniamtion, leaving the device in a broken state. The assumption is that the user did not mean to tap the scrim while quickly tapping the overview button. Skipping the startHome request if the overview command queue is not empty. Flag: not needed Fixes: 284920213 Test: quickly tapped overview button and quickly tapped scrim; added logs to check error case Change-Id: I8fea76d810e550e28a61a4528796b358103cb5b3 --- .../launcher3/uioverrides/QuickstepLauncher.java | 7 +++++++ .../com/android/quickstep/OverviewCommandHelper.java | 5 +++++ .../src/com/android/quickstep/RecentsActivity.java | 7 +++++++ .../quickstep/fallback/FallbackRecentsView.java | 7 ++++++- .../android/quickstep/views/LauncherRecentsView.java | 7 ++++++- .../src/com/android/quickstep/views/RecentsView.java | 10 +++++++++- .../launcher3/statemanager/StatefulActivity.java | 6 ++++++ 7 files changed, 46 insertions(+), 3 deletions(-) diff --git a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java index ecc8e196fd..0b70b01368 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java +++ b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java @@ -1304,6 +1304,13 @@ public class QuickstepLauncher extends Launcher { : groupTask.mSplitBounds.leftTaskPercent); } + @Override + public boolean isCommandQueueEmpty() { + OverviewCommandHelper overviewCommandHelper = mTISBindHelper.getOverviewCommandHelper(); + return super.isCommandQueueEmpty() + && (overviewCommandHelper == null || overviewCommandHelper.isCommandQueueEmpty()); + } + private static final class LauncherTaskViewController extends TaskViewTouchController { diff --git a/quickstep/src/com/android/quickstep/OverviewCommandHelper.java b/quickstep/src/com/android/quickstep/OverviewCommandHelper.java index a0d49a4f7e..4a60566bd8 100644 --- a/quickstep/src/com/android/quickstep/OverviewCommandHelper.java +++ b/quickstep/src/com/android/quickstep/OverviewCommandHelper.java @@ -140,6 +140,11 @@ public class OverviewCommandHelper { mPendingCommands.clear(); } + @UiThread + public boolean isCommandQueueEmpty() { + return mPendingCommands.isEmpty(); + } + @Nullable private TaskView getNextTask(RecentsView view) { final TaskView runningTaskView = view.getRunningTaskView(); diff --git a/quickstep/src/com/android/quickstep/RecentsActivity.java b/quickstep/src/com/android/quickstep/RecentsActivity.java index bf96690dd2..e282d1fffb 100644 --- a/quickstep/src/com/android/quickstep/RecentsActivity.java +++ b/quickstep/src/com/android/quickstep/RecentsActivity.java @@ -466,4 +466,11 @@ public final class RecentsActivity extends StatefulActivity { } }; } + + @Override + public boolean isCommandQueueEmpty() { + OverviewCommandHelper overviewCommandHelper = mTISBindHelper.getOverviewCommandHelper(); + return super.isCommandQueueEmpty() + && (overviewCommandHelper == null || overviewCommandHelper.isCommandQueueEmpty()); + } } diff --git a/quickstep/src/com/android/quickstep/fallback/FallbackRecentsView.java b/quickstep/src/com/android/quickstep/fallback/FallbackRecentsView.java index 074aedd3c7..550bfb5632 100644 --- a/quickstep/src/com/android/quickstep/fallback/FallbackRecentsView.java +++ b/quickstep/src/com/android/quickstep/fallback/FallbackRecentsView.java @@ -79,11 +79,16 @@ public class FallbackRecentsView extends RecentsView> * @param leftOrTop if the staged split will be positioned left or top. */ public void enterStageSplitFromRunningApp(boolean leftOrTop) { } + + + /** Returns whether the overview command helper queue is empty. */ + public boolean isCommandQueueEmpty() { + return true; + } }