xamarin / AndroidX

AndroidX bindings for .NET for Android
MIT License
173 stars 42 forks source link

[AndroidX.Browser] Obsolete CustomTabsActivityManager.From with message describing its shortcomings. #874

Closed jpobst closed 2 months ago

jpobst commented 2 months ago

Fixes https://github.com/xamarin/AndroidX/issues/873

The method CustomTabsActivityManager.From (Activity parentActivity, string? servicePackageName = null) caches the passed in parentActivity forever, which can cause a memory leak.

Additionally, only the first parentActivity passed in supported. Subsequent parentActivity arguments are ignored and the first one is always reused.

Mark this helper method as [Obsolete] and recommend consumers implement any desired caching themselves in a way that respects the parent activity(ies) and their lifetimes properly for the relevant application.