diff options
author | 2025-03-07 01:48:59 +0000 | |
---|---|---|
committer | 2025-03-19 11:37:19 -0700 | |
commit | 32888e1519e142f43a82c4e6ee2f3482142fc51c (patch) | |
tree | 8e7dc7c1ebdae67ea2fb9d2a299c01f7918b8c1e | |
parent | ed79f7f269b395aa99d1c089ba0d5909dc2fdbb3 (diff) |
Fix TaskarUIController being wrong with Overview-in-Window enabled
- isHomeAndOverviewSame now returns true for launcher in window
- added isHomeAndOverviewSameActivity to differentiate specifically
when Overview is hosted in the Launcher activity (currently only
used for launcherChildTask handling, which we can clean up in a
follow up change)
- overviewIntent now equals homeIntent for launcher in window
- fixed containerInterface to always use FallbackoverviewInWindow
when overview-in-window is enabled; this means TaskbarManager
gets the proper RecentsViewContainer for creating the correct
TaskbarUIController
- updated getSwipeUpHandlerFactory based on isHomeAndOverviewSame
change above
Fixes: 401382430
Test: InputConsumerUtilsTest, manual
Flag: com.android.launcher3.enable_fallback_overview_in_window
Flag: com.android.launcher3.enable_launcher_overview_in_window
Change-Id: Ie8edd55b47d6438af36b9d2a788d72d69afa02f3
8 files changed, 53 insertions, 21 deletions
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/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/OverviewCommandHelper.kt b/quickstep/src/com/android/quickstep/OverviewCommandHelper.kt index 6a9c3dd519..2c799cf1d7 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/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=" diff --git a/quickstep/src_protolog/com/android/quickstep/util/ActiveGestureProtoLogProxy.java b/quickstep/src_protolog/com/android/quickstep/util/ActiveGestureProtoLogProxy.java index 773a039cf3..2532fcf8cf 100644 --- a/quickstep/src_protolog/com/android/quickstep/util/ActiveGestureProtoLogProxy.java +++ b/quickstep/src_protolog/com/android/quickstep/util/ActiveGestureProtoLogProxy.java @@ -544,7 +544,7 @@ public class ActiveGestureProtoLogProxy { @NonNull Point displaySize, @NonNull RectF swipeRegion, @NonNull RectF ohmRegion, int gesturalHeight, int largerGesturalHeight, @NonNull String reason) { if (!enableActiveGestureProtoLog() || !isProtoLogInitialized()) return; - ProtoLog.d(ACTIVE_GESTURE_LOG, + ProtoLog.d(ACTIVE_GESTURE_LOG, "OrientationTouchTransformer.createRegionForDisplay: " + "dispRot=%d, dispSize=%s, swipeRegion=%s, ohmRegion=%s, " + "gesturalHeight=%d, largerGesturalHeight=%d, reason=%s", @@ -560,4 +560,14 @@ public class ActiveGestureProtoLogProxy { ProtoLog.d(ACTIVE_GESTURE_LOG, "TaskAnimationManager not available for displayId=%d", displayId); } + + public static void logGestureStartSwipeHandler(@NonNull String interactionHandler) { + ActiveGestureLog.INSTANCE.addLog(new ActiveGestureLog.CompoundString( + "OtherActivityInputConsumer.startTouchTrackingForWindowAnimation: " + + "interactionHandler=%s", interactionHandler)); + if (!enableActiveGestureProtoLog() || !isProtoLogInitialized()) return; + ProtoLog.d(ACTIVE_GESTURE_LOG, + "OtherActivityInputConsumer.startTouchTrackingForWindowAnimation: " + + "interactionHandler=%s", interactionHandler); + } } diff --git a/quickstep/tests/src/com/android/quickstep/InputConsumerUtilsTest.java b/quickstep/tests/src/com/android/quickstep/InputConsumerUtilsTest.java index 93b979cc32..1464ca8432 100644 --- a/quickstep/tests/src/com/android/quickstep/InputConsumerUtilsTest.java +++ b/quickstep/tests/src/com/android/quickstep/InputConsumerUtilsTest.java @@ -293,7 +293,7 @@ public class InputConsumerUtilsTest { @Test public void testNewBaseConsumer_launcherChildActivityResumed_returnsDefaultInputConsumer() { when(mRunningTask.isHomeTask()).thenReturn(true); - when(mOverviewComponentObserver.isHomeAndOverviewSame()).thenReturn(true); + when(mOverviewComponentObserver.isHomeAndOverviewSameActivity()).thenReturn(true); assertEqualsDefaultInputConsumer(this::createBaseInputConsumer); } |