Skip to content
Commit 17b2aaaf authored by Robbie McElrath's avatar Robbie McElrath Committed by Commit Bot
Browse files

[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: default avatarScott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#805626}
parent d40cf21e
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment