summaryrefslogtreecommitdiff
path: root/core/java/android/text/Layout.java
Commit message (Collapse)AuthorAgeFilesLines
* Implement fallback line spacing for BoringLayoutSeigo Nonaka2022-01-121-8/+25
| | | | | | | | | | | | | | | | | | | | | | The fallback line spacing is a feature of extending the line height when the fallback font has taller glyph. This was implemented to StaticLayout in Android P but not yet implemented in BoringLayout. This CL enables this feature to the BoringLayout as well. Not to break existing apps, change this behavior only if the targetSdk version is T or later. This is a 2nd attempt of Ia6d6f9f44e73ddaf5e8fe9a8aead7a53efbddd44 The root cause of SystemUI crash was wrong API usage. (start, end) was passed instead of (start, count). Bug: 210923482 Test: atest FallbackLineSpacingTest BoringLayoutFallbackLineSpacingTest Test: atest CtsGraphicsTestCases Test: atest CtsTextTestCases Test: atest SystemUITests Change-Id: I9137607b0120934f7ad2a12c0f0b8aaa52915831
* Revert "Implement fallback line spacing for BoringLayout"Shubham Dubey2022-01-101-25/+8
| | | | | | | | | | | | | | | | | | | | | Revert "Add font extent calculation" Revert "Add test case for fallback line spacing" Revert submission 16486662-fallback_line_spacing Reason for revert: Investigate test failures on master BUGID: b/213826416 BUGID: b/213829920 Reverted Changes: I06cd7ab71:Add font extent calculation I6214d52cd:Implement fallback line spacing for BoringLayout Ia5825c474:Add test case for fallback line spacing Change-Id: Ia6d6f9f44e73ddaf5e8fe9a8aead7a53efbddd44
* Implement fallback line spacing for BoringLayoutSeigo Nonaka2022-01-061-8/+25
| | | | | | | | | | | | | | | | | The fallback line spacing is a feature of extending the line height when the fallback font has taller glyph. This was implemented to StaticLayout in Android P but not yet implemented in BoringLayout. This CL enables this feature to the BoringLayout as well. Not to break existing apps, change this behavior only if the targetSdk version is T or later. Bug: 210923482 Test: atest FallbackLineSpacingTest BoringLayoutFallbackLineSpacingTest Test: atest CtsGraphicsTestCases Test: atest CtsTextTestCases Change-Id: I6214d52cde25a044bc6e246d2118e35d3a243c9d
* Implement fast hyphenation algorithmSeigo Nonaka2021-11-101-3/+24
| | | | | | | | | | | | | | | | | | | | | RandomText Balanced Hyphenation ON min: 2,312,291 mean: 2,320,574 median: 2,320,112 RandomText Balanced Hyphenation ON(Fast) min: 985,850 mean: 990,922 median: 986,586 RandomText Balanced Hyphenation OFF min: 909,060 median: 923,585 mean: 930,052 Bug: 201096525 Test: TreeHugger and minikin_tests Change-Id: Ide2d73acb3de85e91018e524c89df2c949235a4e
* Improve ellipsize performanceSeigo Nonaka2021-06-041-4/+5
| | | | | | | | | Instead of iterate all ellipsized characters, only iterate the necessary ranges for copying. Bug: 188913943 Test: atest CtsTextTestCases CtsGraphicsTestCases CtsWidgetTestCases Change-Id: I3d03b1e3897e427c23fbe51315f412c57a4ce9e9
* Add maxTargetSdk restriction to unused APIs.Mathew Inwood2020-10-291-6/+7
| | | | | | | | | | | | | | | | | | | These are APIs that have @UnsupportedAppUsage but for which we don't have any evidence of them currently being used, so should be safe to remove from the unsupported list. This is a resubmit of ag/12929664 with some APIs excluded that caused test failures; see bugs 171886397, 171888296, 171864568. APIs excluded: Landroid/bluetooth/le/ScanRecord;->parseFromBytes([B)Landroid/bluetooth/le/ScanRecord; Landroid/os/Process;->myPpid()I Landroid/os/SharedMemory;->getFd()I Landroid/hardware/input/InputManager;->INJECT_INPUT_EVENT_MODE_WAIT_FOR_FINISH:I Bug: 170729553 Test: Treehugger Change-Id: I8285daa8530260251ecad6f3f38f98e263629ca7
* Revert "Add maxTargetSdk restriction to unused APIs."Hongwei Wang2020-10-281-7/+6
| | | | | | | | | This reverts commit 72f07d6a8a32db4a0dedd7682a0b3385be2b9cd6. Reason for revert: Droidcop-triggered revert due to breakage https://android-build.googleplex.com/builds/quarterdeck?testMethod=testAppZygotePreload&testClass=android.app.cts.ServiceTest&atpConfigName=suite%2Ftest-mapping-presubmit-retry_cloud-tf&testModule=CtsAppTestCases&fkbb=6936597&lkbb=6936969&lkgb=6936551&testResults=true&branch=git_master&target=cf_x86_phone-userdebug>, bug b/171886397 Bug: 171886397 Change-Id: Ibe0f0430a3451477c1ee8ef56a596e91ea1e7672
* Add maxTargetSdk restriction to unused APIs.Mathew Inwood2020-10-271-6/+7
| | | | | | | | | | These are APIs that have @UnsupportedAppUsage but for which we don't have any evidence of them currently being used, so should be safe to remove from the unsupported list. Bug: 170729553 Test: Treehugger Change-Id: I4c8fd0006f950de9955242e93968fb0996ceb372
* 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
* Fix Layout.primaryIsTrailingPreviousAllLineOffsetsMihai Popa2019-06-251-3/+6
| | | | | | | | | | | | | | | | The CL fixes a crash in Layout.primaryIsTrailingPreviousAllLineOffsets. The crash was happening when the method was called for a line beginning with an empty bidi run. This could happen, for example, for empty text - I was unable to find any other case. The CL improves the existing test for the method with this case, which was previously crashing. The CL also fixes a potential crash in getLineHorizontals. However, this bug could never happen as in the current code path clamped is always false (and kept as parameter for parity with getHorizontal). Bug: 135444178 Test: atest FrameworksCoreTests:android.text.LayoutTest\#testPrimaryIsTrailingPrevious Change-Id: I47157abe1d74675884734e3810628a566e40c1b4
* Merge "Change TabStop type from int to float"TreeHugger Robot2019-03-131-11/+14
|\
| * Change TabStop type from int to floatSeigo Nonaka2019-03-121-11/+14
| | | | | | | | | | | | | | | | | | This is from API council feedback. Bug: 124794899 Test: atest CtsTextTestCases Test: atest CtsGraphicsTestCases Change-Id: Ifa95f87067239cca9c0791bf079045e4f645c3ad
* | Hide packing structure from public APISeigo Nonaka2019-03-111-6/+18
|/ | | | | | | | | | | | | | | | | | | The hyphen edit is packed into 8bit integer in native library, but this should not be exposed to public API as API council suggested. This CL includes: - Removing packing structure from HyphenEdit and move constants from Hyphenator to Paint. - Replace LineBreaker's getLineHyphenEdit with two separate start/end function. - Replace Paint's getHyphenEdit with two separate start/end function. - StaticLayout still relies on this packing mechanism but no longer need to be the same packing structure as in Minikin. Bug: 124794844 Test: atest CtsGraphicsTestCases Test: atest CtsTextTestCases Change-Id: I8206061f554cf6e119b2b565162f54317eac630a
* Merge "Revert "Revert "Refactor TextLine class"""TreeHugger Robot2018-11-171-0/+46
|\
| * Revert "Revert "Refactor TextLine class""Siyamed Sinir2018-11-161-0/+46
| | | | | | | | | | | | | | | | This reverts commit 3c097aa45e1fc8c03e09aea09a0dc3596b82c761. Reason for revert: we thought this CL caused b/119659731 but apparently it is not. Change-Id: Id375c4c8f2bffb7c42dc36bc053d536c6ea57a8d
* | Merge "Revert "Refactor TextLine class""TreeHugger Robot2018-11-161-46/+0
|\|
| * Revert "Refactor TextLine class"Siyamed Sinir2018-11-161-46/+0
| | | | | | | | | | | | | | | | This reverts commit 888dbca2f720ae2ae52dce1d88063e46e3b53c28. Reason for revert: <INSERT REASONING HERE> Change-Id: I259327a6ca507e2614cacdcdabdeca7df48b8ed2
* | Merge "Fix getLineLeft crashes when alignment is null"Haoyu Zhang2018-11-161-2/+14
|\ \ | |/ |/|
| * Fix getLineLeft crashes when alignment is nullHaoyu Zhang2018-11-141-2/+14
| | | | | | | | | | | | Bug: 119221721 Test: atest StaticLayoutGetLineLeftRightTest Change-Id: If83ac95f47d76052cf088b7d977ee5cded9a8fee
* | Refactor TextLine classSeigo Nonaka2018-11-141-0/+46
|/ | | | | | | | | | | | | | | | 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
* Merge "Fix getLineRight()/getLineLeft() may compute leadingMargin twice"Haoyu Zhang2018-10-301-42/+71
|\
| * Fix getLineRight()/getLineLeft() may compute leadingMargin twiceHaoyu Zhang2018-10-191-42/+71
| | | | | | | | | | | | Bug: 74129926 Test: atest StaticLayoutGetLineLeftRightTest LayoutTest Change-Id: I5f05d55eb4115d920ac8e5ecb52fbd16fdf60790
* | Disable double cursor for BiDi in Layout.qqd2018-10-191-23/+13
|/ | | | | | | | | | -- 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
* Make LineBreaker publicSeigo Nonaka2018-10-091-17/+14
| | | | | | | | | | | | | | | 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
* Fixed lineBackgroundSpan not called for first lineHaoyu Zhang2018-09-181-1/+1
| | | | | | | Bug: 1526775 Test: atest StaticLayoutTest LayoutTest Change-Id: I71e4e5a14e385df6a79cca7cb7c5e2da15ac5cec
* Introduce NativeLineBreaker.Builder and ParagraphConstraintSeigo Nonaka2018-08-171-13/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To make NativeLineBreaker public API, introduce NativeLineBreaker.Builder and ParagraphConstraint. Here is a performance differences: android.text.StaticLayoutPerfTest: PrecomputedText Balanced Hyphenation : 635 -> 684: ( +49, +7.7%) PrecomputedText Balanced NoHyphenation: 477 -> 523: ( +46, +9.6%) PrecomputedText Greedy Hyphenation : 413 -> 463: ( +50, +12.1%) PrecomputedText Greedy NoHyphenation : 413 -> 463: ( +50, +12.1%) RandomText Balanced Hyphenation : 18,030 -> 18,157: (+127, +0.7%) RandomText Balanced NoHyphenation : 7,390 -> 7,388: ( -2, -0.0%) RandomText Greedy Hyphenation : 7,319 -> 7,331: ( +12, +0.2%) RandomText Greedy NoHyphenation : 7,316 -> 7,375: ( +59, +0.8%) draw PrecomputedText NoStyle : 631 -> 627: ( -4, -0.6%) PrecomputedText Style : 842 -> 847: ( +5, +0.6%) RandomText NoStyle : 531 -> 547: ( +16, +3.0%) RandomText Style : 754 -> 758: ( +4, +0.5%) Bug: 112327179 Test: atest CtsWidgetTestCases:EditTextTest CtsWidgetTestCases:TextViewFadingEdgeTest FrameworksCoreTests:TextViewFallbackLineSpacingTest FrameworksCoreTests:TextViewTest FrameworksCoreTests:TypefaceTest CtsGraphicsTestCases:TypefaceTest CtsWidgetTestCases:TextViewTest CtsTextTestCases FrameworksCoreTests:android.text CtsWidgetTestCases:TextViewPrecomputedTextTest CtsGraphicsTestCases:android.graphics.fonts Change-Id: I5b817bbc9f00e5806efa98f239ee20ff3d688c50
* Merge "Validate index for cursor on BiDi text"TreeHugger Robot2018-08-151-2/+3
|\
| * Validate index for cursor on BiDi textSiyamed Sinir2018-08-151-2/+3
| | | | | | | | | | | | | | | | | | | | | | Previously we have updated the code not to check mHorizontals if offset is invalid (I5c5778718f6b397adbb1e4f2cf95e9f635f6e5c8) However we should also check the final index to make sure no invalid index is accessed. Test: None Bug: 111580019 Change-Id: I5c32820cde5f91bfe8688e9394b8ba3254cbd731
* | Add @UnsupportedAppUsage annotationsMathew Inwood2018-08-151-0/+14
|/ | | | | | | | | | | | | | | | | | | | 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
* Fix crash during cursor moving on BiDi textSeigo Nonaka2018-07-191-1/+1
| | | | | | | | | | | | | | | The crash was introduced by Ib66ef392c19c937718e7101f6d48fac3abe51ad0 The root cause of the crashing is requesting out-of-line access for the horizontal width. This invalid access is silently ignored by TextLine#measure() method but new implementation end up with out of bounds access. To makes behavior as old implementation, calling getHorizontal instead of accessing measured result array. Bug: 111580019 Test: Manually done Change-Id: I5c5778718f6b397adbb1e4f2cf95e9f635f6e5c8
* Supress text replacement spans for ellipsisMihai Popa2018-05-301-8/+17
| | | | | | | | | | | | | | | | | | | When a sequence of characters belonging to a text is ellipsized, we usually replace the first characters with ... and then all the others with a 0 width character, knowing that they will be drawn, but will be invisible. However, these positions could have had ReplacementSpans attached to them, such as EmojiTypefaceSpan when the EmojiCompat library is used. When this happened, all the ellipsized out characters were invisible, apart from emojis, which were still drawn as usual (as they were replacing sequences of 0 width characters). This CL fixes this behaviour, by skipping those ReplacementSpans that were completely included in ellipsis. Please check the bug for a more detailed explanation. Bug: 69802699 Test: manual testing Test: atest FrameworksCoreTests:android.text.TextLineTest Change-Id: If9758537948abaa0226fe6b551a703110c5457b9
* Optimise the hit test algorithmMihai Popa2018-05-221-7/+166
| | | | | | | | | | | | | | | | | | | | | | | | | Layout#getOffsetForHorizontal was running in O(n^2) time, where n is the length of the current line. The method is used when a touch event happens on a text line, to compute the cursor offset (and the character) where it happened. Although this is not an issue in common usecases, where the number of characters on a line is relatively small, this can be very inefficient as a consequence of Unicode containing 0-width (invisible) characters. Specifically, there are characters defining the text direction (LTR or RTL), which cause our algorithm to touch the worst case quadratic runtime. For example, a person is able to send a message containing a few visible characters, and also a lot of these direction changing invisible ones. When the receiver touches the message (causing the Layout#getOffsetForHorizontal method to be called), the receiver's application would become not responsive. This CL optimizes the method to run in O(n) worst case. This is achieved by computing the measurements of all line prefixes at first, which can be done in a single pass. Then, all the prefix measurement queries will be answered in O(1), rather than O(n) as it was happening before. Bug: 79215201 Test: manual testing Change-Id: Ib66ef392c19c937718e7101f6d48fac3abe51ad0
* Merge "Add test cases for Layout.primaryIsTrailingPrevious"TreeHugger Robot2018-05-171-1/+3
|\
| * Add test cases for Layout.primaryIsTrailingPreviousSeigo Nonaka2018-05-161-1/+3
| | | | | | | | | | | | Bug: 78464361 Test: atest FrameworksCoreTests:android.text.LayoutTest Change-Id: Id2735e993849bced47f9b361c99e13f91fe88070
* | Add TextLayout.measure test casesSeigo Nonaka2018-05-161-2/+3
|/ | | | | | Bug: 78464361 Test: atest android.text.TextLineTest Change-Id: I62e05d4fe18c115060da918a2c9105f0e94fe4b0
* Revert "Reorganize MeasuredText API"Seigo Nonaka2018-02-141-10/+1
| | | | | | | | | | The last change needs more discussion and found some edge cases. Revert and make small step-by-step changes. Bug: 73091756 This reverts commit 7fd36d19e309ea515b4048cfaabb8035ceab7baf. Change-Id: I89ff52a70cf6a5d6c553afa20f83719e1f9eb726
* Reorganize MeasuredText APISeigo Nonaka2018-02-121-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Rename PremeasuredText to MeasuredTextSeigo Nonaka2018-01-111-2/+2
| | | | | | | | | | 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
* Add more IntDef prefixes for auto-documenting.Jeff Sharkey2017-12-131-6/+22
| | | | | | | Test: builds, boots Bug: 70177949 Exempt-From-Owner-Approval: annotation-only changes Change-Id: I76dde6054e06f52240bd4b1a0f196dcb74623608
* Refactor MeasuredTextSeigo Nonaka2017-12-051-15/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-14/+15
| | | | | | | | This reverts commit 75492afb1b6566c889025e9ca0a15a0d0fe422aa. Reason for revert: 70146381 Change-Id: Ibb6433b5e02608326ef51cc16d8d5d8efa86beec
* Refactor MeasuredTextSeigo Nonaka2017-11-301-15/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | 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
* Removed unused variables from text layout codeSiyamed Sinir2017-10-101-12/+2
| | | | Test: None Change-Id: I890c3d260edd0570259db5089dcb37f79c2e56e9
* Merge "Update referenced constant names for Directions"Petar Šegina2017-09-281-11/+7
|\
| * Update referenced constant names for DirectionsPetar Šegina2017-09-271-11/+7
| | | | | | | | | | | | | | | | | | | | | | The new constants were introduced in [1] 9f7a444, but the comment used the wrong prefix - DIR_ instead of RUN_ in the actual names. [1] Change-Id Iea8bb46c678a18820e237c90f76007a084c83051 Commit hash 9f7a4442b89cc06cb8cae6992484e7ae795323ab Test: comment update, no tests performed Change-Id: I4e13600b16ebd9be7ac40cf6c6292ea13f0806c2
* | Take padding information into StaticLayoutRoozbeh Pournader2017-09-271-2/+1
|/ | | | | | | | | This is useful for figuring out if we should adjust width of text in case the overhangs are more than available padding. Bug: 63938206 Test: pending Change-Id: I04592a7cbce264fe133e17e4df0daee626a99d85
* Move consumer call outside of the branchPetar Šegina2017-09-081-8/+6
| | | | | Test: bit FrameworksCoreTests:android.text.LayoutTest Change-Id: I4fae9d2b16c22e7ab3856959edc5a57f4276f22f
* Move IntDef constant definitions outside of the annotationPetar Šegina2017-09-081-13/+15
| | | | | | | | | | Constant definitions do not currently work in bat_land - they are not reachable from the test, thus breaking the build. Test: lunch bat_land && make tests Test: bit FrameworksCoreTests:android.text.LayoutTest Bug: 65449093 Change-Id: I6c71fe13fc86a8e2a17e49b16fd558c6714c6f5b
* Emit text direction with selection rectanglePetar Šegina2017-09-061-14/+40
| | | | | | | | | | | | In order to properly perform the smart select animation on right-to-left and mixed text, we need the information about the direction of the text that is present below the selection rectangle. Test: manual - verify selection still works and that the generated directions match the directions of the text on the screen Test: bit FrameworksCoreTests:android.text.LayoutTest Change-Id: I564ee2db59ab583c9bff807ad0d0dfeacaf1386f