This is the second try of
commit c7a5b3a90d, which was reverted in
commit 735d447d48
Changes:
- Use reflection to update static final fields, because some apps and
tests rely on Typeface.create() to return references to static final
fields (which is a behavior resulted from the use of internal cache).
- Make setSystemFontMap() thread safe.
- Hold a reference to ByteBuffer so that the memory won't be unmapped.
Bug: 172891184
Test: atest FrameworksCoreTests:TypefaceTest
Test: atest CtsWidgetTestCases:android.widget.cts.TextViewPrecomputedTextTest
Change-Id: I1dea26c08a8585ea10e866c063bef6d682d8b15e