diff options
Diffstat (limited to 'quickstep/src')
20 files changed, 254 insertions, 101 deletions
diff --git a/quickstep/src/com/android/launcher3/taskbar/FallbackTaskbarUIController.java b/quickstep/src/com/android/launcher3/taskbar/FallbackTaskbarUIController.java index d6327bc3cd..7d82fc4f3e 100644 --- a/quickstep/src/com/android/launcher3/taskbar/FallbackTaskbarUIController.java +++ b/quickstep/src/com/android/launcher3/taskbar/FallbackTaskbarUIController.java @@ -26,11 +26,15 @@ import androidx.annotation.Nullable; import com.android.launcher3.popup.SystemShortcut; import com.android.launcher3.statemanager.StateManager; import com.android.launcher3.statemanager.StatefulContainer; +import com.android.quickstep.FallbackActivityInterface; +import com.android.quickstep.GestureState; +import com.android.quickstep.RecentsAnimationCallbacks; import com.android.quickstep.TopTaskTracker; import com.android.quickstep.fallback.RecentsState; import com.android.quickstep.views.RecentsView; import com.android.quickstep.views.RecentsViewContainer; +import java.io.PrintWriter; import java.util.stream.Stream; /** @@ -92,11 +96,19 @@ public class FallbackTaskbarUIController mRecentsContainer.getStateManager().removeStateListener(mStateListener); } + @Nullable + @Override + public Animator getParallelAnimationToGestureEndTarget(GestureState.GestureEndTarget endTarget, + long duration, RecentsAnimationCallbacks callbacks) { + return createAnimToRecentsState( + FallbackActivityInterface.INSTANCE.stateFromGestureEndTarget(endTarget), duration); + } + /** * Creates an animation to animate the taskbar for the given state (but does not start it). * Currently this animation just force stashes the taskbar in Overview. */ - public Animator createAnimToRecentsState(RecentsState toState, long duration) { + private Animator createAnimToRecentsState(RecentsState toState, long duration) { // Force stash taskbar (disallow unstashing) when: // - in a 3P launcher or overview task. // - not running in a test harness (unstash is needed for tests) @@ -142,4 +154,12 @@ public class FallbackTaskbarUIController protected String getTaskbarUIControllerName() { return "FallbackTaskbarUIController<" + mRecentsContainer.getClass().getSimpleName() + ">"; } + + @Override + protected void dumpLogs(String prefix, PrintWriter pw) { + super.dumpLogs(prefix, pw); + + pw.println(String.format("%s\tRecentsState=%s", prefix, + mRecentsContainer.getStateManager().getState())); + } } diff --git a/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java b/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java index 913035ae21..51a42049cc 100644 --- a/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java +++ b/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java @@ -48,11 +48,16 @@ import com.android.launcher3.uioverrides.QuickstepLauncher; import com.android.launcher3.util.DisplayController; import com.android.launcher3.util.MultiPropertyFactory; import com.android.launcher3.util.OnboardingPrefs; +import com.android.quickstep.GestureState; import com.android.quickstep.HomeVisibilityState; +import com.android.quickstep.LauncherActivityInterface; import com.android.quickstep.RecentsAnimationCallbacks; import com.android.quickstep.SystemUiProxy; +import com.android.quickstep.fallback.window.RecentsDisplayModel; +import com.android.quickstep.fallback.window.RecentsWindowFlags; import com.android.quickstep.util.SplitTask; import com.android.quickstep.views.RecentsView; +import com.android.quickstep.views.RecentsViewContainer; import com.android.systemui.shared.system.QuickStepContract.SystemUiStateFlags; import com.android.wm.shell.shared.bubbles.BubbleBarLocation; import com.android.wm.shell.shared.desktopmode.DesktopModeStatus; @@ -100,6 +105,8 @@ public class LauncherTaskbarUIController extends TaskbarUIController { // Initialized in init. private final TaskbarLauncherStateController mTaskbarLauncherStateController = new TaskbarLauncherStateController(); + // When overview-in-a-window is enabled, that window is the container, else it is mLauncher. + private RecentsViewContainer mRecentsViewContainer; public LauncherTaskbarUIController(QuickstepLauncher launcher) { mLauncher = launcher; @@ -112,8 +119,19 @@ public class LauncherTaskbarUIController extends TaskbarUIController { mTaskbarLauncherStateController.init(mControllers, mLauncher, mControllers.getSharedState().sysuiStateFlags); - + final TaskbarActivityContext taskbarContext = mControllers.taskbarActivityContext; + if (RecentsWindowFlags.getEnableOverviewInWindow()) { + mRecentsViewContainer = RecentsDisplayModel.getINSTANCE() + .get(taskbarContext).getRecentsWindowManager(taskbarContext.getDisplayId()); + } + if (mRecentsViewContainer == null) { + mRecentsViewContainer = mLauncher; + } mLauncher.setTaskbarUIController(this); + if (mRecentsViewContainer != mLauncher) { + mRecentsViewContainer.setTaskbarUIController(this); + } + mHomeState.addListener(mVisibilityChangeListener); onLauncherVisibilityChanged( Flags.useActivityOverlay() @@ -142,6 +160,9 @@ public class LauncherTaskbarUIController extends TaskbarUIController { mTaskbarLauncherStateController.onDestroy(); mLauncher.setTaskbarUIController(null); + if (mRecentsViewContainer != mLauncher) { + mRecentsViewContainer.setTaskbarUIController(null); + } mHomeState.removeListener(mVisibilityChangeListener); } @@ -239,7 +260,7 @@ public class LauncherTaskbarUIController extends TaskbarUIController { // Launcher is resumed during the swipe-to-overview gesture under shell-transitions, so // avoid updating taskbar state in that situation (when it's non-interactive -- or // "background") to avoid premature animations. - LauncherState state = mLauncher.getStateManager().getState(); + LauncherState state = mTaskbarLauncherStateController.getLauncherState(); boolean nonInteractiveState = state.hasFlag(FLAG_NON_INTERACTIVE) && !state.isTaskbarAlignedWithHotseat(mLauncher); if (isVisible && (nonInteractiveState || mSkipLauncherVisibilityChange)) { @@ -295,13 +316,16 @@ public class LauncherTaskbarUIController extends TaskbarUIController { /** * Create Taskbar animation when going from an app to Launcher as part of recents transition. - * @param toState If known, the state we will end up in when reaching Launcher. - * @param callbacks callbacks to track the recents animation lifecycle. The state change is - * automatically reset once the recents animation finishes + * {@inheritDoc} */ - public Animator createAnimToLauncher(@NonNull LauncherState toState, - @NonNull RecentsAnimationCallbacks callbacks, long duration) { - return mTaskbarLauncherStateController.createAnimToLauncher(toState, callbacks, duration); + @Override + public Animator getParallelAnimationToGestureEndTarget( + GestureState.GestureEndTarget gestureEndTarget, long duration, + RecentsAnimationCallbacks callbacks) { + return mTaskbarLauncherStateController.createAnimToLauncher( + LauncherActivityInterface.INSTANCE.stateFromGestureEndTarget(gestureEndTarget), + callbacks, + duration); } /** @@ -508,7 +532,7 @@ public class LauncherTaskbarUIController extends TaskbarUIController { @Override public RecentsView getRecentsView() { - return mLauncher.getOverviewPanel(); + return mRecentsViewContainer.getOverviewPanel(); } @Override @@ -537,6 +561,7 @@ public class LauncherTaskbarUIController extends TaskbarUIController { "WIDGETS_PAGE_PROGRESS_INDEX", "SYSUI_SURFACE_PROGRESS_INDEX", "LAUNCHER_PAUSE_PROGRESS_INDEX"); + pw.println(String.format("%s\tmRecentsWindowContainer=%s", prefix, mRecentsViewContainer)); mTaskbarLauncherStateController.dumpLogs(prefix + "\t", pw); } diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java index 66887d0bfc..fc93d4a0ab 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java @@ -1593,8 +1593,7 @@ public class TaskbarActivityContext extends BaseTaskbarContext { } else if (tag instanceof AppInfo) { // Tapping an item in AllApps AppInfo info = (AppInfo) tag; - if (recents != null - && taskbarUIController.getRecentsView().isSplitSelectionActive()) { + if (recents != null && recents.isSplitSelectionActive()) { // If we are selecting a second app for split, launch the split tasks taskbarUIController.triggerSecondAppForSplit(info, info.intent, view); } else { diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java index 98415d1a71..77c3e0a41c 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java @@ -33,6 +33,7 @@ import static com.android.launcher3.taskbar.bubbles.BubbleBarView.FADE_IN_ANIM_A import static com.android.launcher3.taskbar.bubbles.BubbleBarView.FADE_OUT_ANIM_POSITION_DURATION_MS; import static com.android.launcher3.util.FlagDebugUtils.appendFlag; import static com.android.launcher3.util.FlagDebugUtils.formatFlagChange; +import static com.android.quickstep.fallback.RecentsStateUtilsKt.toLauncherState; import static com.android.quickstep.util.SystemUiFlagUtils.isTaskbarHidden; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_AWAKE; @@ -63,6 +64,10 @@ import com.android.launcher3.uioverrides.QuickstepLauncher; import com.android.launcher3.util.MultiPropertyFactory.MultiProperty; import com.android.quickstep.RecentsAnimationCallbacks; import com.android.quickstep.RecentsAnimationController; +import com.android.quickstep.fallback.RecentsState; +import com.android.quickstep.fallback.window.RecentsDisplayModel; +import com.android.quickstep.fallback.window.RecentsWindowFlags; +import com.android.quickstep.fallback.window.RecentsWindowManager; import com.android.quickstep.util.ScalingWorkspaceRevealAnim; import com.android.quickstep.util.SystemUiFlagUtils; import com.android.quickstep.views.RecentsView; @@ -74,6 +79,7 @@ import com.android.wm.shell.shared.bubbles.BubbleBarLocation; import java.io.PrintWriter; import java.util.HashMap; import java.util.StringJoiner; +import java.util.function.Consumer; /** * Track LauncherState, RecentsAnimation, resumed state for task bar in one place here and animate @@ -209,7 +215,7 @@ public class TaskbarLauncherStateController { }; private final StateManager.StateListener<LauncherState> mStateListener = - new StateManager.StateListener<LauncherState>() { + new StateManager.StateListener<>() { @Override public void onStateTransitionStart(LauncherState toState) { @@ -243,6 +249,20 @@ public class TaskbarLauncherStateController { } }; + private final StateManager.StateListener<RecentsState> mRecentsStateListener = + new StateManager.StateListener<>() { + + @Override + public void onStateTransitionStart(RecentsState toState) { + mStateListener.onStateTransitionStart(toLauncherState(toState)); + } + + @Override + public void onStateTransitionComplete(RecentsState finalState) { + mStateListener.onStateTransitionComplete(toLauncherState(finalState)); + } + }; + /** * Callback for when launcher state transition completes after user swipes to home. * @param finalState The final state of the transition. @@ -278,6 +298,8 @@ public class TaskbarLauncherStateController { if (!mControllers.taskbarActivityContext.isPhoneMode()) { mLauncher.getStateManager().addStateListener(mStateListener); + runForRecentsWindowManager(recentsWindowManager -> + recentsWindowManager.getStateManager().addStateListener(mRecentsStateListener)); } mLauncherState = launcher.getStateManager().getState(); updateStateForSysuiFlags(sysuiStateFlags, /*applyState*/ false); @@ -302,6 +324,8 @@ public class TaskbarLauncherStateController { mLauncher.getHotseat().setIconsAlpha(1f, ALPHA_CHANNEL_TASKBAR_ALIGNMENT); mLauncher.getStateManager().removeStateListener(mStateListener); + runForRecentsWindowManager(recentsWindowManager -> + recentsWindowManager.getStateManager().removeStateListener(mRecentsStateListener)); mCanSyncViews = !mControllers.taskbarActivityContext.isPhoneMode(); mLauncher.removeOnDeviceProfileChangeListener(mOnDeviceProfileChangeListener); @@ -340,12 +364,15 @@ public class TaskbarLauncherStateController { } mTaskBarRecentsAnimationListener = new TaskBarRecentsAnimationListener(callbacks); callbacks.addListener(mTaskBarRecentsAnimationListener); - ((RecentsView) mLauncher.getOverviewPanel()).setTaskLaunchListener(() -> - mTaskBarRecentsAnimationListener.endGestureStateOverride(true, false /*canceled*/)); + RecentsView recentsView = mControllers.uiController.getRecentsView(); + if (recentsView != null) { + recentsView.setTaskLaunchListener(() -> mTaskBarRecentsAnimationListener + .endGestureStateOverride(true, false /*canceled*/)); + recentsView.setTaskLaunchCancelledRunnable(() -> { + updateStateForUserFinishedToApp(false /* finishedToApp */); + }); + } - ((RecentsView) mLauncher.getOverviewPanel()).setTaskLaunchCancelledRunnable(() -> { - updateStateForUserFinishedToApp(false /* finishedToApp */); - }); return animatorSet; } @@ -823,6 +850,15 @@ public class TaskbarLauncherStateController { return mLauncherState.isRecentsViewVisible; } + /** + * Returns the current mLauncherState. Note that this could represent RecentsState as well, as + * we convert those to equivalent LauncherStates even if Launcher Activity is not actually in + * those states (for the case where the state is represented in a separate Window instead). + */ + public LauncherState getLauncherState() { + return mLauncherState; + } + private void playStateTransitionAnim(AnimatorSet animatorSet, long duration, boolean committed) { boolean isInStashedState = mLauncherState.isTaskbarStashed(mLauncher); @@ -1060,7 +1096,10 @@ public class TaskbarLauncherStateController { boolean canceled) { mCallbacks.removeListener(this); mTaskBarRecentsAnimationListener = null; - ((RecentsView) mLauncher.getOverviewPanel()).setTaskLaunchListener(null); + RecentsView recentsView = mControllers.uiController.getRecentsView(); + if (recentsView != null) { + recentsView.setTaskLaunchListener(null); + } if (mSkipNextRecentsAnimEnd && !canceled) { mSkipNextRecentsAnimEnd = false; @@ -1099,6 +1138,20 @@ public class TaskbarLauncherStateController { controller.applyState(); } + /** + * Helper function to run a callback on the RecentsWindowManager (if it exists). + */ + private void runForRecentsWindowManager(Consumer<RecentsWindowManager> callback) { + if (RecentsWindowFlags.getEnableOverviewInWindow()) { + final TaskbarActivityContext taskbarContext = mControllers.taskbarActivityContext; + RecentsWindowManager recentsWindowManager = RecentsDisplayModel.getINSTANCE() + .get(taskbarContext).getRecentsWindowManager(taskbarContext.getDisplayId()); + if (recentsWindowManager != null) { + callback.accept(recentsWindowManager); + } + } + } + private static String getStateString(int flags) { StringJoiner result = new StringJoiner("|"); appendFlag(result, flags, FLAG_VISIBLE, "flag_visible"); diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java index 1521715ce0..c3bc7d9ac8 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java @@ -697,7 +697,9 @@ public class TaskbarManager { private TaskbarUIController createTaskbarUIControllerForRecentsViewContainer( RecentsViewContainer container) { debugPrimaryTaskbar("createTaskbarUIControllerForRecentsViewContainer"); - if (container instanceof QuickstepLauncher quickstepLauncher) { + if (mActivity instanceof QuickstepLauncher quickstepLauncher) { + // If 1P Launcher is default, always use LauncherTaskbarUIController, regardless of + // whether the recents container is NexusLauncherActivity or RecentsWindowManager. return new LauncherTaskbarUIController(quickstepLauncher); } // If a 3P Launcher is default, always use FallbackTaskbarUIController regardless of diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarUIController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarUIController.java index 061a5a127e..b567871b92 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarUIController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarUIController.java @@ -21,6 +21,7 @@ import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_HOTSEAT import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_HOTSEAT_PREDICTION; import static com.android.launcher3.taskbar.TaskbarStashController.FLAG_IN_APP; +import android.animation.Animator; import android.content.Intent; import android.graphics.drawable.BitmapDrawable; import android.view.MotionEvent; @@ -38,6 +39,8 @@ import com.android.launcher3.model.data.ItemInfoWithIcon; import com.android.launcher3.popup.SystemShortcut; import com.android.launcher3.taskbar.bubbles.BubbleBarController; import com.android.launcher3.util.SplitConfigurationOptions; +import com.android.quickstep.GestureState; +import com.android.quickstep.RecentsAnimationCallbacks; import com.android.quickstep.util.SplitTask; import com.android.quickstep.views.RecentsView; import com.android.quickstep.views.TaskContainer; @@ -455,4 +458,18 @@ public class TaskbarUIController implements BubbleBarController.BubbleBarLocatio */ public void onSwipeToUnstashTaskbar() { } + + /** + * Called at the end of a gesture (see {@link GestureState.GestureEndTarget}). + * @param endTarget Where the gesture animation is going to. + * @param callbacks callbacks to track the recents animation lifecycle. The state change is + * automatically reset once the recents animation finishes + * @return An optional Animator to play in parallel with the default gesture end animation. + */ + public @Nullable Animator getParallelAnimationToGestureEndTarget( + GestureState.GestureEndTarget endTarget, + long duration, + RecentsAnimationCallbacks callbacks) { + return null; + } } diff --git a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java index 168b856b25..47aa1de646 100644 --- a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java +++ b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java @@ -1614,7 +1614,7 @@ public abstract class AbsSwipeUpHandler< TaskStackChangeListeners.getInstance().registerTaskStackListener( mActivityRestartListener); - mParallelRunningAnim = mContainerInterface.getParallelAnimationToLauncher( + mParallelRunningAnim = mContainerInterface.getParallelAnimationToGestureEndTarget( mGestureState.getEndTarget(), duration, mTaskAnimationManager.getCurrentCallbacks()); if (mParallelRunningAnim != null) { diff --git a/quickstep/src/com/android/quickstep/BaseContainerInterface.java b/quickstep/src/com/android/quickstep/BaseContainerInterface.java index c64067aa58..244dfc3971 100644 --- a/quickstep/src/com/android/quickstep/BaseContainerInterface.java +++ b/quickstep/src/com/android/quickstep/BaseContainerInterface.java @@ -182,7 +182,7 @@ public abstract class BaseContainerInterface<STATE_TYPE extends BaseState<STATE_ * Called when the gesture ends and the animation starts towards the given target. Used to add * an optional additional animation with the same duration. */ - public @Nullable Animator getParallelAnimationToLauncher( + public @Nullable Animator getParallelAnimationToGestureEndTarget( GestureState.GestureEndTarget endTarget, long duration, RecentsAnimationCallbacks callbacks) { if (endTarget == RECENTS) { diff --git a/quickstep/src/com/android/quickstep/FallbackActivityInterface.java b/quickstep/src/com/android/quickstep/FallbackActivityInterface.java index d8e0296a68..7654471555 100644 --- a/quickstep/src/com/android/quickstep/FallbackActivityInterface.java +++ b/quickstep/src/com/android/quickstep/FallbackActivityInterface.java @@ -203,16 +203,16 @@ public final class FallbackActivityInterface extends } @Override - public @Nullable Animator getParallelAnimationToLauncher(GestureEndTarget endTarget, + public @Nullable Animator getParallelAnimationToGestureEndTarget(GestureEndTarget endTarget, long duration, RecentsAnimationCallbacks callbacks) { FallbackTaskbarUIController uiController = getTaskbarController(); - Animator superAnimator = super.getParallelAnimationToLauncher( + Animator superAnimator = super.getParallelAnimationToGestureEndTarget( endTarget, duration, callbacks); if (uiController == null) { return superAnimator; } - RecentsState toState = stateFromGestureEndTarget(endTarget); - Animator taskbarAnimator = uiController.createAnimToRecentsState(toState, duration); + Animator taskbarAnimator = uiController.getParallelAnimationToGestureEndTarget( + endTarget, duration, callbacks); if (taskbarAnimator == null) { return superAnimator; } diff --git a/quickstep/src/com/android/quickstep/FallbackWindowInterface.java b/quickstep/src/com/android/quickstep/FallbackWindowInterface.java index 35630ef57f..503f047e4f 100644 --- a/quickstep/src/com/android/quickstep/FallbackWindowInterface.java +++ b/quickstep/src/com/android/quickstep/FallbackWindowInterface.java @@ -31,7 +31,7 @@ import androidx.annotation.Nullable; import com.android.launcher3.DeviceProfile; import com.android.launcher3.statemanager.StateManager; -import com.android.launcher3.taskbar.FallbackTaskbarUIController; +import com.android.launcher3.taskbar.TaskbarUIController; import com.android.launcher3.util.DisplayController; import com.android.quickstep.GestureState.GestureEndTarget; import com.android.quickstep.fallback.RecentsState; @@ -104,14 +104,9 @@ public final class FallbackWindowInterface extends BaseWindowInterface{ } @Override - public FallbackTaskbarUIController getTaskbarController() { + public TaskbarUIController getTaskbarController() { RecentsWindowManager manager = getCreatedContainer(); - if (manager == null) { - return null; - } - return null; - // todo b/365775636: pass a taskbar implementation - // return manager.getTaskbarUIController(); + return manager == null ? null : manager.getTaskbarUIController(); } @Override @@ -213,16 +208,16 @@ public final class FallbackWindowInterface extends BaseWindowInterface{ } @Override - public @Nullable Animator getParallelAnimationToLauncher(GestureEndTarget endTarget, + public @Nullable Animator getParallelAnimationToGestureEndTarget(GestureEndTarget endTarget, long duration, RecentsAnimationCallbacks callbacks) { - FallbackTaskbarUIController uiController = getTaskbarController(); - Animator superAnimator = super.getParallelAnimationToLauncher( + TaskbarUIController uiController = getTaskbarController(); + Animator superAnimator = super.getParallelAnimationToGestureEndTarget( endTarget, duration, callbacks); if (uiController == null) { return superAnimator; } - RecentsState toState = stateFromGestureEndTarget(endTarget); - Animator taskbarAnimator = uiController.createAnimToRecentsState(toState, duration); + Animator taskbarAnimator = uiController.getParallelAnimationToGestureEndTarget( + endTarget, duration, callbacks); if (taskbarAnimator == null) { return superAnimator; } diff --git a/quickstep/src/com/android/quickstep/InputConsumerUtils.kt b/quickstep/src/com/android/quickstep/InputConsumerUtils.kt index c8ca5344c2..89b5b291c6 100644 --- a/quickstep/src/com/android/quickstep/InputConsumerUtils.kt +++ b/quickstep/src/com/android/quickstep/InputConsumerUtils.kt @@ -550,7 +550,7 @@ object InputConsumerUtils { (com.android.launcher3.Flags.useActivityOverlay() && runningTask != null && runningTask.isHomeTask && - overviewComponentObserver.isHomeAndOverviewSame && + overviewComponentObserver.isHomeAndOverviewSameActivity && !launcherResumedThroughShellTransition && !previousGestureState.isRecentsAnimationRunning) diff --git a/quickstep/src/com/android/quickstep/LauncherActivityInterface.java b/quickstep/src/com/android/quickstep/LauncherActivityInterface.java index ac0aa76ad5..faaade9fcc 100644 --- a/quickstep/src/com/android/quickstep/LauncherActivityInterface.java +++ b/quickstep/src/com/android/quickstep/LauncherActivityInterface.java @@ -298,16 +298,16 @@ public final class LauncherActivityInterface extends } @Override - public @Nullable Animator getParallelAnimationToLauncher(GestureEndTarget endTarget, + public @Nullable Animator getParallelAnimationToGestureEndTarget(GestureEndTarget endTarget, long duration, RecentsAnimationCallbacks callbacks) { LauncherTaskbarUIController uiController = getTaskbarController(); - Animator superAnimator = super.getParallelAnimationToLauncher( + Animator superAnimator = super.getParallelAnimationToGestureEndTarget( endTarget, duration, callbacks); if (uiController == null || callbacks == null) { return superAnimator; } - LauncherState toState = stateFromGestureEndTarget(endTarget); - Animator taskbarAnimator = uiController.createAnimToLauncher(toState, callbacks, duration); + Animator taskbarAnimator = uiController.getParallelAnimationToGestureEndTarget(endTarget, + duration, callbacks); if (superAnimator == null) { return taskbarAnimator; } else { diff --git a/quickstep/src/com/android/quickstep/OverviewCommandHelper.kt b/quickstep/src/com/android/quickstep/OverviewCommandHelper.kt index 8b7603c329..8b9a3daea8 100644 --- a/quickstep/src/com/android/quickstep/OverviewCommandHelper.kt +++ b/quickstep/src/com/android/quickstep/OverviewCommandHelper.kt @@ -450,10 +450,10 @@ constructor( ) gestureState.isHandlingAtomicEvent = true val interactionHandler = - touchInteractionService.swipeUpHandlerFactory.newHandler( - gestureState, - command.createTime, - ) + touchInteractionService + // TODO(b/404757863): use command.displayId instead of focusedDisplayId. + .getSwipeUpHandlerFactory(focusedDisplayId) + .newHandler(gestureState, command.createTime) interactionHandler.setGestureEndCallback { onTransitionComplete(command, interactionHandler, onCallbackResult) } diff --git a/quickstep/src/com/android/quickstep/OverviewComponentObserver.java b/quickstep/src/com/android/quickstep/OverviewComponentObserver.java index 7d3a1da76f..e7386dcb93 100644 --- a/quickstep/src/com/android/quickstep/OverviewComponentObserver.java +++ b/quickstep/src/com/android/quickstep/OverviewComponentObserver.java @@ -24,6 +24,7 @@ import static android.view.Display.DEFAULT_DISPLAY; import static com.android.launcher3.Flags.enableOverviewOnConnectedDisplays; import static com.android.launcher3.config.FeatureFlags.SEPARATE_RECENTS_ACTIVITY; import static com.android.launcher3.util.Executors.MAIN_EXECUTOR; +import static com.android.quickstep.fallback.window.RecentsWindowFlags.enableFallbackOverviewInWindow; import static com.android.quickstep.fallback.window.RecentsWindowFlags.enableLauncherOverviewInWindow; import static com.android.systemui.shared.system.PackageManagerWrapper.ACTION_PREFERRED_ACTIVITY_CHANGED; @@ -50,7 +51,6 @@ import com.android.launcher3.util.DaggerSingletonObject; import com.android.launcher3.util.DaggerSingletonTracker; import com.android.launcher3.util.SimpleBroadcastReceiver; import com.android.quickstep.fallback.window.RecentsDisplayModel; -import com.android.quickstep.fallback.window.RecentsWindowFlags; import com.android.quickstep.util.ActiveGestureProtoLogProxy; import com.android.systemui.shared.system.PackageManagerWrapper; @@ -181,7 +181,7 @@ public final class OverviewComponentObserver { mDefaultDisplayContainerInterface.onAssistantVisibilityChanged(0.f); } - if (SEPARATE_RECENTS_ACTIVITY.get() || enableLauncherOverviewInWindow.isTrue()) { + if (SEPARATE_RECENTS_ACTIVITY.get()) { mIsDefaultHome = false; if (defaultHome == null) { defaultHome = mMyHomeIntent.getComponent(); @@ -194,8 +194,13 @@ public final class OverviewComponentObserver { + ", mIsDefaultHome=" + mIsDefaultHome); if (!mIsHomeDisabled && (defaultHome == null || mIsDefaultHome)) { - // User default home is same as out home app. Use Overview integrated in Launcher. - mDefaultDisplayContainerInterface = LauncherActivityInterface.INSTANCE; + // User default home is same as our home app. Use Overview integrated in Launcher. + if (enableLauncherOverviewInWindow.isTrue()) { + mDefaultDisplayContainerInterface = + mRecentsDisplayModel.getFallbackWindowInterface(DEFAULT_DISPLAY); + } else { + mDefaultDisplayContainerInterface = LauncherActivityInterface.INSTANCE; + } mIsHomeAndOverviewSame = true; mOverviewIntent = mMyHomeIntent; mCurrentHomeIntent.setComponent(mMyHomeIntent.getComponent()); @@ -204,7 +209,7 @@ public final class OverviewComponentObserver { unregisterOtherHomeAppUpdateReceiver(); } else { // The default home app is a different launcher. Use the fallback Overview instead. - if (RecentsWindowFlags.Companion.getEnableOverviewInWindow()) { + if (enableFallbackOverviewInWindow.isTrue()) { mDefaultDisplayContainerInterface = mRecentsDisplayModel.getFallbackWindowInterface(DEFAULT_DISPLAY); } else { @@ -290,12 +295,16 @@ public final class OverviewComponentObserver { } /** - * Returns true if home and overview are same activity. + * Returns true if home and overview are same process. */ public boolean isHomeAndOverviewSame() { return mIsHomeAndOverviewSame; } + public boolean isHomeAndOverviewSameActivity() { + return isHomeAndOverviewSame() && !enableLauncherOverviewInWindow.isTrue(); + } + /** * Get the current control helper for managing interactions to the overview container for * the given displayId. diff --git a/quickstep/src/com/android/quickstep/TouchInteractionService.java b/quickstep/src/com/android/quickstep/TouchInteractionService.java index 7878e68a94..4ab8d1b9dd 100644 --- a/quickstep/src/com/android/quickstep/TouchInteractionService.java +++ b/quickstep/src/com/android/quickstep/TouchInteractionService.java @@ -95,7 +95,6 @@ import com.android.quickstep.OverviewCommandHelper.CommandType; import com.android.quickstep.OverviewComponentObserver.OverviewChangeListener; import com.android.quickstep.fallback.window.RecentsDisplayModel; import com.android.quickstep.fallback.window.RecentsDisplayModel.RecentsDisplayResource; -import com.android.quickstep.fallback.window.RecentsWindowFlags; import com.android.quickstep.fallback.window.RecentsWindowSwipeHandler; import com.android.quickstep.inputconsumers.BubbleBarInputConsumer; import com.android.quickstep.inputconsumers.OneHandedModeInputConsumer; @@ -965,7 +964,7 @@ public class TouchInteractionService extends Service { mGestureState, taskAnimationManager, inputMonitorCompat, - getSwipeUpHandlerFactory(), + getSwipeUpHandlerFactory(displayId), this::onConsumerInactive, inputEventReceiver, mTaskbarManager, @@ -1110,11 +1109,20 @@ public class TouchInteractionService extends Service { return gestureState; } - public AbsSwipeUpHandler.Factory getSwipeUpHandlerFactory() { - return mOverviewComponentObserver.isHomeAndOverviewSame() - ? mLauncherSwipeHandlerFactory - : (RecentsWindowFlags.Companion.getEnableOverviewInWindow() - ? mRecentsWindowSwipeHandlerFactory : mFallbackSwipeHandlerFactory); + /** + * Returns a AbsSwipeUpHandler.Factory, used to instantiate AbsSwipeUpHandler later. + * @param displayId The displayId of the display this handler will be used on. + */ + public AbsSwipeUpHandler.Factory getSwipeUpHandlerFactory(int displayId) { + BaseContainerInterface<?, ?> containerInterface = + mOverviewComponentObserver.getContainerInterface(displayId); + if (containerInterface instanceof FallbackWindowInterface) { + return mRecentsWindowSwipeHandlerFactory; + } else if (containerInterface instanceof LauncherActivityInterface) { + return mLauncherSwipeHandlerFactory; + } else { + return mFallbackSwipeHandlerFactory; + } } /** diff --git a/quickstep/src/com/android/quickstep/fallback/RecentsState.java b/quickstep/src/com/android/quickstep/fallback/RecentsState.java index 00aa1090e0..77aac4176d 100644 --- a/quickstep/src/com/android/quickstep/fallback/RecentsState.java +++ b/quickstep/src/com/android/quickstep/fallback/RecentsState.java @@ -50,23 +50,31 @@ public class RecentsState implements BaseState<RecentsState> { private static final int FLAG_ADD_DESK_BUTTON = BaseState.getFlag(10); private static final int FLAG_SHOW_EXPLODED_DESKTOP_VIEW = BaseState.getFlag(11); + public static final int DEFAULT_STATE_ORDINAL = 0; + public static final int MODAL_TASK_ORDINAL = 1; + public static final int BACKGROUND_APP_ORDINAL = 2; + public static final int HOME_STATE_ORDINAL = 3; + public static final int BG_LAUNCHER_ORDINAL = 4; + public static final int OVERVIEW_SPLIT_SELECT_ORDINAL = 5; + private static final RecentsState[] sAllStates = new RecentsState[6]; - public static final RecentsState DEFAULT = new RecentsState(0, + public static final RecentsState DEFAULT = new RecentsState(DEFAULT_STATE_ORDINAL, FLAG_DISABLE_RESTORE | FLAG_CLEAR_ALL_BUTTON | FLAG_OVERVIEW_ACTIONS | FLAG_SHOW_AS_GRID | FLAG_SCRIM | FLAG_LIVE_TILE | FLAG_RECENTS_VIEW_VISIBLE | FLAG_ADD_DESK_BUTTON | FLAG_SHOW_EXPLODED_DESKTOP_VIEW); - public static final RecentsState MODAL_TASK = new ModalState(1, + public static final RecentsState MODAL_TASK = new ModalState(MODAL_TASK_ORDINAL, FLAG_DISABLE_RESTORE | FLAG_OVERVIEW_ACTIONS | FLAG_MODAL | FLAG_SHOW_AS_GRID | FLAG_SCRIM | FLAG_LIVE_TILE | FLAG_RECENTS_VIEW_VISIBLE | FLAG_SHOW_EXPLODED_DESKTOP_VIEW); - public static final RecentsState BACKGROUND_APP = new BackgroundAppState(2, + public static final RecentsState BACKGROUND_APP = new BackgroundAppState(BACKGROUND_APP_ORDINAL, FLAG_DISABLE_RESTORE | FLAG_NON_INTERACTIVE | FLAG_FULL_SCREEN | FLAG_RECENTS_VIEW_VISIBLE | FLAG_TASK_THUMBNAIL_SPLASH | FLAG_DETACH_DESKTOP_CAROUSEL); - public static final RecentsState HOME = new RecentsState(3, 0); - public static final RecentsState BG_LAUNCHER = new LauncherState(4, 0); - public static final RecentsState OVERVIEW_SPLIT_SELECT = new RecentsState(5, + public static final RecentsState HOME = new RecentsState(HOME_STATE_ORDINAL, 0); + public static final RecentsState BG_LAUNCHER = new LauncherState(BG_LAUNCHER_ORDINAL, 0); + public static final RecentsState OVERVIEW_SPLIT_SELECT = new RecentsState( + OVERVIEW_SPLIT_SELECT_ORDINAL, FLAG_SHOW_AS_GRID | FLAG_SCRIM | FLAG_RECENTS_VIEW_VISIBLE | FLAG_CLOSE_POPUPS | FLAG_DISABLE_RESTORE | FLAG_SHOW_EXPLODED_DESKTOP_VIEW); @@ -90,7 +98,15 @@ public class RecentsState implements BaseState<RecentsState> { @Override public String toString() { - return "Ordinal-" + ordinal; + return switch (ordinal) { + case DEFAULT_STATE_ORDINAL -> "DEFAULT"; + case MODAL_TASK_ORDINAL -> "MODAL_TASK"; + case BACKGROUND_APP_ORDINAL -> "BACKGROUND_APP"; + case HOME_STATE_ORDINAL -> "HOME"; + case BG_LAUNCHER_ORDINAL -> "BG_LAUNCHER"; + case OVERVIEW_SPLIT_SELECT_ORDINAL -> "SPLIT_SELECT"; + default -> "Unknown Ordinal-" + ordinal; + }; } @Override diff --git a/quickstep/src/com/android/quickstep/fallback/RecentsStateUtils.kt b/quickstep/src/com/android/quickstep/fallback/RecentsStateUtils.kt new file mode 100644 index 0000000000..fec8a809b9 --- /dev/null +++ b/quickstep/src/com/android/quickstep/fallback/RecentsStateUtils.kt @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2025 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.quickstep.fallback + +import com.android.launcher3.LauncherState + +fun RecentsState.toLauncherState(): LauncherState { + return when (ordinal) { + RecentsState.DEFAULT_STATE_ORDINAL -> LauncherState.OVERVIEW + RecentsState.MODAL_TASK_ORDINAL -> LauncherState.OVERVIEW_MODAL_TASK + RecentsState.BACKGROUND_APP_ORDINAL -> LauncherState.BACKGROUND_APP + RecentsState.HOME_STATE_ORDINAL -> LauncherState.NORMAL + RecentsState.BG_LAUNCHER_ORDINAL -> LauncherState.NORMAL + RecentsState.OVERVIEW_SPLIT_SELECT_ORDINAL -> LauncherState.OVERVIEW_SPLIT_SELECT + else -> LauncherState.NORMAL + } +} + +fun RecentsState.toLauncherStateOrdinal(): Int = toLauncherState().ordinal diff --git a/quickstep/src/com/android/quickstep/fallback/window/RecentsWindowManager.kt b/quickstep/src/com/android/quickstep/fallback/window/RecentsWindowManager.kt index 1a3a2e3dfe..bc08af2da6 100644 --- a/quickstep/src/com/android/quickstep/fallback/window/RecentsWindowManager.kt +++ b/quickstep/src/com/android/quickstep/fallback/window/RecentsWindowManager.kt @@ -44,9 +44,6 @@ import com.android.launcher3.statemanager.StateManager.AtomicAnimationFactory import com.android.launcher3.statemanager.StatefulContainer import com.android.launcher3.taskbar.TaskbarUIController import com.android.launcher3.testing.TestLogging -import com.android.launcher3.testing.shared.TestProtocol.NORMAL_STATE_ORDINAL -import com.android.launcher3.testing.shared.TestProtocol.OVERVIEW_SPLIT_SELECT_ORDINAL -import com.android.launcher3.testing.shared.TestProtocol.OVERVIEW_STATE_ORDINAL import com.android.launcher3.testing.shared.TestProtocol.SEQUENCE_MAIN import com.android.launcher3.util.ContextTracker import com.android.launcher3.util.DisplayController @@ -70,8 +67,7 @@ import com.android.quickstep.fallback.RecentsState.BACKGROUND_APP import com.android.quickstep.fallback.RecentsState.BG_LAUNCHER import com.android.quickstep.fallback.RecentsState.DEFAULT import com.android.quickstep.fallback.RecentsState.HOME -import com.android.quickstep.fallback.RecentsState.MODAL_TASK -import com.android.quickstep.fallback.RecentsState.OVERVIEW_SPLIT_SELECT +import com.android.quickstep.fallback.toLauncherStateOrdinal import com.android.quickstep.util.RecentsAtomicAnimationFactory import com.android.quickstep.util.RecentsWindowProtoLogProxy import com.android.quickstep.util.SplitSelectStateController @@ -355,40 +351,16 @@ class RecentsWindowManager(context: Context, wallpaperColorHints: Int) : override fun onStateSetStart(state: RecentsState) { super.onStateSetStart(state) - RecentsWindowProtoLogProxy.logOnStateSetStart(getStateName(state)) + RecentsWindowProtoLogProxy.logOnStateSetStart(state.toString()) } override fun onStateSetEnd(state: RecentsState) { super.onStateSetEnd(state) - RecentsWindowProtoLogProxy.logOnStateSetEnd(getStateName(state)) + RecentsWindowProtoLogProxy.logOnStateSetEnd(state.toString()) if (state == HOME || state == BG_LAUNCHER) { cleanupRecentsWindow() } - when (state) { - HOME, - BG_LAUNCHER -> - AccessibilityManagerCompat.sendStateEventToTest(baseContext, NORMAL_STATE_ORDINAL) - DEFAULT -> - AccessibilityManagerCompat.sendStateEventToTest(baseContext, OVERVIEW_STATE_ORDINAL) - OVERVIEW_SPLIT_SELECT -> - AccessibilityManagerCompat.sendStateEventToTest( - baseContext, - OVERVIEW_SPLIT_SELECT_ORDINAL, - ) - } - } - - private fun getStateName(state: RecentsState?): String { - return when (state) { - null -> "NULL" - DEFAULT -> "DEFAULT" - MODAL_TASK -> "MODAL_TASK" - BACKGROUND_APP -> "BACKGROUND_APP" - HOME -> "HOME" - BG_LAUNCHER -> "BG_LAUNCHER" - OVERVIEW_SPLIT_SELECT -> "OVERVIEW_SPLIT_SELECT" - else -> "ordinal=" + state.ordinal - } + AccessibilityManagerCompat.sendStateEventToTest(baseContext, state.toLauncherStateOrdinal()) } override fun getSystemUiController(): SystemUiController? { diff --git a/quickstep/src/com/android/quickstep/fallback/window/RecentsWindowSwipeHandler.java b/quickstep/src/com/android/quickstep/fallback/window/RecentsWindowSwipeHandler.java index 1d85febad2..b365ddf3a4 100644 --- a/quickstep/src/com/android/quickstep/fallback/window/RecentsWindowSwipeHandler.java +++ b/quickstep/src/com/android/quickstep/fallback/window/RecentsWindowSwipeHandler.java @@ -222,6 +222,7 @@ public class RecentsWindowSwipeHandler extends AbsSwipeUpHandler<RecentsWindowMa @Override protected void finishRecentsControllerToHome(Runnable callback) { final Runnable recentsCallback; + // TODO(b/404866791): check if this is actually necessary for this recents-in-window class if (mAppCanEnterPip) { // Make sure Launcher is resumed after auto-enter-pip transition to actually trigger // the PiP task appearing. @@ -238,7 +239,7 @@ public class RecentsWindowSwipeHandler extends AbsSwipeUpHandler<RecentsWindowMa } mRecentsView.cleanupRemoteTargets(); mRecentsAnimationController.finish( - mAppCanEnterPip /* toRecents */, recentsCallback, true /* sendUserLeaveHint */); + true /* toRecents */, recentsCallback, true /* sendUserLeaveHint */); } @Override diff --git a/quickstep/src/com/android/quickstep/inputconsumers/OtherActivityInputConsumer.java b/quickstep/src/com/android/quickstep/inputconsumers/OtherActivityInputConsumer.java index 2db75738f4..54cc391293 100644 --- a/quickstep/src/com/android/quickstep/inputconsumers/OtherActivityInputConsumer.java +++ b/quickstep/src/com/android/quickstep/inputconsumers/OtherActivityInputConsumer.java @@ -58,6 +58,7 @@ import com.android.quickstep.RecentsAnimationDeviceState; import com.android.quickstep.RecentsAnimationTargets; import com.android.quickstep.RotationTouchHelper; import com.android.quickstep.TaskAnimationManager; +import com.android.quickstep.util.ActiveGestureProtoLogProxy; import com.android.quickstep.util.CachedEventDispatcher; import com.android.quickstep.util.MotionPauseDetector; import com.android.quickstep.util.NavBarPosition; @@ -424,6 +425,8 @@ public class OtherActivityInputConsumer extends ContextWrapper implements InputC mMotionPauseDetector.setIsTrackpadGesture(mGestureState.isTrackpadGesture()); mInteractionHandler.initWhenReady( "OtherActivityInputConsumer.startTouchTrackingForWindowAnimation"); + ActiveGestureProtoLogProxy.logGestureStartSwipeHandler( + mInteractionHandler.getClass().getSimpleName()); if (DEBUG) { Log.d(TAG, "startTouchTrackingForWindowAnimation: isRecentsAnimationRunning=" |