summaryrefslogtreecommitdiff
path: root/core/java/android/text/TextUtils.java
Commit message (Collapse)AuthorAgeFilesLines
* Merge changes from topic "truncate operator name" am: ffa0f982b6 am: ↵Ling Ma2022-04-011-0/+47
|\ | | | | | | | | | | | | | | | | 9cf73e369d am: eb897b1d85 Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2004810 Change-Id: Ie1a67a1a9fae4dbbc321755f7ec9bde8bb84613f Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
| * Add truncateStringForUtf8Storage()Ling Ma2022-03-311-0/+47
| | | | | | | | | | | | Test: manual Bug: 210502588 Change-Id: I5d4ded0cb30151bc567cfedcdb1bbbdb9abdca9b
* | Clear <plurals> in TextUtilsCalvin Pan2022-01-261-9/+0
|/ | | | | | Bug: 199230228 Test: make Change-Id: I3c0422b588a954a9e32fdcc94ea3946dbccddcd0
* Expand formatSimple() to support widths.Jeff Sharkey2020-10-201-3/+28
| | | | | | | | | | | One of the highest-traffic users of String.format() is in the notification code, which uses argument widths. To support these use-cases, this change adds argument width support, with tests. Bug: 170978902 Test: atest error_prone_android_framework_test Exempt-From-Owner-Approval: trivial additions Change-Id: I8e36d4725a6d0cc896dedc5c457eb5f38486d7b6
* Merge changes from topic "oct16b"TreeHugger Robot2020-10-161-0/+88
|\ | | | | | | | | | | * changes: Recommend efficient String operations. Simple alternative to String.format().
| * Simple alternative to String.format().Jeff Sharkey2020-10-161-0/+88
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This purposefully supports only a small handful of substitutions to improve execution speed. Benchmarking reveals this optimized alternative performs 6.5x faster for a typical format string. Add Preconditions overloads that accept varargs to avoid string formatting overhead in successful case. Bug: 170978902 Test: atest FrameworksCoreTests:android.text.TextUtilsTest Test: ./frameworks/base/libs/hwui/tests/scripts/prep_generic.sh little && atest CorePerfTests:android.text.TextUtilsPerfTest Change-Id: I3fae4dc95cfc98a61c4a7f07ca0781c4a2ee3be9
* | Avoid NPE in trimToLengthWithEllipsis().Sudheer Shanka2020-10-081-1/+1
|/ | | | | | | | Currently, the text paramter is annotated with @Nullable but passing a null value will cause an NPE. Test: atest core/tests/coretests/src/android/text/TextUtilsTest.java Change-Id: I95a71246aa0fe3398f09cb9b4b037ca096900ad4
* Fix talkback did not speak out ReplacementSpan's content description.jasonwshsu2020-05-281-1/+1
| | | | | | | | | * setContentDescription() back to ReplacementSpan when receiving parcel * extend writeToParcel to handle AccessibilityReplacementSpan Bug: 155833272 Test: atest AccessibilityNodeInfoTest#testSetTextWithImageSpan_shouldTextSetToInfo Change-Id: Iab902bdcee53fc09cbba2c7c06858823524a3af9
* Update some Parcelables to send Strings UTF-8.Jeff Sharkey2020-04-211-4/+4
| | | | | | | | | | | | | | | | | | An earlier CL with benchmarks has shown that sending strings as UTF-8 is 50% faster for US-ASCII strings, and still 68% faster for complex strings referencing higher Unicode planes. (So an improvement in both cases!) Since code across the OS still makes heavy assumptions about Parcel strings typically being UTF-16, we need to carefully migrate Parcelables by hand, which is what this CLs begins doing. This is a purely mechanical refactoring with no functional changes. Bug: 154436100 Test: manual Exempt-From-Owner-Approval: trivial refactoring Change-Id: Ia9e581efd7c40269342b7528ca07363deb843c0f
* Use new UnsupportedAppUsage annotation.Artur Satayev2020-01-071-1/+1
| | | | | | | | Existing annotations in libcore/ and frameworks/ will deleted after the migration. This also means that any java library that compiles @UnsupportedAppUsage requires a direct dependency on "unsupportedappusage" java_library. Bug: 145132366 Test: m && diff unsupportedappusage_index.csv Change-Id: I288969b0c22fa3a63bc2e71bb5009fe4a927e154
* Create new API for ImageSpanKevin Chang2019-10-021-2/+9
| | | | | | | | Create new API for adding content description into ImageSpan. Bug: 135497450 Test: Adding CTS tests for new API in linked CL Change-Id: I6cc58657c1dfbbddf00186aeea1faa0ce876f996
* Migrate system dialer config to RoleManagerEugene Susla2019-01-281-0/+7
| | | | | | Test: adb logcat | grep Telecomm - to ensure correct default dialer detected go to settings-default apps and ensure correct dialer selected in UI Change-Id: Ib34c07b8259875dfb3c8ea848410436cbeec3796
* Schematize Display system propertiesKiyoung Kim2019-01-151-3/+2
| | | | | | | | | Properties accessed across partitions are now schematized and will become APIs to make explicit interfaces among partitions. Bug: 117924132 Test: m -j Change-Id: Id9bbb997669b05b6edb5307d561e766ead19abf1
* Make LineHeightSpan.Standard a ParcelableSpanHaoyu Zhang2018-11-261-1/+8
| | | | | | | | Implement ParcelableSpan interface for LineHeightSpan. Bug: 112621694 Test: atest LineHeightSpan_StandardTest Change-Id: I452a2b12310b525555e908e4d04dda7101693319
* fix spelling typo in commentBranden Archer2018-10-291-1/+1
| | | | | | Test: typo in comment, no test necessary Change-Id: I5a56c289e1e29a8eca33d55a77c52e87efa446a2
* Merge "Make loadSafeLabel a generic facility as makeSafeForPresentation"TreeHugger Robot2018-10-161-0/+259
|\
| * Make loadSafeLabel a generic facility as makeSafeForPresentationPhilip P. Moltmann2018-10-151-0/+259
| | | | | | | | | | | | | | | | | | 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
* | Add default implementation for LineBackgroundSpanHaoyu Zhang2018-10-041-1/+8
|/ | | | | | Bug: 1526775 Test: atest LineBackgroundSpan_StandardTest Change-Id: Id97981857a90804387d93e89a1b93c1a74498f47
* Add @UnsupportedAppUsage annotationsMathew Inwood2018-08-151-0/+6
| | | | | | | | | | | | | | | | | | | | For packages: android.text.util android.text.style android.text.method android.text.format android.text This is an automatically generated CL. See go/UnsupportedAppUsage for more details. Exempted-From-Owner-Approval: Mechanical changes to the codebase which have been approved by Android API council and announced on android-eng@ Bug: 110868826 Test: m Change-Id: I9afbd4ca8826c37cb70db43252e39b9a674e5ae0
* Merge "Move channel logging to dump method and redact name."Aaron Heuckroth2018-07-101-0/+19
|\
| * Move channel logging to dump method and redact name.Aaron Heuckroth2018-07-091-0/+19
| | | | | | | | | | | | Test: Generate bug report and confirm that NotificationChannel logs contain redacted name strings. Change-Id: Iebaf7b165de0276e69ead862aa7ec864ef912282 Fixes: 78326066
* | Merge "TextUtils: track behavior change of Pattern.split() when targeting > ↵Tobias Thierer2018-06-271-4/+20
|\ \ | |/ |/| | | | | | | | | | | 28." am: b5f35aeaf3 am: 5442964205 am: e4449497ed Change-Id: I3bbb854c61f476caaef20eeae2bbcc9473c49469
| * Merge "TextUtils: track behavior change of Pattern.split() when targeting > 28."Tobias Thierer2018-06-271-4/+20
| |\ | | | | | | | | | | | | | | | am: b5f35aeaf3 Change-Id: I55ba23bfae8f578eb75a4cbfeb2ed4ad1492867d
| | * TextUtils: track behavior change of Pattern.split() when targeting > 28.Tobias Thierer2018-06-261-4/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Another CL in this topic changes the behavior of String.split() and Pattern.split() to omit a "" generated by a leading zero-width match. TextUtils.split() is implemented on top of these methods and therefore adopts the behavior change by default. The behavior change only affects apps targeting API versions > 28. Test: cts-tradefed run singleCommand cts-dev -m CtsTextTestCases \ -t android.text.cts.TextUtilsTest Test: cts-tradefed run singleCommand cts-dev -m CtsLibcoreTestCases Bug: 109659282 Change-Id: I8abe251353f8eacf1429ac9a8e272d50a0944c29
* | | Annotate Parcel param/return reference types.Jake Wharton2018-06-041-1/+2
| | | | | | | | | | | | | | | | | | Bug: 78245676 Test: atest ParcelNullabilityTest Change-Id: I7bb844164d4b417445ff2d6f2f99c8a88d7f7f48
* | | Avoid internal method call and its branching.Jake Wharton2018-04-231-1/+1
|/ / | | | | | | | | | | | | This is a simple check that can be done locally. Test: TextUtilsTest.java Change-Id: I00f2a4fd087aa98ece2c3aa032e106496663b13f
* | Revert "Make ellipsize retry if text doesn't fit"Siyamed Sinir2018-01-231-114/+74
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit e88b5df5b7aaf5a5f654805eb5e5e4c2f09afaa8. 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
* | Rename PremeasuredText to MeasuredTextSeigo Nonaka2018-01-111-8/+8
| | | | | | | | | | | | | | | | | | | | 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
* | Refactor MeasuredTextSeigo Nonaka2017-12-051-42/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is 2nd attempt of I58d3020a3fa560d05576e18888fbfe46e2975e8f The root cause of the crash is passing end offset instead of passing length. This CL contains that fix and also has a test case for that. This refactoring contains: - Add lots of comments. - Mark private the internal fields and introduce accessors and helper methods. - Factor out the auto grow array implementation to another class. - Use SynchronizedPool for pool implementation. - Introduce three build methods for each use case. - Hide addStyleRun and compute all necessary informations in build method. Locally verified that this doesn't cause performance regressions. Here is a raw performance test result on walleye-userdebug. StaticLayoutPerfTest (median, N=100): createRandom: 7,846,449 -> 8,003,903 (+2.01%) createRandom Balanced: 7,810,436 -> 7,919,200 (+1.40%) TextViewOnMeasurePerfTest (median, N=100): measure_AtMost: 94,276,376 -> 94,124,658 (-0.16%) measure_Exactly: 91,629,352 -> 91,617,639 (-0.01%) measure_Unspecified: 151,006,181 -> 150,957,598 (-0.03%) Test: bit CtsTextTestCases:* Test: bit CtsGraphicsTestCases:* Test: bit CtsWidgetTestCases:* Test: bit FrameworksCoreTests:android.text.StaticLayoutTest Bug: 65024629 Bug: 70146381 Change-Id: I772f60444d0fe87f59609977af5ef712cab3eb37
* | Revert "Refactor MeasuredText"Seigo Nonaka2017-12-041-25/+42
| | | | | | | | | | | | | | | | This reverts commit 75492afb1b6566c889025e9ca0a15a0d0fe422aa. Reason for revert: 70146381 Change-Id: Ibb6433b5e02608326ef51cc16d8d5d8efa86beec
* | Refactor MeasuredTextSeigo Nonaka2017-11-301-42/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This refactoring contains: - Add lots of comments. - Mark private the internal fields and introduce accessors and helper methods. - Factor out the auto grow array implementation to another class. - Use SynchronizedPool for pool implementation. - Introduce three build methods for each use case. - Hide addStyleRun and compute all necessary informations in build method. Locally verified that this doesn't cause performance regressions. Here is a raw performance test result on walleye-userdebug. StaticLayoutPerfTest (median, N=100): createRandom: 7,846,449 -> 8,003,903 (+2.01%) createRandom Balanced: 7,810,436 -> 7,919,200 (+1.40%) TextViewOnMeasurePerfTest (median, N=100): measure_AtMost: 94,276,376 -> 94,124,658 (-0.16%) measure_Exactly: 91,629,352 -> 91,617,639 (-0.01%) measure_Unspecified: 151,006,181 -> 150,957,598 (-0.03%) Test: bit CtsTextTestCases:* Test: bit CtsGraphicsTestCases:* Test: bit CtsWidgetTestCases:* Test: bit FrameworksCoreTests:android.text.StaticLayoutTest Bug: 65024629 Change-Id: I58d3020a3fa560d05576e18888fbfe46e2975e8f
* | Reorganize JNI in StaticLayoutSeigo Nonaka2017-10-241-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This CL reorganize the JNI strategy as follows: - Remove nNewBuilder/nFreeBuilder. - Make addStyleRun/addReplacementRun CriticalNative. - Remove nSetupParagraph and pass necessary arguments to nComputeLineBreaks instead. Here is a performance scores: (w/o patch -> w/ patch) StaticLayoutPerfTest (median): createRandom: 3,755,090 -> 3,781,394 (+0.70%) createRandom Balanced: 3,702,837 -> 3,730,435 (+0.74%) TextViewOnMeasurePerfTest (median): measure_AtMost: 39,172,360 -> 35,883,014 (-8.4%) measure_Exactly: 38,005,066 -> 34,585,052 (-9.0%) measure_Unspecified: 67,191,780 -> 63,100,545 (-6.1%) Bug: 65024629 Test: bit CtsTextTestCases:* Test: bit CtsWidgetTestCases:* Change-Id: If9db1fdd2b03a1cf240f87322c1e852cf8085fff
* | Merge "Intern process names." into oc-mr1-dev am: a530d79209Makoto Onuki2017-08-091-0/+8
|\| | | | | | | | | | | am: 3debaa72d4 Change-Id: Iaa2fe2ca2d7680b99f170f2486b3018704e45432
| * Intern process names.Makoto Onuki2017-08-081-0/+8
| | | | | | | | | | | | Bug: 62144301 Test: Boot and start random apps on a secondary user Change-Id: I8a9b475410c52e1063cff5519b0297ad69dd7925
* | Make ellipsize retry if text doesn't fitRoozbeh Pournader2017-08-071-75/+114
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes the cases where the replacement of parts of text with ellipsis may result in more-than-expected width of text due to contextual width changes in the font, such as kerning or Arabic shaping. The calculations in TextUtils.ellipsize() and StaticLayout are fixed to recalculate the new width and reduce it further until the text actuall fits. BoringLayout and DynamicLayout get fixed too since they use the other two implementations indirectly. Also reverse a recently-introduced incorrect check for multi-character ellipsis in Layout.java. Fixes: 31537595 Fixes: 64156587 Test: Manual (Arabic edge cases ellipsize correctly) Test: bit CtsTextTestCases:* Test: bit CtsWidgetTestCases:android.widget.cts.TextViewTest Test: bit CtsWidgetTestCases:android.widget.cts.EditTextTest Test: bit CtsWidgetTestCases:android.widget.cts.CheckedTextViewTest Test: bit CtsWidgetTestCases:android.widget.cts.AutoCompleteTextViewTest Test: bit CtsWidgetTestCases:android.widget.cts.MultiAutoCompleteTextViewTest Test: bit FrameworksCoreTests:android.text. Test: adb shell am instrument -w com.android.documentsui.tests/android.support.test.runner.AndroidJUnitRunner Change-Id: Iaddcc8b01c78d477e2c29b339d321c9631426f34
* | Revert "Make ellipsize retry if text doesn't fit"Roozbeh Pournader2017-08-021-114/+75
| | | | | | | | | | | | | | This reverts commit 1051bbe325a2fac9d5b074367d878318e2326485. Bug: 64312574 Change-Id: I6a3456172e22e94df30dcbe90988db8592886a78
* | Make ellipsize retry if text doesn't fitRoozbeh Pournader2017-08-011-75/+114
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes the cases where the replacement of parts of text with ellipsis may result in more-than-expected width of text due to contextual width changes in the font, such as kerning or Arabic shaping. The calculations in TextUtils.ellipsize() and StaticLayout are fixed to recalculate the new width and reduce it further until the text actuall fits. BoringLayout and DynamicLayout get fixed too since they use the other two implementations indirectly. Also reverse a recently-introduced incorrect check for multi-character ellipsis in Layout.java. Fixes: 31537595 Fixes: 64156587 Test: Manual (Arabic edge cases ellipsize correctly) Test: bit CtsTextTestCases:* Test: bit CtsWidgetTestCases:android.widget.cts.TextViewTest Test: bit CtsWidgetTestCases:android.widget.cts.EditTextTest Test: bit CtsWidgetTestCases:android.widget.cts.CheckedTextViewTest Test: bit CtsWidgetTestCases:android.widget.cts.AutoCompleteTextViewTest Test: bit CtsWidgetTestCases:android.widget.cts.MultiAutoCompleteTextViewTest Test: bit FrameworksCoreTests:android.text. Test: adb shell am instrument -w com.android.documentsui.tests/android.support.test.runner.AndroidJUnitRunner Change-Id: I74fdaa9bf32dc2064eeb702f7f9b78b2bb856c26
* | Merge "Revert "Make ellipsize retry if text doesn't fit""Roozbeh Pournader2017-07-311-95/+75
|\ \
| * | Revert "Make ellipsize retry if text doesn't fit"Roozbeh Pournader2017-07-281-95/+75
| | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 287c8d6fe9c794ae2c1ee8fd8f7dc8a0ac31f9d1. Bug: 64156587 Bug: 31537595 Change-Id: Ifbab89df78e79fe01881e9d203f46e656985518c
* | | Merge "Make ellipsize retry if text doesn't fit"TreeHugger Robot2017-07-271-75/+95
|\| |
| * | Make ellipsize retry if text doesn't fitRoozbeh Pournader2017-07-261-75/+95
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes the cases where the replacement of parts of text with ellipsis may result in more-than-expected width of text due to contextual width changes in the font, such as kerning or Arabic shaping. The calculations in TextUtils.ellipsize() and StaticLayout are fixed to recalculate the new width and reduce it further until the text actuall fits. BoringLayout and DynamicLayout get fixed too since they use the other two implementations indirectly. Also reverse a recently-introduced incorrect check for multi-character ellipsis in Layout.java. Fixes: 31537595 Test: bit CtsTextTestCases:* Test: bit CtsWidgetTestCases:android.widget.cts.TextViewTest Test: bit CtsWidgetTestCases:android.widget.cts.EditTextTest Test: bit CtsWidgetTestCases:android.widget.cts.CheckedTextViewTest Test: bit CtsWidgetTestCases:android.widget.cts.AutoCompleteTextViewTest Test: bit CtsWidgetTestCases:android.widget.cts.MultiAutoCompleteTextViewTest Test: FrameworksCoreTests:android.text. Change-Id: I3532820e12ac45a46e28fe2f8bb17dcd0a345916
* | | Merge "Refactor ellipsis attributes and methods"Roozbeh Pournader2017-07-261-15/+24
|\| |
| * | Refactor ellipsis attributes and methodsRoozbeh Pournader2017-07-251-15/+24
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Mostly changed to avoid repetition of code and remove the assumptions about ellipsis being one code unit. The code for multi-code unit ellipsis is not triggered yet, but is done in preparation for potential future locale-dependent cases. Test: bit CtsTextTestCases:* Test: bit CtsWidgetTestCases:android.widget.cts.TextViewTest Test: bit CtsWidgetTestCases:android.widget.cts.EditTextTest Test: bit CtsWidgetTestCases:android.widget.cts.CheckedTextViewTest Test: bit CtsWidgetTestCases:android.widget.cts.AutoCompleteTextViewTest Test: bit CtsWidgetTestCases:android.widget.cts.MultiAutoCompleteTextViewTest Test: adb shell am instrument -w -e package android.text com.android.frameworks.coretests/android.support.test.runner.AndroidJUnitRunner Change-Id: Id1dfdc503f87fabed2447d55ab2107eee0eccd08
* | Merge "Handle long text for share/cut/copy operations."Siyamed Sinir2017-07-211-0/+40
|\ \
| * | Handle long text for share/cut/copy operations.Siyamed Sinir2017-07-201-0/+40
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When TextView or EditText contains text that is larger than the total parcelable limit, some of the FloatingToolbar operations would crash. This CL changes the behavior as follows: - Show a toast message if cut or copy operation fails because it cannot set the primary clip. - Trim the text for share and process_text actions - A simple app with an EditText and a long text in it, would not open since Autofill value was being sent over IPC. Trimmed the text that is sent for Autofill feature. - Trim the value send to accessibility services Test: bit CtsWidgetTestCases:.TextViewTest Test: bit FrameworksCoreTests:android.widget.TextViewTest Test: bit FrameworksCoreTests:android.text.TextUtilsTest Test: Manual sample app test Bug: 8013261 Change-Id: Ia0df6b4eb4c13071a1bf75cedac7241c7239663c
* / Refactor TextUtils.join() and add documentationRoozbeh Pournader2017-07-201-22/+31
|/ | | | | | | | | | Added documentation to clarify what happens in the case of null or empty arguments. Change-Id: I694dc0f6a6d95ab6ca7ed95b51d81938618eb75f Fixes: 36861796 Test: bit CtsTextTestCases:* Test: bit CtsGraphicsTestCases:android.graphics.cts.FontVariationAxisTest
* Internationalize InputFilter.AllCapsRoozbeh Pournader2017-06-081-0/+71
| | | | | | | | | | | | | | | The new code support non-BMP characters, as well as locale-specific uppercasing and fine-grained span copying. The modern capitalization code in AllCapsTransformationMethod is moved to TextUtils now, so InputFilter.AllCaps can share it. Fixes: 37222101 Test: New CTS and core tests are added. Test: cts-tradefed run cts-dev --module CtsTextTestCases Test: adb shell am instrument -w -e package android.text com.android.frameworks.coretests/android.support.test.runner.AndroidJUnitRunner Change-Id: I021ff2a97a60396fb1b6e4940d91d3cd6ccb6196
* Print A11yEv. Content Change Types in DEBUG toStringEugene Susla2017-05-171-0/+10
| | | | | Test: Enable debug, and ensure changeTypes are properly displayed Change-Id: I1bf6a9f56a72e867a0bc967a5e3527eb4dc83952
* Merge "Don't crash in TextUtil.concat() with paragraph spans" into oc-devTreeHugger Robot2017-05-061-22/+28
|\
| * Don't crash in TextUtil.concat() with paragraph spansRoozbeh Pournader2017-05-051-22/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This switches TextUtils.concat() to use SpannableStringBuilder if there are any spans in the input strings. As a result, we can avoid crashes when concatenating two CharSequences can result in paragraph spans that now don't happen to be at paragraph boundaries. Also document the exact behavior of the method for edge cases based on the previous implementation. Change-Id: I9caffbe95ed729b9c10d63a9e7d22b1e8c7185a3 Fixes: 28271770 Test: CTS tests added and old CTS tests continue to pass. Test: cts-tradefed run cts-dev --module CtsTextTestCases --test android.text.cts.TextUtilsTest