Merge "Allow pressing home button on recents if command queue not empty" into udc-qpr-dev
diff --git a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java
index cca05a5..fbe0a8f 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java
@@ -1328,9 +1328,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 c58d6cc..33a8261 100644
--- a/quickstep/src/com/android/quickstep/RecentsActivity.java
+++ b/quickstep/src/com/android/quickstep/RecentsActivity.java
@@ -470,8 +470,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 828d466..80e5a54 100644
--- a/quickstep/src/com/android/quickstep/views/LauncherRecentsView.java
+++ b/quickstep/src/com/android/quickstep/views/LauncherRecentsView.java
@@ -94,8 +94,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 b8ec5f0..6f16f41 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);