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
Also don't show smart actions for selections in text with unsupported
characters.
Bug: 116321860
Test: atest android.view.textclassifier.TextClassifierTest \
android.text.util.cts.LinkifyTest \
android.text.util.LinkifyTest \
android.widget.TextViewActivityTest
Change-Id: Id271cab8aef6b9b13ef17f1a8654c7616f75cf13
Some time zone related libcore classes are moving from
libcore.util to libcore.timezone.
Bug: 119026403
Test: build only
Change-Id: Ic807977a85276b888362295d1d305effe33076fc
This reverts commit 321140ad84.
Reason for revert: we thought this CL caused b/119659731 but apparently it is not.
Change-Id: I5b52cc1facec77d6a0d844bcaac53e90c7ecd132
This reverts commit 3c097aa45e.
Reason for revert: we thought this CL caused b/119659731 but apparently it is not.
Change-Id: Id375c4c8f2bffb7c42dc36bc053d536c6ea57a8d
Did following refactoring:
- The surrogate composition is not necessary since this method is only
interested in TAB character.
- Move BiDi information interpretation logic to Layout.Directions.
- The short circuit for DIRS_ALL_LEFT_TO_RIGHT/DIRS_ALL_RIGHT_TO_LEFT
is not necessary.
- Renamed the variables.
Bug: 119312268
Test: atest TextLineTest
Test: TreeHugger
Test: Verified locally this doesn't cause performance regression
Change-Id: If987387673ec5a22f703952dfbe45b084664ee59
Based on some analysis, these fields/methods are likely false positives.
Set maxTargetSdk=P so that any apps using them are required to migrate off
them in future. See the bug for more details.
Exempted-From-Owner-Approval: Automatic changes to the codebase
affecting only @UnsupportedAppUsage annotations, themselves added
without requiring owners approval earlier.
Bug: 115609023
Test: m
Merged-In: I719b5c94e5b1f4fa562dd5d655953422958ad37e
Change-Id: I719b5c94e5b1f4fa562dd5d655953422958ad37e
(cherry picked from commit 8c854f86a4)
-- Disabled double cursor for BiDi in Layout.getCursorPath.
-- Add tests in LayoutTest.
Bug: 112875662
Test: Manual (no more double cursors, bidi editing feels OK)
Test: bit FrameworksCoreTests:android.text.LayoutTest
Change-Id: I3d201734d12f59724fa627b06ba9ca8c307c27fb
This is a ground work for b/114479228
FontStyle is an argument of the font itemization. Currently Android
system uses weight and italic info for itemizing but maybe we will
use width and oblique style in future.
To be extensible in future, introduce FontStyle.
This CL includes:
- new class FontStyle which holds width and italic at this moment. In
future, we may add width and oblique. (or grdual italic slant)
- Font class still returns weight/slant since they need to be immutable.
- Moved font weight constants from Font to FontStyle
Bug: 114479228
Test: atest CtsGraphicsTestCases
Change-Id: I0ba717fbf9f90ee6f760c1a0f6eda17b4bef6f43
Giving any range to the Builder is too much freedum and hard to tell
errors. Changes to accept length instead of ranges. By this change, we
can prevent and tell errors about
- The gap in the text that no Paint is assigned.
- The given range is overlapped.
- The given range exceeds the text length.
Bug: 112327179
Test: TreeHugger
Change-Id: Iefc078b1f7be2d006a65b46e0b4ea1018ecb29e7
The invalid access has introduced by
I976df4db63be241af395dd30dd94182f76bdae53
Bug: 114454225
Test: atest StaticLayoutLineBreakingTest
Change-Id: I8ad3d7761c98eb8ace97af3a4794d4bfe04c05e0
Any app loading untrusted strings should make the strings face. Hence make
the method publicly available.
Test: atest CtsTextTestCases:MakeSafeForPresentationTest GtsContentTestCases:PackageItemInfoTests
Change-Id: Ib0679fe892181535339dac77583c427e0d64dd05
Fixes: 113856697
This CL includes:
- Move NativeLineBreaker/NativeMeasuredParagraph to android.graphics.text
package since these two uses the shaping result of the text which is a
part of graphics responsibility. At the same time, by this moving,
minikin is only used by android.graphics package.
- Rename NativeLineBreaker/NativeMeasuredParagraph to
LineBreaker/MeasuredText.
- Updated comments of the break strategy and hyphenation frequency.
Bug: 112327179
Test: atest CtsTextTestCases CtsGraphicsTestCases CtsWidgetTestCases
Change-Id: Id69c328e7c9097b9fc11b5c0bd04d1c2e0939c6a