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
diff --git a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java
index ecc8e19..0b70b01 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java
@@ -1304,6 +1304,13 @@
: 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<Launcher> {
diff --git a/quickstep/src/com/android/quickstep/OverviewCommandHelper.java b/quickstep/src/com/android/quickstep/OverviewCommandHelper.java
index a0d49a4..4a60566 100644
--- a/quickstep/src/com/android/quickstep/OverviewCommandHelper.java
+++ b/quickstep/src/com/android/quickstep/OverviewCommandHelper.java
@@ -140,6 +140,11 @@
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 bf96690..e282d1f 100644
--- a/quickstep/src/com/android/quickstep/RecentsActivity.java
+++ b/quickstep/src/com/android/quickstep/RecentsActivity.java
@@ -466,4 +466,11 @@
}
};
}
+
+ @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 074aedd..550bfb5 100644
--- a/quickstep/src/com/android/quickstep/fallback/FallbackRecentsView.java
+++ b/quickstep/src/com/android/quickstep/fallback/FallbackRecentsView.java
@@ -79,11 +79,16 @@
}
@Override
- public void startHome(boolean animated) {
+ protected void handleStartHome(boolean animated) {
mActivity.startHome();
AbstractFloatingView.closeAllOpenViews(mActivity, mActivity.isStarted());
}
+ @Override
+ public boolean isCommandQueueEmpty() {
+ return mActivity.isCommandQueueEmpty();
+ }
+
/**
* When starting gesture interaction from home, we add a temporary invisible tile corresponding
* to the home task. This allows us to handle quick-switch similarly to a quick-switching
diff --git a/quickstep/src/com/android/quickstep/views/LauncherRecentsView.java b/quickstep/src/com/android/quickstep/views/LauncherRecentsView.java
index 4dbf4e3..12d0f26 100644
--- a/quickstep/src/com/android/quickstep/views/LauncherRecentsView.java
+++ b/quickstep/src/com/android/quickstep/views/LauncherRecentsView.java
@@ -81,7 +81,7 @@
}
@Override
- public void startHome(boolean animated) {
+ protected void handleStartHome(boolean animated) {
StateManager stateManager = mActivity.getStateManager();
animated &= stateManager.shouldAnimateStateChange();
stateManager.goToState(NORMAL, animated);
@@ -89,6 +89,11 @@
}
@Override
+ public boolean isCommandQueueEmpty() {
+ return mActivity.isCommandQueueEmpty();
+ }
+
+ @Override
protected void onTaskLaunchAnimationEnd(boolean success) {
if (success) {
mActivity.getStateManager().moveToRestState();
diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java
index 7183514..94085ae 100644
--- a/quickstep/src/com/android/quickstep/views/RecentsView.java
+++ b/quickstep/src/com/android/quickstep/views/RecentsView.java
@@ -2345,7 +2345,15 @@
startHome(mActivity.isStarted());
}
- public abstract void startHome(boolean animated);
+ public void startHome(boolean animated) {
+ if (!isCommandQueueEmpty()) return;
+ handleStartHome(animated);
+ }
+
+ protected abstract void handleStartHome(boolean animated);
+
+ /** Returns whether the overview command helper queue is empty. */
+ public abstract boolean isCommandQueueEmpty();
public void reset() {
setCurrentTask(-1);
diff --git a/src/com/android/launcher3/statemanager/StatefulActivity.java b/src/com/android/launcher3/statemanager/StatefulActivity.java
index 520f33c..de5887f 100644
--- a/src/com/android/launcher3/statemanager/StatefulActivity.java
+++ b/src/com/android/launcher3/statemanager/StatefulActivity.java
@@ -237,4 +237,10 @@
* @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;
+ }
}