From dbf9dee5a635546b89a8b66873ec0b1e4abf1ba9 Mon Sep 17 00:00:00 2001 From: Schneider Victor-Tulias Date: Mon, 7 Apr 2025 13:36:15 -0400 Subject: [PATCH] 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 --- .../fallback/FallbackRecentsView.java | 4 ++ .../fallback/window/RecentsWindowManager.kt | 58 ++++++++++--------- .../android/quickstep/views/RecentsView.java | 4 +- 3 files changed, 39 insertions(+), 27 deletions(-) diff --git a/quickstep/src/com/android/quickstep/fallback/FallbackRecentsView.java b/quickstep/src/com/android/quickstep/fallback/FallbackRecentsView.java index a2c2f0b19f..5b98d07e81 100644 --- a/quickstep/src/com/android/quickstep/fallback/FallbackRecentsView.java +++ b/quickstep/src/com/android/quickstep/fallback/FallbackRecentsView.java @@ -92,6 +92,10 @@ public class FallbackRecentsView?>(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) diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java index 5168cc7316..ace1f13907 100644 --- a/quickstep/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/src/com/android/quickstep/views/RecentsView.java @@ -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() {