Merge "Allow pressing home button on recents if command queue not empty" into udc-qpr-dev
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user