Move recents dependency destruction to onDestroy from onDetachedWindow

With Overview running in a window, this clearing up needs to move later in the  lifecycle.

Bug: 388232647
Test: ran locally on device
Flag: EXEMPT bugfix
Change-Id: Id35c7fce390c2874b453c8b14c4eb0e7220ccd94
This commit is contained in:
Will Osborn
2025-01-07 14:17:37 +00:00
parent 06a0f61573
commit 7fecb97dfb
5 changed files with 20 additions and 3 deletions
@@ -564,6 +564,11 @@ public class QuickstepLauncher extends Launcher implements RecentsViewContainer,
mSplitSelectStateController.onDestroy();
}
RecentsView recentsView = getOverviewPanel();
if (recentsView != null) {
recentsView.destroy();
}
super.onDestroy();
mHotseatPredictionController.destroy();
mSplitWithKeyboardShortcutController.onDestroy();
@@ -461,6 +461,10 @@ public final class RecentsActivity extends StatefulActivity<RecentsState> implem
@Override
protected void onDestroy() {
RecentsView recentsView = getOverviewPanel();
if (recentsView != null) {
recentsView.destroy();
}
super.onDestroy();
ACTIVITY_TRACKER.onContextDestroyed(this);
mActivityLaunchAnimationRunner = null;
@@ -163,6 +163,7 @@ class RecentsWindowManager(context: Context) :
TaskStackChangeListeners.getInstance().unregisterTaskStackListener(taskStackChangeListener)
callbacks?.removeListener(recentsAnimationListener)
recentsWindowTracker.onContextDestroyed(this)
recentsView?.destroy()
}
override fun startHome() {
@@ -1241,8 +1241,15 @@ public abstract class RecentsView<
mSplitSelectStateController.unregisterSplitListener(mSplitSelectionListener);
}
reset();
}
/**
* Execute clean-up logic needed when the view is destroyed.
*/
public void destroy() {
Log.d(TAG, "destroy");
if (enableRefactorTaskThumbnail()) {
mHelper.onDetachedFromWindow();
mHelper.onDestroy();
RecentsDependencies.destroy();
}
}
@@ -32,8 +32,8 @@ class RecentsViewModelHelper(
private val recentsCoroutineScope: CoroutineScope,
private val dispatcherProvider: DispatcherProvider,
) {
fun onDetachedFromWindow() {
recentsCoroutineScope.cancel("RecentsView detaching from window")
fun onDestroy() {
recentsCoroutineScope.cancel("RecentsView is being destroyed")
}
fun switchToScreenshot(