Clear reference to DreamActivity window.

This changelist clears the reference to the DreamActivity window once
the activity is cleared in DreamService. Holding onto the reference
will lead to a DreamActivity instance leak.

Test: verified leak no longer present through hprof
Bug: 221285764
Change-Id: I1494bcdeaa1b23c0006867ff8eb1806bd5206eba
This commit is contained in:
Bryce Lee
2022-03-03 14:15:37 -08:00
parent 459d5bd503
commit abfdc8fc38

View File

@@ -1341,7 +1341,9 @@ public class DreamService extends Service implements Window.Callback {
public void onViewDetachedFromWindow(View v) {
if (mActivity == null || !mActivity.isChangingConfigurations()) {
// Only stop the dream if the view is not detached by relaunching
// activity for configuration changes.
// activity for configuration changes. It is important to also clear
// the window reference in order to fully release the DreamActivity.
mWindow = null;
mActivity = null;
finish();
}