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
This commit is contained in:
Winson Chung
2018-03-19 15:08:13 -07:00
parent 475f20f688
commit 4a088432b6
2 changed files with 11 additions and 0 deletions

View File

@@ -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;
}

View File

@@ -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 ****/