From a6b441bdeeec1a64dd283d11aab681bf74217e94 Mon Sep 17 00:00:00 2001 From: Vinit Nayak Date: Thu, 6 Jul 2023 13:38:50 -0700 Subject: [PATCH] Allow pressing home button on recents if command queue not empty Fixes: 290252373 Test: Go home from overview, works Flag: None Change-Id: Ie40eb1891f38b1561eda89ad0f7987cdecd9da16 --- .../android/launcher3/uioverrides/QuickstepLauncher.java | 4 ++-- .../src/com/android/quickstep/OverviewCommandHelper.java | 4 ++-- quickstep/src/com/android/quickstep/RecentsActivity.java | 4 ++-- .../android/quickstep/fallback/FallbackRecentsView.java | 4 ++-- .../com/android/quickstep/views/LauncherRecentsView.java | 4 ++-- quickstep/src/com/android/quickstep/views/RecentsView.java | 7 ++++--- 6 files changed, 14 insertions(+), 13 deletions(-) diff --git a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java index 1ba11fd01d..175c88edee 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java +++ b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java @@ -1311,9 +1311,9 @@ public class QuickstepLauncher extends Launcher { : groupTask.mSplitBounds.leftTaskPercent); } - public boolean isCommandQueueEmpty() { + public boolean canStartHomeSafely() { OverviewCommandHelper overviewCommandHelper = mTISBindHelper.getOverviewCommandHelper(); - return overviewCommandHelper == null || overviewCommandHelper.isCommandQueueEmpty(); + return overviewCommandHelper == null || overviewCommandHelper.canStartHomeSafely(); } private static final class LauncherTaskViewController extends diff --git a/quickstep/src/com/android/quickstep/OverviewCommandHelper.java b/quickstep/src/com/android/quickstep/OverviewCommandHelper.java index 4a60566bd8..42bf1ac2ed 100644 --- a/quickstep/src/com/android/quickstep/OverviewCommandHelper.java +++ b/quickstep/src/com/android/quickstep/OverviewCommandHelper.java @@ -141,8 +141,8 @@ public class OverviewCommandHelper { } @UiThread - public boolean isCommandQueueEmpty() { - return mPendingCommands.isEmpty(); + public boolean canStartHomeSafely() { + return mPendingCommands.isEmpty() || mPendingCommands.get(0).type == TYPE_HOME; } @Nullable diff --git a/quickstep/src/com/android/quickstep/RecentsActivity.java b/quickstep/src/com/android/quickstep/RecentsActivity.java index 7cb6eb63ab..546a48ada9 100644 --- a/quickstep/src/com/android/quickstep/RecentsActivity.java +++ b/quickstep/src/com/android/quickstep/RecentsActivity.java @@ -469,8 +469,8 @@ public final class RecentsActivity extends StatefulActivity { }; } - public boolean isCommandQueueEmpty() { + public boolean canStartHomeSafely() { OverviewCommandHelper overviewCommandHelper = mTISBindHelper.getOverviewCommandHelper(); - return overviewCommandHelper == null || overviewCommandHelper.isCommandQueueEmpty(); + return overviewCommandHelper == null || overviewCommandHelper.canStartHomeSafely(); } } diff --git a/quickstep/src/com/android/quickstep/fallback/FallbackRecentsView.java b/quickstep/src/com/android/quickstep/fallback/FallbackRecentsView.java index 7dc8347419..95d88cd935 100644 --- a/quickstep/src/com/android/quickstep/fallback/FallbackRecentsView.java +++ b/quickstep/src/com/android/quickstep/fallback/FallbackRecentsView.java @@ -86,8 +86,8 @@ public class FallbackRecentsView extends RecentsView