diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayer.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayer.java index a9b34d2cc0..e16c76dd81 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayer.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayer.java @@ -99,7 +99,7 @@ public class TaskbarDragLayer extends BaseDragLayer { public TaskbarDragLayer(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes) { super(context, attrs, 1 /* alphaChannelCount */); - mBackgroundRenderer = new TaskbarBackgroundRenderer(mActivity); + mBackgroundRenderer = new TaskbarBackgroundRenderer(mContainer); mTaskbarBackgroundAlpha = new MultiPropertyFactory<>(this, BG_ALPHA, INDEX_COUNT, (a, b) -> a * b, 1f); @@ -108,7 +108,7 @@ public class TaskbarDragLayer extends BaseDragLayer { public void init(TaskbarDragLayerController.TaskbarDragLayerCallbacks callbacks) { mControllerCallbacks = callbacks; - mBackgroundRenderer.updateStashedHandleWidth(mActivity, getResources()); + mBackgroundRenderer.updateStashedHandleWidth(mContainer, getResources()); recreateControllers(); } @@ -269,7 +269,7 @@ public class TaskbarDragLayer extends BaseDragLayer { @Override public boolean dispatchKeyEvent(KeyEvent event) { if (event.getAction() == ACTION_UP && event.getKeyCode() == KEYCODE_BACK) { - AbstractFloatingView topView = AbstractFloatingView.getTopOpenView(mActivity); + AbstractFloatingView topView = AbstractFloatingView.getTopOpenView(mContainer); if (topView != null && topView.canHandleBack()) { topView.onBackInvoked(); // Handled by the floating view. diff --git a/quickstep/src/com/android/launcher3/taskbar/overlay/TaskbarOverlayDragLayer.java b/quickstep/src/com/android/launcher3/taskbar/overlay/TaskbarOverlayDragLayer.java index 773b0b956f..669850cb41 100644 --- a/quickstep/src/com/android/launcher3/taskbar/overlay/TaskbarOverlayDragLayer.java +++ b/quickstep/src/com/android/launcher3/taskbar/overlay/TaskbarOverlayDragLayer.java @@ -73,7 +73,7 @@ public class TaskbarOverlayDragLayer extends @Override public void recreateControllers() { List controllers = new ArrayList<>(); - controllers.add(mActivity.getDragController()); + controllers.add(mContainer.getDragController()); controllers.addAll(mTouchControllers); mControllers = controllers.toArray(new TouchController[0]); } @@ -87,7 +87,7 @@ public class TaskbarOverlayDragLayer extends @Override public boolean dispatchKeyEvent(KeyEvent event) { if (event.getAction() == ACTION_UP && event.getKeyCode() == KEYCODE_BACK) { - AbstractFloatingView topView = AbstractFloatingView.getTopOpenView(mActivity); + AbstractFloatingView topView = AbstractFloatingView.getTopOpenView(mContainer); if (topView != null && topView.canHandleBack()) { topView.onBackInvoked(); return true; @@ -96,7 +96,7 @@ public class TaskbarOverlayDragLayer extends && event.getKeyCode() == KeyEvent.KEYCODE_ESCAPE && event.hasNoModifiers()) { // Ignore escape if pressed in conjunction with any modifier keys. Close each // floating view one at a time for each key press. - AbstractFloatingView topView = AbstractFloatingView.getTopOpenView(mActivity); + AbstractFloatingView topView = AbstractFloatingView.getTopOpenView(mContainer); if (topView != null) { topView.close(/* animate= */ true); return true; @@ -107,7 +107,7 @@ public class TaskbarOverlayDragLayer extends @Override public void onComputeInternalInsets(ViewTreeObserver.InternalInsetsInfo inoutInfo) { - if (mActivity.isAnySystemDragInProgress()) { + if (mContainer.isAnySystemDragInProgress()) { inoutInfo.touchableRegion.setEmpty(); inoutInfo.setTouchableInsets(TOUCHABLE_INSETS_REGION); } @@ -123,7 +123,7 @@ public class TaskbarOverlayDragLayer extends @Override public void onViewRemoved(View child) { super.onViewRemoved(child); - mActivity.getOverlayController().maybeCloseWindow(); + mContainer.getOverlayController().maybeCloseWindow(); } /** Adds a {@link TouchController} to this drag layer. */ @@ -147,14 +147,14 @@ public class TaskbarOverlayDragLayer extends * 2) Sets tappableInsets bottom inset to 0. */ private WindowInsets updateInsetsDueToStashing(WindowInsets oldInsets) { - if (!DisplayController.isTransientTaskbar(mActivity)) { + if (!DisplayController.isTransientTaskbar(mContainer)) { return oldInsets; } WindowInsets.Builder updatedInsetsBuilder = new WindowInsets.Builder(oldInsets); Insets oldNavInsets = oldInsets.getInsets(WindowInsets.Type.navigationBars()); Insets newNavInsets = Insets.of(oldNavInsets.left, oldNavInsets.top, oldNavInsets.right, - mActivity.getStashedTaskbarHeight()); + mContainer.getStashedTaskbarHeight()); updatedInsetsBuilder.setInsets(WindowInsets.Type.navigationBars(), newNavInsets); Insets oldTappableInsets = oldInsets.getInsets(WindowInsets.Type.tappableElement()); diff --git a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java index 98ae586ff4..5082c11227 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java +++ b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java @@ -200,8 +200,6 @@ import com.android.systemui.unfold.progress.RemoteUnfoldTransitionReceiver; import com.android.systemui.unfold.updates.RotationChangeProvider; import com.android.wm.shell.shared.desktopmode.DesktopModeStatus; -import kotlin.Unit; - import java.io.FileDescriptor; import java.io.PrintWriter; import java.util.ArrayList; @@ -214,6 +212,8 @@ import java.util.function.BiConsumer; import java.util.function.Predicate; import java.util.stream.Stream; +import kotlin.Unit; + public class QuickstepLauncher extends Launcher implements RecentsViewContainer, SystemShortcut.BubbleActivityStarter { private static final boolean TRACE_LAYOUTS = @@ -271,7 +271,7 @@ public class QuickstepLauncher extends Launcher implements RecentsViewContainer, RecentsView overviewPanel = getOverviewPanel(); SystemUiProxy systemUiProxy = SystemUiProxy.INSTANCE.get(this); mSplitSelectStateController = - new SplitSelectStateController(this, mHandler, getStateManager(), + new SplitSelectStateController(this, getStateManager(), getDepthController(), getStatsLogManager(), systemUiProxy, RecentsModel.INSTANCE.get(this), () -> onStateBack()); diff --git a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java index a6d651c951..fe1d015ed5 100644 --- a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java +++ b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java @@ -45,6 +45,7 @@ import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR; import static com.android.launcher3.util.SystemUiController.UI_STATE_FULLSCREEN_TASK; import static com.android.launcher3.util.VibratorWrapper.OVERVIEW_HAPTIC; import static com.android.launcher3.util.window.RefreshRateTracker.getSingleFrameMs; +import static com.android.quickstep.BaseContainerInterface.AnimationFactory; import static com.android.quickstep.GestureState.GestureEndTarget.HOME; import static com.android.quickstep.GestureState.GestureEndTarget.LAST_TASK; import static com.android.quickstep.GestureState.GestureEndTarget.NEW_TASK; @@ -103,6 +104,7 @@ import com.android.internal.jank.Cuj; import com.android.internal.util.LatencyTracker; import com.android.launcher3.AbstractFloatingView; import com.android.launcher3.DeviceProfile; +import com.android.launcher3.Flags; import com.android.launcher3.R; import com.android.launcher3.Utilities; import com.android.launcher3.anim.AnimationSuccessListener; @@ -112,6 +114,7 @@ import com.android.launcher3.dragndrop.DragView; import com.android.launcher3.logging.StatsLogManager; import com.android.launcher3.logging.StatsLogManager.StatsLogger; import com.android.launcher3.statemanager.BaseState; +import com.android.launcher3.statemanager.StatefulContainer; import com.android.launcher3.taskbar.TaskbarThresholdUtils; import com.android.launcher3.taskbar.TaskbarUIController; import com.android.launcher3.uioverrides.QuickstepLauncher; @@ -120,9 +123,9 @@ import com.android.launcher3.util.SafeCloseable; import com.android.launcher3.util.TraceHelper; import com.android.launcher3.util.VibratorWrapper; import com.android.launcher3.util.WindowBounds; -import com.android.quickstep.BaseActivityInterface.AnimationFactory; import com.android.quickstep.GestureState.GestureEndTarget; import com.android.quickstep.RemoteTargetGluer.RemoteTargetHandle; +import com.android.quickstep.fallback.window.RecentsWindowManager; import com.android.quickstep.util.ActiveGestureErrorDetector; import com.android.quickstep.util.ActiveGestureLog; import com.android.quickstep.util.ActivityInitListener; @@ -156,8 +159,6 @@ import com.android.wm.shell.shared.TransactionPool; import com.android.wm.shell.shared.desktopmode.DesktopModeStatus; import com.android.wm.shell.shared.startingsurface.SplashScreenExitAnimationUtils; -import kotlin.Unit; - import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; @@ -167,15 +168,16 @@ import java.util.Optional; import java.util.OptionalInt; import java.util.function.Consumer; +import kotlin.Unit; + /** * Handles the navigation gestures when Launcher is the default home activity. */ public abstract class AbsSwipeUpHandler< - RECENTS_CONTAINER extends Context & RecentsViewContainer, - RECENTS_VIEW extends RecentsView, - STATE extends BaseState> - extends SwipeUpAnimationLogic - implements OnApplyWindowInsetsListener, RecentsAnimationCallbacks.RecentsAnimationListener { + RECENTS_CONTAINER extends Context & RecentsViewContainer & StatefulContainer, + RECENTS_VIEW extends RecentsView, STATE extends BaseState> + extends SwipeUpAnimationLogic implements OnApplyWindowInsetsListener, + RecentsAnimationCallbacks.RecentsAnimationListener { private static final String TAG = "AbsSwipeUpHandler"; private static final ArrayList STATE_NAMES = new ArrayList<>(); @@ -292,7 +294,7 @@ public abstract class AbsSwipeUpHandler< private static final int LOG_NO_OP_PAGE_INDEX = -1; protected final TaskAnimationManager mTaskAnimationManager; - + protected final RecentsWindowManager mRecentsWindowManager; // Either RectFSpringAnim (if animating home) or ObjectAnimator (from mCurrentShift) otherwise private RunningWindowAnim[] mRunningWindowAnim; // Possible second animation running at the same time as mRunningWindowAnim @@ -353,9 +355,12 @@ public abstract class AbsSwipeUpHandler< public AbsSwipeUpHandler(Context context, RecentsAnimationDeviceState deviceState, TaskAnimationManager taskAnimationManager, GestureState gestureState, long touchTimeMs, boolean continuingLastGesture, - InputConsumerController inputConsumer) { + InputConsumerController inputConsumer, RecentsWindowManager recentsWindowManager) { super(context, deviceState, gestureState); mContainerInterface = gestureState.getContainerInterface(); + if (recentsWindowManager != null && Flags.enableFallbackOverviewInWindow()) { + recentsWindowManager.registerInitListener(this::onActivityInit); + } mActivityInitListener = mContainerInterface.createActivityInitListener(this::onActivityInit); mInputConsumerProxy = @@ -369,6 +374,7 @@ public abstract class AbsSwipeUpHandler< endLauncherTransitionController(); }, new InputProxyHandlerFactory(mContainerInterface, mGestureState)); mTaskAnimationManager = taskAnimationManager; + mRecentsWindowManager = recentsWindowManager; mTouchTimeMs = touchTimeMs; mContinuingLastGesture = continuingLastGesture; @@ -819,7 +825,7 @@ public abstract class AbsSwipeUpHandler< return; } initTransitionEndpoints(mContainer.getDeviceProfile()); - mAnimationFactory.createActivityInterface(mTransitionDragLength); + mAnimationFactory.createContainerInterface(mTransitionDragLength); } /** @@ -863,10 +869,13 @@ public abstract class AbsSwipeUpHandler< } } + public Intent getHomeIntent() { + return mGestureState.getHomeIntent(); + } + public Intent getLaunchIntent() { return mGestureState.getOverviewIntent(); } - /** * Called when the value of {@link #mCurrentShift} changes */ diff --git a/quickstep/src/com/android/quickstep/BaseActivityInterface.java b/quickstep/src/com/android/quickstep/BaseActivityInterface.java index 87038439bf..1e755eb220 100644 --- a/quickstep/src/com/android/quickstep/BaseActivityInterface.java +++ b/quickstep/src/com/android/quickstep/BaseActivityInterface.java @@ -36,7 +36,6 @@ import android.animation.AnimatorSet; import android.view.MotionEvent; import androidx.annotation.Nullable; -import androidx.annotation.UiThread; import com.android.launcher3.anim.AnimatorPlaybackController; import com.android.launcher3.anim.PendingAnimation; @@ -62,17 +61,14 @@ import java.util.function.Consumer; public abstract class BaseActivityInterface, ACTIVITY_TYPE extends StatefulActivity & RecentsViewContainer> extends BaseContainerInterface { - private final STATE_TYPE mBackgroundState; private STATE_TYPE mTargetState; - @Nullable private Runnable mOnInitBackgroundStateUICallback = null; - protected BaseActivityInterface(boolean rotationSupportedByActivity, STATE_TYPE overviewState, STATE_TYPE backgroundState) { + super(backgroundState); this.rotationSupportedByActivity = rotationSupportedByActivity; mTargetState = overviewState; - mBackgroundState = backgroundState; } /** @@ -124,13 +120,6 @@ public abstract class BaseActivityInterface T getVisibleRecentsView(); - - @UiThread - public abstract boolean switchToRecentsIfVisible(Animator.AnimatorListener animatorListener); - public boolean deferStartingActivity(RecentsAnimationDeviceState deviceState, MotionEvent ev) { TaskbarUIController controller = getTaskbarController(); boolean isEventOverBubbleBarStashHandle = @@ -163,49 +152,6 @@ public abstract class BaseActivityInterface