Merge changes I3054ef81,If90b1f98 into main

* changes:
  fixing splitview issue not receiving callback in recents in window
  Moving RecentsWindowManager away from taskstackchangelistener
This commit is contained in:
Randy Pfohl authored and Android (Google) Code Review committed 2025-04-14 16:08:15 -07:00
commit 72e980e116
3 files changed
+21 -16

No files matched your search

@@ -865,10 +865,11 @@ public class QuickstepLauncher extends Launcher implements RecentsViewContainer,
if (overviewCommandHelper != null) {
overviewCommandHelper.clearPendingCommands();
}
PerDisplayRepository<RecentsWindowManager> recentsWindowManagerRepository =
RecentsWindowManager.REPOSITORY_INSTANCE.get(this);
recentsWindowManagerRepository.forEach(/* createIfAbsent= */ true, recentsWindowManager -> {
recentsWindowManager.onNewIntent();
recentsWindowManager.cleanupRecentsWindow();
});
}
@@ -39,7 +39,7 @@ import com.android.launcher3.AbstractFloatingView
import com.android.launcher3.BaseActivity
import com.android.launcher3.LauncherAnimationRunner
import com.android.launcher3.LauncherAnimationRunner.RemoteAnimationFactory
import com.android.launcher3.LauncherState
import com.android.launcher3.LauncherState.NORMAL
import com.android.launcher3.R
import com.android.launcher3.compat.AccessibilityManagerCompat
import com.android.launcher3.dagger.DisplayContext
@@ -59,6 +59,7 @@ import com.android.launcher3.util.SystemUiController
import com.android.launcher3.util.WallpaperColorHints
import com.android.launcher3.views.BaseDragLayer
import com.android.launcher3.views.ScrimView
import com.android.quickstep.HomeVisibilityState
import com.android.quickstep.OverviewComponentObserver
import com.android.quickstep.RecentsAnimationCallbacks
import com.android.quickstep.RecentsAnimationCallbacks.RecentsAnimationListener
@@ -86,8 +87,6 @@ import com.android.quickstep.views.OverviewActionsView
import com.android.quickstep.views.RecentsView
import com.android.quickstep.views.RecentsViewContainer
import com.android.systemui.shared.recents.model.ThumbnailData
import com.android.systemui.shared.system.TaskStackChangeListener
import com.android.systemui.shared.system.TaskStackChangeListeners
import dagger.assisted.Assisted
import dagger.assisted.AssistedFactory
import dagger.assisted.AssistedInject
@@ -194,10 +193,11 @@ constructor(@Assisted context: Context, wallpaperColorHints: WallpaperColorHints
TestLogging.recordEvent(SEQUENCE_MAIN, "onBackInvoked")
}
private val taskStackChangeListener =
object : TaskStackChangeListener {
override fun onTaskMovedToFront(taskId: Int) {
if ((isShowing() && isInState(DEFAULT))) {
private val homeVisibilityState = SystemUiProxy.INSTANCE.get(this).homeVisibilityState
private val homeVisibilityListener =
object : HomeVisibilityState.VisibilityChangeListener {
override fun onHomeVisibilityChanged(isVisible: Boolean) {
if (isShowing() && !isVisible && isInState(DEFAULT)) {
// handling state where we end recents animation by swiping livetile away
// TODO: animate this switch.
cleanupRecentsWindow()
@@ -217,7 +217,7 @@ constructor(@Assisted context: Context, wallpaperColorHints: WallpaperColorHints
}
init {
TaskStackChangeListeners.getInstance().registerTaskStackListener(taskStackChangeListener)
homeVisibilityState.addListener(homeVisibilityListener)
}
override fun handleConfigurationChanged(configuration: Configuration?) {
@@ -234,8 +234,8 @@ constructor(@Assisted context: Context, wallpaperColorHints: WallpaperColorHints
super.destroy()
Executors.MAIN_EXECUTOR.execute { onViewDestroyed() }
cleanupRecentsWindow()
TaskStackChangeListeners.getInstance().unregisterTaskStackListener(taskStackChangeListener)
callbacks?.removeListener(recentsAnimationListener)
homeVisibilityState.removeListener(homeVisibilityListener)
recentsWindowTracker.onContextDestroyed(this)
recentsView?.destroy()
}
@@ -325,11 +325,7 @@ constructor(@Assisted context: Context, wallpaperColorHints: WallpaperColorHints
stateManager.moveToRestState()
}
fun onNewIntent() {
cleanupRecentsWindow()
}
private fun cleanupRecentsWindow() {
fun cleanupRecentsWindow() {
RecentsWindowProtoLogProxy.logCleanup(isShowing())
if (isShowing()) {
windowManager.removeViewImmediate(windowView)
@@ -389,7 +385,7 @@ constructor(@Assisted context: Context, wallpaperColorHints: WallpaperColorHints
override fun onStateSetEnd(state: RecentsState) {
super.onStateSetEnd(state)
RecentsWindowProtoLogProxy.logOnStateSetEnd(state.toString())
if (state.toLauncherState() == LauncherState.NORMAL) {
if (state.toLauncherState() == NORMAL) {
cleanupRecentsWindow()
}
AccessibilityManagerCompat.sendStateEventToTest(baseContext, state.toLauncherStateOrdinal())
@@ -200,6 +200,7 @@ import com.android.quickstep.TaskViewUtils;
import com.android.quickstep.TopTaskTracker;
import com.android.quickstep.ViewUtils;
import com.android.quickstep.fallback.window.RecentsWindowFlags;
import com.android.quickstep.fallback.window.RecentsWindowManager;
import com.android.quickstep.orientation.RecentsPagedOrientationHandler;
import com.android.quickstep.recents.data.AppTimersRepository;
import com.android.quickstep.recents.data.AppTimersRepositoryImpl;
@@ -5499,6 +5500,13 @@ public abstract class RecentsView<
}
mSplitHiddenTaskView = null;
}
if (RecentsWindowFlags.getEnableOverviewInWindow()) {
// Recents doesn't receive activity callback, so we cleanup manually
if (mContainer instanceof RecentsWindowManager manager) {
manager.cleanupRecentsWindow();
}
}
}
private void safeRemoveDragLayerView(@Nullable View viewToRemove) {