[WebLayer] Fix Site Settings Dialogs on WebLayer L,M
This CL works around a LayoutInflater bug in Android <N that caused all Dialogs in WebLayer's Site Settings UI to crash when opening. LayoutInflater creates Views by looking up their constructor from the class's name, and caches this name to constructor mapping as an optimization. This cache causes issues if a View is loaded multiple times with difference ClassLoaders. In Site Settings, some AndroidX classes get loaded early on with the embedding app's ClassLoader, which causes the constructor from that ClassLoader's version of the class to be cached. When the WebLayer implementation then tries to load the same class, it loads the version from the embedding app, rather than the WebLayer's version. This issue was fixed in Android N, but to work around it on earlier versions of Android, this CL registers Site Setting's fake FragmentActivity as the Factory2 for the implementation Context so it can intercept View loading, and loads Views manually to bypass the LayoutInflater cache. Bug: 1126647 Change-Id: Icaf81b2dd84dc5b82b28a4c8d92114a4b7a37598 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2402188 Commit-Queue: Robbie McElrath <rmcelrath@chromium.org> Reviewed-by:Scott Violet <sky@chromium.org> Cr-Commit-Position: refs/heads/master@{#805626}
Loading
Please register or sign in to comment