Fix activity leak bug
This is a cherry-pick from main branch: ID: I7dfebac90aa43f89433f49e0ed60b3ff57bcc497 It is possible for ViewRootImpl.doDie() to be called prior to one of the other calls which tells the system that the window is going to the foreground. This race condition can cause an activity leak since the ViewRootImpl in question is stored in a collection of "requestors" which determine when to pause/resume animators for background/foreground apps. The fix is two-fold: - Only cause an item to be added to the "requestor" list in AnimationHandler when doDie() has not yet been called (marked by the mReoved" flag) - Store the requestor objects as WeakReferences, rather than the objects themselves. Thus if the requestor list is the only referent to the object, it can be collected anyway, removing the leak potential. Bug: 258616235, 258616235 Test: AnimatorLeakTest passes Change-Id: Icdd6023f6530e3cc4b474f33dc34f6eb7400788e Merged-in: I7dfebac90aa43f89433f49e0ed60b3ff57bcc497
Loading
Please register or sign in to comment