Merge "Allow pressing home button on recents if command queue not empty" into udc-qpr-dev am: cf6b71a14e

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/23922250

Change-Id: I637343cd86a7eebd3ff3635e6375e9ccb76c97fb
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Vinit Nayak
2023-07-12 21:10:09 +00:00
committed by Automerger Merge Worker
6 changed files with 14 additions and 13 deletions
@@ -1328,9 +1328,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
@@ -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
@@ -470,8 +470,8 @@ public final class RecentsActivity extends StatefulActivity<RecentsState> {
};
}
public boolean isCommandQueueEmpty() {
public boolean canStartHomeSafely() {
OverviewCommandHelper overviewCommandHelper = mTISBindHelper.getOverviewCommandHelper();
return overviewCommandHelper == null || overviewCommandHelper.isCommandQueueEmpty();
return overviewCommandHelper == null || overviewCommandHelper.canStartHomeSafely();
}
}
@@ -86,8 +86,8 @@ public class FallbackRecentsView extends RecentsView<RecentsActivity, RecentsSta
}
@Override
protected boolean isCommandQueueEmpty() {
return mActivity.isCommandQueueEmpty();
protected boolean canStartHomeSafely() {
return mActivity.canStartHomeSafely();
}
/**
@@ -94,8 +94,8 @@ public class LauncherRecentsView extends RecentsView<QuickstepLauncher, Launcher
}
@Override
protected boolean isCommandQueueEmpty() {
return mActivity.isCommandQueueEmpty();
protected boolean canStartHomeSafely() {
return mActivity.canStartHomeSafely();
}
@Override
@@ -165,6 +165,7 @@ import com.android.launcher3.util.VibratorWrapper;
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 abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
}
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);