Remove WeakReference for Toast next view
This avoids the view being GCed in low memory situations.
Only the @Deprecated setView API uses mNextViev so this applies to
a limited usage base.
In some stress-test situations, there may be false reports of memory leaks (LeakCanary).
The root-cause is that the NMS reference to ITransientNotification/TN is not cleaned up immediately after
the binder call enqueueToast returns - in the case where the maximum number of toasts has been queued for a
package.
New unit tests for Toast: android.widget.ToastTest
Flag: android.widget.flags.toast_no_weakref
Test: atest android.widget.ToastTest
Test: atest ToastWindowTest ToastPresenterTest ToastUITest ToastTest NotificationManagerServiceTest
Bug: 321732224
Change-Id: I4aea918911731fdd2ba7c46009a518d30b5caa37
8 files changed