Merge "Refactor BaseContainerInterface and subclasses to better support 3P and Recents in window" into main

This commit is contained in:
Schneider Victor-tulias authored and Android (Google) Code Review committed 2025-05-28 06:16:14 -07:00
commit 501df2edca
8 files changed
+29 -64

No files matched your search

@@ -362,15 +362,6 @@ public class LauncherTaskbarUIController extends TaskbarUIController {
mTaskbarLauncherStateController.applyState();
}
public boolean isDraggingItem() {
boolean bubblesDragging = false;
if (mControllers.bubbleControllers.isPresent()) {
bubblesDragging =
mControllers.bubbleControllers.get().bubbleDragController.isDragging();
}
return mControllers.taskbarDragController.isDragging() || bubblesDragging;
}
@Override
protected void onStashedInAppChanged() {
onStashedInAppChanged(mLauncher.getDeviceProfile());
@@ -234,6 +234,15 @@ public class TaskbarUIController implements BubbleBarController.BubbleBarLocatio
}
}
public boolean isDraggingItem() {
boolean bubblesDragging = false;
if (mControllers.bubbleControllers.isPresent()) {
bubblesDragging =
mControllers.bubbleControllers.get().bubbleDragController.isDragging();
}
return mControllers.taskbarDragController.isDragging() || bubblesDragging;
}
@CallSuper
protected void dumpLogs(String prefix, PrintWriter pw) {
pw.println(String.format(
@@ -18,7 +18,6 @@ package com.android.quickstep;
import static com.android.app.animation.Interpolators.ACCELERATE_2;
import static com.android.app.animation.Interpolators.INSTANT;
import static com.android.app.animation.Interpolators.LINEAR;
import static com.android.launcher3.MotionEventsUtils.isTrackpadMultiFingerSwipe;
import static com.android.quickstep.AbsSwipeUpHandler.RECENTS_ATTACH_DURATION;
import static com.android.quickstep.util.RecentsAtomicAnimationFactory.INDEX_RECENTS_ATTACHED_ALPHA_ANIM;
import static com.android.quickstep.util.RecentsAtomicAnimationFactory.INDEX_RECENTS_FADE_ANIM;
@@ -32,7 +31,6 @@ import static com.android.quickstep.views.RecentsView.TASK_SECONDARY_TRANSLATION
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.view.MotionEvent;
import androidx.annotation.Nullable;
@@ -87,14 +85,6 @@ public abstract class BaseActivityInterface<STATE_TYPE extends BaseState<STATE_T
return activity != null && activity.isStarted();
}
public boolean deferStartingActivity(RecentsAnimationDeviceState deviceState, MotionEvent ev) {
TaskbarUIController controller = getTaskbarController();
boolean isEventOverBubbleBarStashHandle =
controller != null && controller.isEventOverBubbleBarViews(ev);
return deviceState.isInDeferredGestureRegion(ev) || deviceState.isImeRenderingNavButtons()
|| isTrackpadMultiFingerSwipe(ev) || isEventOverBubbleBarStashHandle;
}
/**
* Closes any overlays.
*/
@@ -18,6 +18,7 @@ package com.android.quickstep;
import static com.android.app.animation.Interpolators.INSTANT;
import static com.android.app.animation.Interpolators.LINEAR;
import static com.android.launcher3.LauncherAnimUtils.VIEW_BACKGROUND_COLOR;
import static com.android.launcher3.MotionEventsUtils.isTrackpadMultiFingerSwipe;
import static com.android.launcher3.util.OverviewReleaseFlags.enableGridOnlyOverview;
import static com.android.quickstep.GestureState.GestureEndTarget.LAST_TASK;
import static com.android.quickstep.GestureState.GestureEndTarget.RECENTS;
@@ -34,6 +35,7 @@ import android.view.MotionEvent;
import android.view.RemoteAnimationTarget;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.UiThread;
@@ -88,8 +90,19 @@ public abstract class BaseContainerInterface<STATE_TYPE extends BaseState<STATE_
public abstract boolean isResumed();
public abstract boolean isStarted();
public abstract boolean deferStartingActivity(RecentsAnimationDeviceState deviceState,
MotionEvent ev);
public boolean deferStartingActivity(
@NonNull RecentsAnimationDeviceState deviceState, MotionEvent ev) {
TaskbarUIController controller = getTaskbarController();
boolean isEventOverBubbleBarStashHandle =
controller != null && controller.isEventOverBubbleBarViews(ev);
boolean isEventOverAnyTaskbarItem =
controller != null && controller.isEventOverAnyTaskbarItem(ev);
return deviceState.isInDeferredGestureRegion(ev)
|| deviceState.isImeRenderingNavButtons()
|| isTrackpadMultiFingerSwipe(ev)
|| isEventOverBubbleBarStashHandle
|| isEventOverAnyTaskbarItem;
}
/**
* Returns the color of the scrim behind overview when at rest in this state.
@@ -171,7 +184,8 @@ public abstract class BaseContainerInterface<STATE_TYPE extends BaseState<STATE_
* @return Whether the gesture in progress should be cancelled.
*/
public boolean shouldCancelCurrentGesture() {
return false;
TaskbarUIController uiController = getTaskbarController();
return uiController != null && uiController.isDraggingItem();
}
public void runOnInitBackgroundStateUI(Runnable callback) {
@@ -18,7 +18,6 @@ package com.android.quickstep;
import static com.android.app.animation.Interpolators.ACCELERATE_2;
import static com.android.app.animation.Interpolators.INSTANT;
import static com.android.app.animation.Interpolators.LINEAR;
import static com.android.launcher3.MotionEventsUtils.isTrackpadMultiFingerSwipe;
import static com.android.quickstep.AbsSwipeUpHandler.RECENTS_ATTACH_DURATION;
import static com.android.quickstep.util.RecentsAtomicAnimationFactory.INDEX_RECENTS_FADE_ANIM;
import static com.android.quickstep.util.RecentsAtomicAnimationFactory.INDEX_RECENTS_TRANSLATE_X_ANIM;
@@ -30,7 +29,6 @@ import static com.android.quickstep.views.RecentsView.TASK_SECONDARY_TRANSLATION
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.view.MotionEvent;
import androidx.annotation.Nullable;
@@ -85,14 +83,6 @@ public abstract class BaseWindowInterface extends
return windowManager != null && windowManager.isStarted();
}
public boolean deferStartingActivity(RecentsAnimationDeviceState deviceState, MotionEvent ev) {
TaskbarUIController controller = getTaskbarController();
boolean isEventOverBubbleBarStashHandle =
controller != null && controller.isEventOverBubbleBarViews(ev);
return deviceState.isInDeferredGestureRegion(ev) || deviceState.isImeRenderingNavButtons()
|| isTrackpadMultiFingerSwipe(ev) || isEventOverBubbleBarStashHandle;
}
/**
* Closes any overlays.
*/
@@ -27,6 +27,7 @@ import android.graphics.Rect;
import android.view.MotionEvent;
import android.view.RemoteAnimationTarget;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.android.launcher3.DeviceProfile;
@@ -133,7 +134,8 @@ public final class FallbackActivityInterface extends
}
@Override
public boolean deferStartingActivity(RecentsAnimationDeviceState deviceState, MotionEvent ev) {
public boolean deferStartingActivity(
@NonNull RecentsAnimationDeviceState deviceState, MotionEvent ev) {
// In non-gesture mode, user might be clicking on the home button which would directly
// start the home activity instead of going through recents. In that case, defer starting
// recents until we are sure it is a gesture.
@@ -24,7 +24,6 @@ import android.animation.Animator;
import android.animation.AnimatorSet;
import android.content.Context;
import android.graphics.Rect;
import android.view.MotionEvent;
import android.view.RemoteAnimationTarget;
import androidx.annotation.Nullable;
@@ -149,16 +148,6 @@ public final class FallbackWindowInterface extends BaseWindowInterface {
return state.getScrimColor(container.asContext());
}
@Override
public boolean deferStartingActivity(RecentsAnimationDeviceState deviceState, MotionEvent ev) {
// In non-gesture mode, user might be clicking on the home button which would directly
// start the home activity instead of going through recents. In that case, defer starting
// recents until we are sure it is a gesture.
return false;
// return !deviceState.isFullyGesturalNavMode();
// || super.deferStartingActivity(deviceState, ev);
}
@Override
public void onExitOverview(Runnable exitRunnable) {
RecentsWindowManager windowManager = getCreatedContainer();
@@ -27,7 +27,6 @@ import android.animation.Animator;
import android.animation.AnimatorSet;
import android.content.Context;
import android.graphics.Rect;
import android.view.MotionEvent;
import android.view.RemoteAnimationTarget;
import androidx.annotation.Nullable;
@@ -331,25 +330,6 @@ public final class LauncherActivityInterface extends
return state.getWorkspaceScrimColor(activity);
}
@Override
public boolean deferStartingActivity(RecentsAnimationDeviceState deviceState, MotionEvent ev) {
LauncherTaskbarUIController uiController = getTaskbarController();
if (uiController == null) {
return super.deferStartingActivity(deviceState, ev);
}
return uiController.isEventOverAnyTaskbarItem(ev)
|| super.deferStartingActivity(deviceState, ev);
}
@Override
public boolean shouldCancelCurrentGesture() {
LauncherTaskbarUIController uiController = getTaskbarController();
if (uiController == null) {
return super.shouldCancelCurrentGesture();
}
return uiController.isDraggingItem();
}
@Override
public LauncherState stateFromGestureEndTarget(GestureEndTarget endTarget) {
switch (endTarget) {