Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4a088432 authored by Winson Chung's avatar Winson Chung
Browse files

Reset dummy stack view tasks after computing transition into Recents

- Also clear up references from the app transition spec future to the
  parent implementation, which can also leak memory.

Bug: 73961798
Test: Enter recents, ensure that dummy stack view holds no task refs
Change-Id: I0c466350c1c1dd490f8776ca23f13de0d698e060
parent 475f20f6
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -49,6 +49,10 @@ public abstract class AppTransitionAnimationSpecsFuture {
                    mHandler.post(mComposeTask);
                }
                List<AppTransitionAnimationSpecCompat> specs = mComposeTask.get();
                // Clear reference to the compose task this future holds onto the reference to it's
                // implementation (which can leak references to the bitmap it creates for the
                // transition)
                mComposeTask = null;
                if (specs == null) {
                    return null;
                }
+7 −0
Original line number Diff line number Diff line
@@ -276,6 +276,9 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener
        }
    };

    // Used to reset the dummy stack view
    private final TaskStack mEmptyTaskStack = new TaskStack();

    public RecentsImpl(Context context) {
        mContext = context;
        mHandler = new Handler();
@@ -1108,6 +1111,10 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener
            }
        });
        EventBus.getDefault().send(hideMenuEvent);

        // Once we have launched the activity, reset the dummy stack view tasks so we don't hold
        // onto references to the same tasks consumed by the activity
        mDummyStackView.setTasks(mEmptyTaskStack, false /* notifyStackChanges */);
    }

    /**** OnAnimationFinishedListener Implementation ****/