Fix broken recents view loading with overview in window enabled

If recents view is not attached to window when applyLoadPlan is called, then the taskviews will never update until mTaskListChangeId is invalidated. This mainly affects RecentsWindowManager, so added a callback to only initialize after recents view has attached to window.

Flag: com.android.launcher3.enable_launcher_overview_in_window
Bug: 377678992
Test: pre/post-submit tests; opened overview several times
Change-Id: Ie430fb5b0b2b6870c12fed1c6a394088cad1ac17
This commit is contained in:
Schneider Victor-Tulias
2025-04-07 13:36:15 -04:00
committed by Schneider Victor-tulias
parent a2b5b589dc
commit dbf9dee5a6
3 changed files with 39 additions and 27 deletions
@@ -92,6 +92,10 @@ public class FallbackRecentsView<CONTAINER_TYPE extends Context & RecentsViewCon
public void init(OverviewActionsView actionsView, SplitSelectStateController splitController,
@Nullable DesktopRecentsTransitionController desktopRecentsTransitionController) {
super.init(actionsView, splitController, desktopRecentsTransitionController);
if (RecentsWindowFlags.getEnableOverviewInWindow()) {
// These will be set during the state transition to DEFAULT
return;
}
setOverviewStateEnabled(true);
setOverlayEnabled(true);
}
@@ -231,34 +231,40 @@ class RecentsWindowManager(context: Context, wallpaperColorHints: Int) :
}
windowManager.addView(windowView, windowLayoutParams)
windowView
?.findOnBackInvokedDispatcher()
?.registerSystemOnBackInvokedCallback(onBackInvokedCallback)
windowView?.let {
actionsView = it.findViewById(R.id.overview_actions_view)
recentsView =
it.findViewById<FallbackRecentsView<RecentsWindowManager>?>(R.id.overview_panel)
?.apply {
init(
actionsView,
SplitSelectStateController(
/* container= */ this@RecentsWindowManager,
stateManager,
/* depthController= */ null,
statsLogManager,
SystemUiProxy.INSTANCE[this@RecentsWindowManager],
RecentsModel.INSTANCE[this@RecentsWindowManager],
/* activityBackCallback= */ null,
),
/* desktopRecentsTransitionController= */ null,
)
}
actionsView?.apply {
updateDimension(getDeviceProfile(), recentsView?.lastComputedTaskSize)
updateVerticalMargin(DisplayController.getNavigationMode(this@RecentsWindowManager))
}
scrimView = it.findViewById(R.id.scrim_view)
dragLayer = it.findViewById(R.id.drag_layer)
windowView?.systemUiVisibility =
(View.SYSTEM_UI_FLAG_LAYOUT_STABLE or
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION)
it.findOnBackInvokedDispatcher()
?.registerSystemOnBackInvokedCallback(onBackInvokedCallback)
recentsView = windowView?.findViewById(R.id.overview_panel)
actionsView = windowView?.findViewById(R.id.overview_actions_view)
scrimView = windowView?.findViewById(R.id.scrim_view)
val systemUiProxy = SystemUiProxy.INSTANCE[this]
val splitSelectStateController =
SplitSelectStateController(
this,
getStateManager(),
null, /* depthController */
statsLogManager,
systemUiProxy,
RecentsModel.INSTANCE[this],
null, /*activityBackCallback*/
)
recentsView?.init(actionsView, splitSelectStateController, null)
dragLayer = windowView?.findViewById(R.id.drag_layer)
actionsView?.updateDimension(getDeviceProfile(), recentsView?.lastComputedTaskSize)
actionsView?.updateVerticalMargin(DisplayController.getNavigationMode(this))
it.systemUiVisibility =
(View.SYSTEM_UI_FLAG_LAYOUT_STABLE or
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION)
}
systemUiController = SystemUiController(windowView)
recentsWindowTracker.handleCreate(this)
@@ -2760,7 +2760,9 @@ public abstract class RecentsView<
mBlurUtils.setDrawLiveTileBelowRecents(false);
// These are relatively expensive and don't need to be done this frame (RecentsView isn't
// visible anyway), so defer by a frame to get off the critical path, e.g. app to home.
post(this::onReset);
// Defer onto the main thread rather than the view message queue since this will not always
// be called in the Recents In Window case.
MAIN_EXECUTOR.getHandler().post(this::onReset);
}
private void onReset() {