Allow pressing home button on recents if command queue not empty
Fixes: 290252373
Test: Go home from overview, works
Flag: None
Change-Id: Ie40eb1891f38b1561eda89ad0f7987cdecd9da16
diff --git a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java
index 1ba11fd..175c88e 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java
@@ -1311,9 +1311,9 @@
: 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 4a60566..42bf1ac 100644
--- a/quickstep/src/com/android/quickstep/OverviewCommandHelper.java
+++ b/quickstep/src/com/android/quickstep/OverviewCommandHelper.java
@@ -141,8 +141,8 @@
}
@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 7cb6eb6..546a48a 100644
--- a/quickstep/src/com/android/quickstep/RecentsActivity.java
+++ b/quickstep/src/com/android/quickstep/RecentsActivity.java
@@ -469,8 +469,8 @@
};
}
- 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 7dc8347..95d88cd 100644
--- a/quickstep/src/com/android/quickstep/fallback/FallbackRecentsView.java
+++ b/quickstep/src/com/android/quickstep/fallback/FallbackRecentsView.java
@@ -86,8 +86,8 @@
}
@Override
- protected boolean isCommandQueueEmpty() {
- return mActivity.isCommandQueueEmpty();
+ protected boolean canStartHomeSafely() {
+ return mActivity.canStartHomeSafely();
}
/**
diff --git a/quickstep/src/com/android/quickstep/views/LauncherRecentsView.java b/quickstep/src/com/android/quickstep/views/LauncherRecentsView.java
index 3ee9009..462175f 100644
--- a/quickstep/src/com/android/quickstep/views/LauncherRecentsView.java
+++ b/quickstep/src/com/android/quickstep/views/LauncherRecentsView.java
@@ -90,8 +90,8 @@
}
@Override
- protected boolean isCommandQueueEmpty() {
- return mActivity.isCommandQueueEmpty();
+ protected boolean canStartHomeSafely() {
+ return mActivity.canStartHomeSafely();
}
@Override
diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java
index ae744d4..5e84a49 100644
--- a/quickstep/src/com/android/quickstep/views/RecentsView.java
+++ b/quickstep/src/com/android/quickstep/views/RecentsView.java
@@ -165,6 +165,7 @@
import com.android.launcher3.util.ViewPool;
import com.android.quickstep.BaseActivityInterface;
import com.android.quickstep.GestureState;
+import com.android.quickstep.OverviewCommandHelper;
import com.android.quickstep.RecentsAnimationController;
import com.android.quickstep.RecentsAnimationTargets;
import com.android.quickstep.RecentsFilterState;
@@ -2367,14 +2368,14 @@
}
public void startHome(boolean animated) {
- if (!isCommandQueueEmpty()) return;
+ if (!canStartHomeSafely()) return;
handleStartHome(animated);
}
protected abstract void handleStartHome(boolean animated);
- /** Returns whether the overview command helper queue is empty. */
- protected abstract boolean isCommandQueueEmpty();
+ /** Returns whether user can start home based on state in {@link OverviewCommandHelper}. */
+ protected abstract boolean canStartHomeSafely();
public void reset() {
setCurrentTask(-1);