Recompute PcT with existing PcT for different direction

The text direction can not be fully determined in detached state.
To improve even in that case, compute PrecomputedText from existing
PrecomputedText with new direction.

Here is the performance difference. According to the perf test result,
up to 80% of computation can be recycled from existing PrecomputedText.

android.text.StaticLayoutPerfTest (u sec):
    PrecomputedText Greedy NoHyphenation             :    371 ->    371: (   +0,  +0.0%)
    PrecomputedText Greedy NoHyphenation DirDifferent:  6,923 ->  1,437: (-5486, -79.2%)
    RandomText Greedy NoHyphenation                  :  6,633 ->  6,627: (   -6,  -0.1%)

On the other hand, this CL increase the memory usage of the
PrecomputedText up to 10%. Here is an reference memory usage.

android.text.PrecomputedTextMemoryUsageTest (bytes):
  MemoryUsage
    Arabic Hyphenation                               : 17,135 -> 18,116: ( +981, +5.7%)
    Arabic NoHyphenation                             : 17,135 -> 18,116: ( +981, +5.7%)
    CJK Hyphenation                                  : 29,000 -> 31,584: (+2584, +8.9%)
    CJK NoHyphenation                                : 29,000 -> 31,584: (+2584, +8.9%)
    Latin Hyphenation                                : 16,526 -> 17,185: ( +659, +4.0%)
    Latin NoHyphenation                              : 14,200 -> 14,784: ( +584, +4.1%)

Bug: 119312268
Test: atest CtsWidgetTestCases
Test: atest CtsTextTestCases
Test: atest CtsGraphicsTestCases
Test: minikin_tests

Change-Id: Ia02c201afac5d7d1c086a45f15696f39a6b2a76c
8 files changed