Merge "Fix tap on navbar handle when on desktop" into udc-qpr-dev

This commit is contained in:
Ats Jenk
2023-08-01 17:28:57 +00:00
committed by Android (Google) Code Review
3 changed files with 33 additions and 10 deletions
@@ -27,6 +27,7 @@ import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherState;
import com.android.launcher3.statemanager.StatefulActivity;
import com.android.launcher3.uioverrides.QuickstepLauncher;
import com.android.quickstep.GestureState;
import com.android.quickstep.SystemUiProxy;
import com.android.quickstep.views.DesktopAppSelectView;
import com.android.wm.shell.desktopmode.IDesktopTaskListener;
@@ -170,20 +171,40 @@ public class DesktopVisibilityController {
/**
* Whether recents gesture is currently in progress.
*/
public boolean isGestureInProgress() {
public boolean isRecentsGestureInProgress() {
return mGestureInProgress;
}
/**
* Sets whether recents gesture is in progress.
* Notify controller that recents gesture has started.
*/
public void setGestureInProgress(boolean gestureInProgress) {
if (DEBUG) {
Log.d(TAG, "setGestureInProgress: inProgress=" + gestureInProgress);
}
public void setRecentsGestureStart() {
if (!isDesktopModeSupported()) {
return;
}
setRecentsGestureInProgress(true);
}
/**
* Notify controller that recents gesture finished with the given
* {@link com.android.quickstep.GestureState.GestureEndTarget}
*/
public void setRecentsGestureEnd(@Nullable GestureState.GestureEndTarget endTarget) {
if (!isDesktopModeSupported()) {
return;
}
setRecentsGestureInProgress(false);
if (endTarget == null) {
// Gesture did not result in a new end target. Ensure launchers gets paused again.
markLauncherPaused();
}
}
private void setRecentsGestureInProgress(boolean gestureInProgress) {
if (DEBUG) {
Log.d(TAG, "setGestureInProgress: inProgress=" + gestureInProgress);
}
if (gestureInProgress != mGestureInProgress) {
mGestureInProgress = gestureInProgress;
}
@@ -867,7 +867,7 @@ public class QuickstepLauncher extends Launcher {
if (DesktopTaskView.DESKTOP_MODE_SUPPORTED) {
DesktopVisibilityController controller = mDesktopVisibilityController;
if (controller != null && controller.areFreeformTasksVisible()
&& !controller.isGestureInProgress()) {
&& !controller.isRecentsGestureInProgress()) {
// Return early to skip setting activity to appear as resumed
// TODO(b/255649902): shouldn't be needed when we have a separate launcher state
// for desktop that we can use to control other parts of launcher
@@ -249,7 +249,7 @@ public class LauncherRecentsView extends RecentsView<QuickstepLauncher, Launcher
DesktopVisibilityController desktopVisibilityController =
mActivity.getDesktopVisibilityController();
if (desktopVisibilityController != null) {
desktopVisibilityController.setGestureInProgress(true);
desktopVisibilityController.setRecentsGestureStart();
}
}
@@ -257,9 +257,11 @@ public class LauncherRecentsView extends RecentsView<QuickstepLauncher, Launcher
public void onGestureAnimationEnd() {
DesktopVisibilityController desktopVisibilityController = null;
boolean showDesktopApps = false;
GestureState.GestureEndTarget endTarget = null;
if (DesktopTaskView.DESKTOP_MODE_SUPPORTED) {
desktopVisibilityController = mActivity.getDesktopVisibilityController();
if (mCurrentGestureEndTarget == GestureState.GestureEndTarget.LAST_TASK
endTarget = mCurrentGestureEndTarget;
if (endTarget == GestureState.GestureEndTarget.LAST_TASK
&& desktopVisibilityController.areFreeformTasksVisible()) {
// Recents gesture was cancelled and we are returning to the previous task.
// After super class has handled clean up, show desktop apps on top again
@@ -268,7 +270,7 @@ public class LauncherRecentsView extends RecentsView<QuickstepLauncher, Launcher
}
super.onGestureAnimationEnd();
if (desktopVisibilityController != null) {
desktopVisibilityController.setGestureInProgress(false);
desktopVisibilityController.setRecentsGestureEnd(endTarget);
}
if (showDesktopApps) {
SystemUiProxy.INSTANCE.get(mActivity).showDesktopApps(mActivity.getDisplayId());