Merge "Skip sending user home when the overview command queue is pending." into udc-qpr-dev

This commit is contained in:
Schneider Victor-tulias
2023-06-21 21:50:56 +00:00
committed by Android (Google) Code Review
7 changed files with 46 additions and 3 deletions
@@ -1305,6 +1305,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<Launcher> {
@@ -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();
@@ -466,4 +466,11 @@ public final class RecentsActivity extends StatefulActivity<RecentsState> {
}
};
}
@Override
public boolean isCommandQueueEmpty() {
OverviewCommandHelper overviewCommandHelper = mTISBindHelper.getOverviewCommandHelper();
return super.isCommandQueueEmpty()
&& (overviewCommandHelper == null || overviewCommandHelper.isCommandQueueEmpty());
}
}
@@ -80,11 +80,16 @@ public class FallbackRecentsView extends RecentsView<RecentsActivity, RecentsSta
}
@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
@@ -82,13 +82,18 @@ public class LauncherRecentsView extends RecentsView<QuickstepLauncher, Launcher
}
@Override
public void startHome(boolean animated) {
protected void handleStartHome(boolean animated) {
StateManager stateManager = mActivity.getStateManager();
animated &= stateManager.shouldAnimateStateChange();
stateManager.goToState(NORMAL, animated);
AbstractFloatingView.closeAllOpenViews(mActivity, animated);
}
@Override
public boolean isCommandQueueEmpty() {
return mActivity.isCommandQueueEmpty();
}
@Override
protected void onTaskLaunchAnimationEnd(boolean success) {
if (success) {
@@ -2366,7 +2366,15 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
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);
@@ -237,4 +237,10 @@ public abstract class StatefulActivity<STATE_TYPE extends BaseState<STATE_TYPE>>
* @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;
}
}