Extract native methods into isolated classes
StaticLayout/MeasuredParagraph uses native methods which is a pain point
of porting TextView to JetPack.
To make minimize the dependency to the native methods, extract native
methods and put them into a thin wrapper class.
The performance impact is limited:
android.text.StaticLayoutPerfTest:
PrecomputedText Balanced Hyphenation : 602 -> 644: ( +42, +7.0%)
PrecomputedText Balanced NoHyphenation: 457 -> 476: ( +19, +4.2%)
PrecomputedText Greedy Hyphenation : 397 -> 412: ( +15, +3.8%)
PrecomputedText Greedy NoHyphenation : 397 -> 411: ( +14, +3.5%)
RandomText Balanced Hyphenation : 17,594 -> 17,715: (+121, +0.7%)
RandomText Balanced NoHyphenation : 7,146 -> 7,236: ( +90, +1.3%)
RandomText Greedy Hyphenation : 7,125 -> 7,196: ( +71, +1.0%)
RandomText Greedy NoHyphenation : 7,099 -> 7,187: ( +88, +1.2%)
draw
PrecomputedText NoStyle : 614 -> 628: ( +14, +2.3%)
PrecomputedText Style : 778 -> 826: ( +48, +6.2%)
RandomText NoStyle : 537 -> 540: ( +3, +0.6%)
RandomText Style : 786 -> 759: ( -27, -3.4%)
Bug: N/A
Test: atest CtsWidgetTestCases:EditTextTest
CtsWidgetTestCases:TextViewFadingEdgeTest
FrameworksCoreTests:TextViewFallbackLineSpacingTest
FrameworksCoreTests:TextViewTest FrameworksCoreTests:TypefaceTest
CtsGraphicsTestCases:TypefaceTest CtsWidgetTestCases:TextViewTest
CtsTextTestCases FrameworksCoreTests:android.text
CtsWidgetTestCases:TextViewPrecomputedTextTest
Change-Id: I976df4db63be241af395dd30dd94182f76bdae53
12 files changed