Seigo Nonaka
3483bc7d64
Introduce new constructor for not copying NoCopySpan
...
To hold the original text in PrecomputedText, need to create
SpannableString, but copying NoCopySpan causes some side effect.
This CL introduces a way of copying SpannableString/SpannedString
with all spans other than NoCopySpan.
Bug: 72998298
Bug: 35638900
Test: atest CtsWidgetTestCases:EditTextTest
CtsWidgetTestCases:TextViewFadingEdgeTest
FrameworksCoreTests:TextViewFallbackLineSpacingTest
FrameworksCoreTests:TextViewTest FrameworksCoreTests:TypefaceTest
CtsGraphicsTestCases:TypefaceTest CtsWidgetTestCases:TextViewTest
CtsTextTestCases FrameworksCoreTests:android.text
CtsWidgetTestCases:TextViewPrecomputedTextTest
Change-Id: I20dea2114ccaa54b16ff679c97682a5003f9a4c1
2018-03-20 14:33:35 -07:00
Seigo Nonaka
e887f4d2c1
Revert "Make PrecomputedText Spannable for supporting selection"
...
Crash on Sheets APp
This reverts commit 80ed5a35a9 .
Bug: 75652829
Change-Id: I40ddd1b9754e74fbd90d7a029cce9c6a7ede0777
Test: Manual
2018-03-19 17:04:30 +00:00
Seigo Nonaka
80ed5a35a9
Make PrecomputedText Spannable for supporting selection
...
To support selectable TextView, make PrecomputedText spannable.
By this change, TextView start using DynamicLayout instead of
StaticLayout. DynamicLayout requires boundary rectangle of the
text, so this CL also adds getBounds method to PrecomputedText
which retrieves measured boundary box from native.
By this change, the selectable TextView performance for the
precomputed text 10x faster. On the other hand, the performacne
for the non-selectable text gets 2.5x slower. However, we concluded
that we accept this performance regression since it still 10 times
faster than non precomputed text.
Here is a precomputed text performance result of TextView.
android.widget.TextViewPrecomputedTextPerfTest:
newLayout_PrecomputedText : 736,130 -> 1,648,694: (+124.0%)
newLayout_PrecomputedText_Selectable : 17,379,765 -> 1,700,146: (-90.2%)
onDraw_PrecomputedText : 1,274,921 -> 1,848,076: (+45.0%)
onDraw_PrecomputedText_Selectable : 17,367,238 -> 1,399,169: (-91.9%)
onMeasure_PrecomputedText : 752,875 -> 1,766,606: (+134.6%)
onMeasure_PrecomputedText_Selectable : 17,647,842 -> 1,810,704: (-89.7%)
setText_PrecomputedText : 92,894 -> 135,471: (+45.8%)
setText_PrecomputedText_Selectable : 145,134 -> 215,757: (+48.7%)
Verified no effects for other performance metrics:
android.widget.TextViewPrecomputedTextPerfTest:
newLayout_RandomText : 16,495,200 -> 16,450,483: (-0.3%)
newLayout_RandomText_Selectable : 17,482,439 -> 17,534,207: (+0.3%)
onDraw_RandomText : 17,224,949 -> 17,228,072: (+0.0%)
onDraw_RandomText_Selectable : 18,067,397 -> 17,958,235: (-0.6%)
onMeasure_RandomText : 16,435,649 -> 16,516,352: (+0.5%)
onMeasure_RandomText_Selectable : 17,724,819 -> 17,879,508: (+0.9%)
setText_RandomText : 11,130 -> 11,259: (+1.2%)
setText_RandomText_Selectable : 48,900 -> 48,607: (-0.6%)
android.text.PrecomputedTextPerfTest:
create_NoStyled_Hyphenation : 17,695,377 -> 17,660,233: (-0.2%)
create_NoStyled_Hyphenation_WidthOnly : 17,677,423 -> 17,541,823: (-0.8%)
create_NoStyled_NoHyphenation : 7,021,486 -> 7,030,069: (+0.1%)
create_NoStyled_NoHyphenation_WidthOnly : 7,045,453 -> 7,067,021: (+0.3%)
create_Styled_Hyphenation : 12,090,933 -> 12,267,730: (+1.5%)
create_Styled_Hyphenation_WidthOnly : 12,105,491 -> 12,277,272: (+1.4%)
create_Styled_NoHyphenation : 11,835,249 -> 11,960,278: (+1.1%)
create_Styled_NoHyphenation_WidthOnly : 11,871,765 -> 11,912,444: (+0.3%)
android.text.StaticLayoutPerfTest:
create_PrecomputedText_NoStyled_Balanced_Hyphenation : 709,839 -> 697,134: (-1.8%)
create_PrecomputedText_NoStyled_Balanced_NoHyphenation: 527,671 -> 528,928: (+0.2%)
create_PrecomputedText_NoStyled_Greedy_Hyphenation : 477,259 -> 481,966: (+1.0%)
create_PrecomputedText_NoStyled_Greedy_NoHyphenation : 479,772 -> 482,278: (+0.5%)
create_PrecomputedText_Styled_Greedy_NoHyphenation : 639,322 -> 637,790: (-0.2%)
create_RandomText_NoStyled_Balanced_Hyphenation : 17,123,681 -> 16,989,227: (-0.8%)
create_RandomText_NoStyled_Balanced_NoHyphenation : 7,040,572 -> 7,064,175: (+0.3%)
create_RandomText_NoStyled_Greedy_Hyphenation : 7,000,681 -> 7,002,322: (+0.0%)
create_RandomText_NoStyled_Greedy_NoHyphenation : 6,997,115 -> 6,996,953: (-0.0%)
create_RandomText_Styled_Greedy_NoHyphenation : 11,948,744 -> 12,052,791: (+0.9%)
draw_PrecomputedText_NoStyled : 543,623 -> 513,741: (-5.5%)
draw_PrecomputedText_NoStyled_WithoutCache : 564,742 -> 541,795: (-4.1%)
draw_PrecomputedText_Styled : 838,581 -> 837,438: (-0.1%)
draw_PrecomputedText_Styled_WithoutCache : 826,775 -> 850,586: (+2.9%)
draw_RandomText_NoStyled : 538,162 -> 533,603: (-0.8%)
draw_RandomText_NoStyled_WithoutCache : 6,401,486 -> 6,424,604: (+0.4%)
draw_RandomText_Styled : 1,024,683 -> 1,011,575: (-1.3%)
draw_RandomText_Styled_WithoutCache : 2,733,204 -> 2,722,828: (-0.4%)
Bug: 72998298
Test: atest CtsWidgetTestCases:EditTextTest
CtsWidgetTestCases:TextViewFadingEdgeTest
FrameworksCoreTests:TextViewFallbackLineSpacingTest
FrameworksCoreTests:TextViewTest FrameworksCoreTests:TypefaceTest
CtsGraphicsTestCases:TypefaceTest CtsWidgetTestCases:TextViewTest
CtsTextTestCases FrameworksCoreTests:android.text
CtsWidgetTestCases:TextViewPrecomputedTextTest
Change-Id: I072dfd70b9a687d9c47e310d8cdb34f988fbb32e
2018-03-15 14:09:08 -07:00
Seigo Nonaka
e1ffb54167
Throw an exception in case of parameter mismatch of precomputed text
...
If the given precomputed text is not compatible with the TextView,
reject the text by throwing IllegalArgumentException.
Bug: 73091756
Test: atest CtsWidgetTestCases:EditTextTest
CtsWidgetTestCases:TextViewFadingEdgeTest
FrameworksCoreTests:TextViewFallbackLineSpacingTest
FrameworksCoreTests:TextViewTest FrameworksCoreTests:TypefaceTest
CtsGraphicsTestCases:TypefaceTest CtsWidgetTestCases:TextViewTest
CtsTextTestCases FrameworksCoreTests:android.text
CtsWidgetTestCases:TextViewPrecomputedTextTest
Change-Id: I4fbf89a5f1409e8eefdeb9f208f9a3758220fe1a
(cherry picked from commit 3a0787af5e )
2018-03-07 18:30:27 +00:00
Przemyslaw Szczepaniak
ec374b371a
Merge "Tweak DateFormat.is24HourFormat javadoc to be more explicit." am: 093c509c40 am: 031b91574d
...
am: 54ebb3e0b7
Change-Id: Ie218259d09539ec004ccf9fca88133227323d6e2
2018-03-01 16:55:45 +00:00
Przemyslaw Szczepaniak
170d9b8ceb
Tweak DateFormat.is24HourFormat javadoc to be more explicit.
...
Bug: 32761394
Test: make docs
Change-Id: If10da5b9d63e6e88774e333d5c266e423e6bc7c8
2018-03-01 10:35:57 +00:00
Seigo Nonaka
beafa1f9d2
Reorganize MeasuredText API (2nd)
...
This is 2nd attempt of I7db9e2ca4db68a16648cfb8fcf63555f501304c2
This CL changes the MeasuredText API:
- Rename MeasuredText to PrecomputedText.
- Introduce PrecomputedText.Param which holds all text layout parameters.
- Add API to get PrecomputedText.Param from TextView.
- Remove MeasuredText.Builder and add PrecomputedText.create method instead.
- Remove setRange from MeasuredText since it is not for normal use case.
(It can not be used for TextView)
Bug: 67504091
Bug: 72861572
Test: bit FrameworksCoreTests:android.text.
Test: atest CtsWidgetTestCases:EditTextTest \
CtsWidgetTestCases:TextViewFadingEdgeTest \
FrameworksCoreTests:TextViewFallbackLineSpacingTest \
FrameworksCoreTests:TextViewTest FrameworksCoreTests:TypefaceTest \
CtsGraphicsTestCases:TypefaceTest CtsWidgetTestCases:TextViewTest \
CtsTextTestCases
Change-Id: Ie73bce52c6c673cda58973ddad04627a7cf2e5e9
2018-02-16 19:42:00 -08:00
TreeHugger Robot
961b465ac4
Merge "Allowing Typeface as a param in TypefaceSpan."
2018-02-16 19:06:53 +00:00
TreeHugger Robot
1d84b1734d
Merge "Adding maximum input size checks"
2018-02-16 18:46:50 +00:00
Siyamed Sinir
813d17d67e
Update text OWNERS with set noparent
...
Test: N/A
Change-Id: Ic3d83909a780ae3e3bac81d39719ad60435d95f2
2018-02-15 15:14:50 -08:00
Seigo Nonaka
4e90fa262d
Revert "Reorganize MeasuredText API"
...
The last change needs more discussion and found some edge cases. Revert and make small step-by-step changes.
Bug: 73091756
This reverts commit 7fd36d19e3 .
Change-Id: I89ff52a70cf6a5d6c553afa20f83719e1f9eb726
2018-02-14 17:03:16 +00:00
Seigo Nonaka
7fd36d19e3
Reorganize MeasuredText API
...
This CL changes the MeasuredText API:
- Rename MeasuredText to PrecomputedText.
- PrecomputedText is no longer a Spanned.
- Introduce PrecomputedText.Param which holds all text layout parameters.
- Add API to get PrecomputedText.Param from TextView.
- Remove MeasuredText.Builder and add PrecomputedText.create method instead.
- Remove setRange from MeasuredText since it is not for normal use case.
(It can not be used for TextView)
Here is a performance scores: (median, walleye-userdebug, N=20)
StaticLayout creation time (w/o patch -> w/ patch)
PrecomputedText Balanced Hyphenation : 743,615 -> 737,145: (-0.9%)
PrecomputedText Balanced NoHyphenation: 551,544 -> 542,715: (-1.6%)
PrecomputedText Greedy Hyphenation : 500,343 -> 499,601: (-0.1%)
PrecomputedText Greedy NoHyphenation : 497,987 -> 492,587: (-1.1%)
RandomText Balanced Hyphenation : 19,100,592 -> 19,135,289: (+0.2%)
RandomText Balanced NoHyphenation : 8,015,088 -> 7,954,260: (-0.8%)
RandomText Greedy Hyphenation : 7,950,915 -> 7,877,424: (-0.9%)
RandomText Greedy NoHyphenation : 7,939,337 -> 7,863,471: (-1.0%)
PrecomputedText creation time (w/o patch -> w/ patch)
NoStyled Hyphenation : 18,935,638 -> 18,925,422: (-0.1%)
NoStyled Hyphenation WidthOnly : 18,469,726 -> 18,978,413: (+2.8%)
NoStyled NoHyphenation : 7,940,792 -> 7,919,127: (-0.3%)
NoStyled NoHyphenation WidthOnly : 7,463,230 -> 7,922,643: (+6.2%)
Styled Hyphenation : 14,822,501 -> 14,809,017: (-0.1%)
Styled Hyphenation WidthOnly : 13,891,770 -> 14,656,617: (+5.5%)
Styled NoHyphenation : 14,511,134 -> 14,301,503: (-1.4%)
Styled NoHyphenation WidthOnly : 13,495,345 -> 14,264,314: (+5.7%)
StaticLayout draw time (w/o patch -> w/ patch)
PrecomputedText NoStyled : 663,974 -> 661,610: (-0.4%)
PrecomputedText NoStyled WithoutCache : 648,294 -> 648,766: (+0.1%)
PrecomputedText Styled : 879,322 -> 852,770: (-3.0%)
PrecomputedText Styled WithoutCache : 1,084,570 -> 1,110,147: (+2.4%)
RandomText NoStyled : 565,682 -> 555,435: (-1.8%)
RandomText NoStyled WithoutCache : 9,070,533 -> 9,064,825: (-0.1%)
RandomText Styled : 2,955,202 -> 2,962,008: (+0.2%)
RandomText Styled WithoutCache : 12,242,325 -> 12,228,573: (-0.1%)
Bug: 67504091
Bug: 73091756
Test: bit FrameworksCoreTests:android.text.
Test: atest CtsWidgetTestCases:EditTextTest \
CtsWidgetTestCases:TextViewFadingEdgeTest \
FrameworksCoreTests:TextViewFallbackLineSpacingTest \
FrameworksCoreTests:TextViewTest FrameworksCoreTests:TypefaceTest \
CtsGraphicsTestCases:TypefaceTest CtsWidgetTestCases:TextViewTest \
CtsTextTestCases
Change-Id: I7db9e2ca4db68a16648cfb8fcf63555f501304c2
2018-02-12 20:50:41 -08:00
Siyamed Sinir
bc48bd8f61
Merge "Remove Toki from text OWNERS files"
2018-02-08 18:55:17 +00:00
Clara Bayarri
d293d6d4b6
Remove Toki from text OWNERS files
...
Test: none
Change-Id: I9e444318df4a77ee06949d5141667f6c00d9a508
2018-02-08 11:14:10 +00:00
Jan Althaus
108aad3c30
Adding maximum input size checks
...
Bug: 67629726
Test: Added tests and ran core tests
Change-Id: Ib6ca53b068731fa0eabcabaed230d7f3ccde1288
2018-02-07 12:00:45 +01:00
Jeff Sharkey
ad357d1839
Pass in the user defined by Context.
...
The majority of Manager-style classes already use Context.getUserId()
when making calls into the OS, so clean up the remaining callers to
unify behind this strategy.
This gives @SystemApi developers a nice clean interface to interact
across user boundaries, instead of manually adding "AsUser" or
"ForUser" method variants, which would quickly become unsustainable.
Test: builds, boots
Bug: 72863821
Exempt-From-Owner-Approval: trivial changes
Change-Id: Ib772ec4438e57a2ad4950821b9432f9842998451
2018-02-03 02:11:45 +00:00
Florina Muntenescu
57c8b961db
Allowing Typeface as a param in TypefaceSpan.
...
Test: TypefaceSpanTest.java
Bug: 26946279
Change-Id: I99a46fbc41ada567731f034f515998654ce77cb2
2018-02-03 00:45:52 +00:00
TreeHugger Robot
85d8a99310
Merge "Updating more spans"
2018-02-02 00:26:48 +00:00
Florina Muntenescu
139e1b5c01
Updating more spans
...
Test: N/A
Bug: 72092996
Change-Id: Iecd3595a03cde2a1d58e4be00b7cf9b6783d4e2a
2018-01-31 18:25:02 +00:00
Abodunrinwa Toki
fe20cdd910
Smart Linkify API
...
Uses the TextClassifier to generate links on a background thread.
The links are applied on the calling thread.
Test: see topic
Bug: 67629726
Change-Id: I0f1940a2ffbf19f4436c0a20b0c62e6bbc03cd7a
2018-01-31 09:42:36 +00:00
David Ogutu
321ef3a5af
Merge "Fix TimePicker separator l10n issue."
2018-01-30 20:57:58 +00:00
David Ogutu
628bb61c30
Fix TimePicker separator l10n issue.
...
This was surfacing in the android clock with certain locales e.g. fr_CA.
Fixed for all unqiue locale patterns.
Bug: 71572309
Test: manual - changed locale to Fr_CA and made sure clock seperator WAI
Test: atest CtsWidgetTestCases:TextViewTest CtsWidgetTestCases:EditTextTest CtsWidgetTestCases:TextViewFadingEdgeTest FrameworksCoreTests:TextViewFallbackLineSpacingTest FrameworksCoreTests:TextViewTest
Change-Id: Ie43bf9428e8c5ef2fe2e9545cb5a6dada25d6e52
2018-01-30 12:44:45 -05:00
TreeHugger Robot
ea3ca9d720
Merge "Introduce MeasuredText related perf tests"
2018-01-29 19:30:42 +00:00
Florina Muntenescu
8ec69a628b
Merge "Making QuoteSpan more flexible."
2018-01-26 03:19:11 +00:00
Florina Muntenescu
ea27314e38
Merge "Update JavaDocs for Alignment, Clickable, Editable and MetricAffecting spans."
2018-01-26 03:18:46 +00:00
Seigo Nonaka
49ca0244c9
Introduce MeasuredText related perf tests
...
This CL adds two perf test for MeasuredText: the memory usage and
construction time of MeasuredText.
Here is an example output on walleye-userdebug:
Memory Usage (in bytes)
Hyphenation : 28,448
Hyphenation WidthOnly : 8,856
NoHyphenation : 27,592
NoHyphenation WidthOnly: 8,000
MeasuredText creation time
NoStyled Hyphenation : 18,977,877
NoStyled Hyphenation WidthOnly : 18,510,041
NoStyled NoHyphenation : 7,771,936
NoStyled NoHyphenation WidthOnly: 7,332,537
Styled Hyphenation : 13,514,428
Styled Hyphenation WidthOnly : 12,446,143
Styled NoHyphenation : 13,370,358
Styled NoHyphenation WidthOnly : 13,582,435
Bug: 72461923
Bug: 72462192
Test: See above
Change-Id: I7d326a9e70a29c38c940e0085da2bc4edf2a098a
2018-01-25 10:41:26 -08:00
Florina Muntenescu
58414a4867
Update JavaDocs for Alignment, Clickable, Editable and MetricAffecting
...
spans.
Test: N/A
Bug: 72092996
Change-Id: I716ed3841d7ac0b1cc2f75021ae0e02d1bf05524
2018-01-25 09:06:28 +00:00
Florina Muntenescu
f58a0282a9
Making QuoteSpan more flexible.
...
Test: QuoteSpanTest
Bug: 72410257
Change-Id: Ie0e159b4f645b7935454ad25fd43c5d0e8f3d7c1
2018-01-25 08:50:49 +00:00
TreeHugger Robot
ab802003b9
Merge "Compute full text layout in MeasuredText and use it for drawing"
2018-01-24 22:07:13 +00:00
Siyamed Sinir
1a5648a2cd
Revert "Make ellipsize retry if text doesn't fit"
...
This reverts commit e88b5df5b7 .
Test: bit FrameworksCoreTests:android.text.StaticLayoutTest
Test: bit FrameworksCoreTests:android.text.DynamicLayoutTest
Test: bit FrameworksCoreTests:android.text.TextUtilsTest
Test: bit CtsTextTestCases:*
Test: atest FilesActivityUiTest
Bug: 71599479
Bug: 31537595
Bug: 64156587
Change-Id: I1afa77a4b90b9b822b409a3f4721c45d0c0a6664
2018-01-23 18:25:36 -08:00
Seigo Nonaka
783f961d2f
Compute full text layout in MeasuredText and use it for drawing
...
The full layout is required for drawing text on UI thread.
To save this work, store the full layout result in MeasuredText and
compose the final layout from stored full layout if possible.
Currently justification/hyphenation is not supported but works normally
as before. Nothing changes on existing non measured text.
StaticLayout creation time for no style text (w/o patch -> w/ patch, N=30)
MeasuredText Balanced Hyphenation : 721,297 -> 720,657: (-0.1%)
MeasuredText Balanced NoHyphenation: 550,588 -> 546,069: (-0.8%)
MeasuredText Greedy Hyphenation : 503,582 -> 498,009: (-1.1%)
MeasuredText Greedy NoHyphenation : 502,344 -> 498,507: (-0.8%)
RandomText Balanced Hyphenation : 19,351,802 -> 19,176,024: (-0.9%)
RandomText Balanced NoHyphenation : 8,033,830 -> 7,973,336: (-0.8%)
RandomText Greedy Hyphenation : 7,957,335 -> 7,927,316: (-0.4%)
RandomText Greedy NoHyphenation : 7,988,884 -> 7,929,717: (-0.7%)
StaticLayout.draw time for no style text (w/o patch -> w/ patch, N=30)
MeasuredText NoStyled : 644,453 -> 660,684: (+2.5%)
MeasuredText NoStyled WithoutCache : 9,251,919 -> 648,992: (-93.0%)
MeasuredText Styled : 3,092,353 -> 870,702: (-71.8%)
MeasuredText Styled WithoutCache : 12,544,014 -> 1,114,557: (-91.1%)
RandomText NoStyled : 582,167 -> 572,092: (-1.7%)
RandomText NoStyled WithoutCache : 9,167,670 -> 9,056,447: (-1.2%)
RandomText Styled : 3,064,490 -> 3,029,028: (-1.2%)
RandomText Styled WithoutCache : 12,314,863 -> 12,283,026: (-0.3%)
Test: minikin_test
Test: bit CtsTextTestCases:*
Test: bit CtsWidgetTestCases:android.widget.cts.TextViewTest
Test: bit FrameworksCoreTests:android.text.MeasuredParagraphTest
Bug: 63897135
Change-Id: I7e6ec5c953d7d0f767aba4f61f94e62b6f3a3a2b
2018-01-23 17:45:55 -08:00
TreeHugger Robot
414b665f2d
Merge "Make BulletSpan more flexible and update JavaDoc."
2018-01-23 13:57:29 +00:00
Florina Muntenescu
987189b936
Make BulletSpan more flexible and update JavaDoc.
...
Test: BulletSpanTest
Bug: 72217003
Change-Id: I0ba4d93bd5a7bac02410e0edbd4b20f254959d4e
2018-01-23 12:08:39 +00:00
Florina Muntenescu
6d0474944a
Updating JavaDocs for more spans.
...
Test: N/A
Bug:72092996
Change-Id: I2706465d3d61117b0b5b9e6a013f213988c92521
2018-01-22 18:40:50 +00:00
TreeHugger Robot
f74e56af8c
Merge "Update JavaDoc for BackgroundColorSpan and ForegroundColorSpan."
2018-01-20 01:00:54 +00:00
Florina Muntenescu
6e6772ff03
Update JavaDoc for BackgroundColorSpan and ForegroundColorSpan.
...
Test: N/A
Bug: 72092996
Change-Id: Iec7f378557759e2fdd2969f579e1dfd4635b123a
2018-01-19 17:52:31 +00:00
TreeHugger Robot
881a432d08
Merge "Compute hyphenated word pieces in MeasuredText"
2018-01-18 20:32:54 +00:00
Seigo Nonaka
87b1547c92
Compute hyphenated word pieces in MeasuredText
...
Bug: 67504091
Test: bit CtsTextTestCases:*
Change-Id: Id1ff5abbf6d433a2d8baad364133fca98d1fe450
2018-01-18 18:30:02 +00:00
Neil Fuller
dd704e316b
Merge "Javadoc fixes to Time" am: b3c2efc615 am: b51c638a6c
...
am: 90a56a59d5
Change-Id: I62545bdd0604ee0911249abd7628c99868093c77
2018-01-18 10:40:42 +00:00
Neil Fuller
3d3d7f1a8d
Javadoc fixes to Time
...
Fixing errors noticed while inspecting the code.
Test: None - docs only
Change-Id: Ib6d427c4339f0b8e56eb72b12e89c1095245d6b4
2018-01-17 21:13:21 +00:00
Seigo Nonaka
9d3bd08eba
Rename PremeasuredText to MeasuredText
...
There is already MeasuredText, so renamed existing MeasuredText to
MeasuredParagraph, then renamed PremeasuredText to MeasuredText.
Bug: 67504091
Test: bit CtsWidgetTestCases:android.widget.cts.TextViewTest
Test: bit CtsTextTestCases:*
Change-Id: Ie20bea9501b18fabb36f64d388a7851c4643d4c3
2018-01-11 11:33:32 -08:00
Siyamed Sinir
1fb80bbc94
Prevent crash for Span change events
...
For some spans, SpannableStringBuilder cannot determine the previous
start and previous end values correctly. In some cases, previous end
value is smaller than previous start value, and this causes
DynamicLayout to access negative index values. This CL updates
DynamicLayout to reflow from index 0 if such a case occurs.
Test: Added a CTS test
Test: bit CtsTextTestCases:android.text.cts.DynamicLayoutTest#testReflow_afterSpanChangedShouldNotThrowException
Bug: 67926915
Change-Id: Ibc55edfd5e49a7782cdd807e2465f4f21577b68d
2018-01-08 13:57:59 -08:00
Victor Chang
d990345d8b
Revert "Switch file size formatters to use ICU's MeasureFormat"
...
This reverts commit 4e5b71f084 .
Test: cts-tradefed run cts-dev -m CtsTextTestCases
Bug: 70005649
Bug: 36994779
Change-Id: Ie9a2fd786d48e2a6c291e313cbb4072c7306af9f
2018-01-03 14:31:47 +00:00
Victor Chang
3305bce79d
Revert "Remove use of MeasureUnit.internalGetInstance"
...
This reverts commit aa5629e608 .
Test: m
Bug: 70005649
Bug: 36994779
Change-Id: I4591870f564567c40fa450866c3050fd5a7a61ae
2018-01-03 14:31:34 +00:00
TreeHugger Robot
df392c9a1d
Merge "Deprecate StaticLayout and DynamicLayout constructors"
2017-12-20 11:58:32 +00:00
Siyamed Sinir
f7314652ed
Merge "Add OWNERS for text related classes"
2017-12-19 20:08:56 +00:00
Clara Bayarri
81a4f2e89d
Deprecate StaticLayout and DynamicLayout constructors
...
The Builders should be used instead.
Also remove a StaticLayout constructor only used in tests in favor
of the Builder.
Bug: 64985428
Test: adb shell am instrument -w -e class android.text.StaticLayoutTest com.android.frameworks.coretests/android.support.test.runner.AndroidJUnitRunner
Change-Id: Ief6839d2c6bb0969bdeb30359eae00d38a2bdb09
2017-12-19 16:46:56 +00:00
Siyamed Sinir
50b585e20c
Fix DynamicLayout block index calculation after edit
...
DynamicLayout made wrong adjustments to the block indices set to be
redrawn. Every indice after the first change was being added the
diff count in the blocks. However this meant when there are 2 deletes
and an index as 1, it would become -1 (wrong array index). The change
should be applied to indices outside of [firstBlock, lastBlock].
Test: Added android.text.DynamicLayoutTest#testReflow_afterSpannableEdit
Test: bit FrameworksCoreTests:android.text.DynamicLayoutTest
Test: bit FrameworksCoreTests:android.text.DynamicLayoutBlocksTest
Test: bit CtsTextTestCases:android.text.cts.DynamicLayoutTest
Bug: 67405337
Change-Id: Ie5e5658ffca4293f32f7b574d22d307e9e8d52dc
2017-12-18 23:32:50 -08:00
Siyamed Sinir
198e309394
Add OWNERS for text related classes
...
Test: None
Change-Id: Ieacd6b7e91665c7f17ab7e9308d0533f6dc5663e
2017-12-18 18:04:30 -08:00
Jeff Sharkey
ce8db99114
Add more IntDef prefixes for auto-documenting.
...
Test: builds, boots
Bug: 70177949
Exempt-From-Owner-Approval: annotation-only changes
Change-Id: I76dde6054e06f52240bd4b1a0f196dcb74623608
2017-12-13 20:05:36 -07:00