Commit Graph

1503 Commits

Author SHA1 Message Date
Seigo Nonaka
bd959fb7d4 Update BoringLayout.isBoring Javadoc
Bug: N/A
Test: TreeHugger

Change-Id: I92fe34eb34facc6011843d679feb78ff0ea44087
2019-01-29 15:14:19 -08:00
Yohei Yukawa
17ace29a10 Deprecate SuggestionSpan#ACTION_SUGGESTION_PICKED
This CL deprecates SuggestionSpan#ACTION_SUGGESTION_PICKED and related
constants [1].

There are multiple security concerns, open questions about
compatibility, and maintainance challanges in this protocol.

IME developers can implement their own suggestion picker UI on top of
CursorAnchorInfo API to achieve safer, should give more flexible UI
options, better security, and better compatibility.

 [1]: Ia539de0acf66053e0349daec459d75e36805f6bf
      f9f0100862

Fix: 123160396
Test: make -j checkbuild
Change-Id: I6d39e838ae47488055162cd44b5f553f68869b17
2019-01-21 09:24:26 -08:00
Kiyoung Kim
0fe161dffd Schematize Display system properties
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
2019-01-15 20:03:11 +00:00
Siyamed Sinir
584d6d8cc5 Change UrlSpanFactory to a Function
Test: atest android.text.util.cts.LinkifyTest
Test: atest android.text.util.LinkifyTest

Bug: 28536972
Bug: 32613009
Bug: 29150779
Bug: 112303511
Change-Id: I73976e3e0bea6e61804d7735fb5901c91cb53758
2019-01-14 11:08:25 -08:00
Qingqing Deng
ef20b233c8 Annotate SuggestionSpan.getUnderlineColor
-- Annotate return value with @ColorInt

Bug: 122517884
Test: atest CtsTextTestCases:android.text.style.cts.SuggestionSpanTest
Change-Id: I3bd7449e2d17cdfa06f3b62358ec1bba667a1fc3
2019-01-09 12:22:02 -08:00
Haoyu Zhang
eccdc6b698 Fix that TextLine overwrites wordSpcing on paint
TextLine is using wordSpcing for justification. And previously,
TextLine will overwrite wordSpcing even justification is not on.
This CL make sure that TextLine only changes wordSpcing when
justification is on.

Bug: 122471618
Test: atest TextLineTest
Change-Id: I6f1e2f6c17b65f92d7a5bb064fdafbf5df9ef8f7
2019-01-08 15:22:27 -08:00
Mathew Inwood
31755f94e1 Limit access to suspected false positives.
Members modified herein are suspected to be false positives: i.e. things
that were added to the greylist in P, but subsequent data analysis
suggests that they are not, in fact, used after all.

Add a maxTargetSdk=P to these APIs. This is lower-risk that simply
removing these things from the greylist, as none of out data sources are
perfect nor complete.

For APIs that are not supported yet by annotations, move them to
hiddenapi-greylist-max-p.txt instead which has the same effect.

Exempted-From-Owner-Approval: Automatic changes to the codebase
affecting only @UnsupportedAppUsage annotations, themselves added
without requiring owners approval earlier.

Bug: 115609023
Test: m
Change-Id: I020a9c09672ebcae64c5357abc4993e07e744687
2018-12-28 11:50:04 +00:00
Haoyu Zhang
882d8fe7b9 Merge "Fix: LineBackgroundSpan calls Canvas.drawRect with wrong parameter" 2018-12-14 20:02:44 +00:00
Andrew Solovay
27e4346490 cherry-pick from pi-dev docs: Fixing malformed javadoc
Several @link & @see javadoc directives were malformed, resulting in the
Javadoc code being output to the HTML.

Staged to:

http://go/dac-stage/reference/android/app/slice/Slice.Builder
http://go/dac-stage/reference/android/app/slice/SliceProvider
http://go/dac-stage/reference/android/text/style/ImageSpan
http://go/dac-stage/reference/android/content/ContentProvider

Bug: 120743732
Test: make ds-docs
Change-Id: I589644f8d266a116441409fbdaf7a0c533e0e356
Exempt-From-Owner-Approval: Doc-only change
2018-12-13 11:45:21 -08:00
Haoyu Zhang
afebcc63f5 Fix: LineBackgroundSpan calls Canvas.drawRect with wrong parameter
Bug: 1526775
Test: atest LineBackgroundSpan_StandardTest
Change-Id: Ic2a23cbaa5e6951359bba3c9a5c1165008583574
2018-12-13 01:41:40 +00:00
Seigo Nonaka
291ef0536d 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
2018-12-10 16:18:02 -08:00
qqd
3cdaa2488f Make getUnderlineColor public.
Bug: 117521361
Test: atest CtsTextTestCases:android.text.style.cts.SuggestionSpanTest
Change-Id: Iafc7fa65b495e5cc5e69809c94c15c947ceab9ca
2018-12-03 14:12:42 -08:00
Neil Fuller
f148c8d7d4 Merge "Track move of timezone classes to libcore.timezone" am: d48dbc9a34 am: f79ecf7c82
am: 402dc485d0

Change-Id: If9c8cfdce9bd0b3bcd460216edca369fd75abdde
2018-11-28 08:24:57 -08:00
Neil Fuller
402dc485d0 Merge "Track move of timezone classes to libcore.timezone" am: d48dbc9a34
am: f79ecf7c82

Change-Id: I1551e5d4330ea290ba3e3054349f79ee28f919c6
2018-11-28 08:10:04 -08:00
TreeHugger Robot
36491d6cc1 Merge "Add StaticLayout constructor to dark-grey list" 2018-11-28 00:36:40 +00:00
Siyamed Sinir
00589be8f9 Add StaticLayout constructor to dark-grey list
Test: None
Bug: 117521430
Change-Id: I304214b7749e5dd87e77b8dfe405aae12e68cbb9
2018-11-27 22:43:09 +00:00
Haoyu Zhang
19b3c371d3 Merge "Make LineHeightSpan.Standard a ParcelableSpan" 2018-11-27 21:02:25 +00:00
Abodunrinwa Toki
adc194032b Do not linkify text with RLO/LRO characters.
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
2018-11-27 15:11:41 +00:00
Neil Fuller
b8383a10b9 Track move of timezone classes to libcore.timezone
Some time zone related libcore classes are moving from
libcore.util to libcore.timezone.

Bug: 119026403
Test: build only
Change-Id: Ic807977a85276b888362295d1d305effe33076fc
2018-11-27 14:44:59 +00:00
Haoyu Zhang
63a5efb46b Make LineHeightSpan.Standard a ParcelableSpan
Implement ParcelableSpan interface for LineHeightSpan.

Bug: 112621694
Test: atest LineHeightSpan_StandardTest
Change-Id: I452a2b12310b525555e908e4d04dda7101693319
2018-11-26 16:54:46 -08:00
TreeHugger Robot
e4e4432545 Merge "Revert "Revert "Refactor TextLine class""" 2018-11-17 01:46:12 +00:00
TreeHugger Robot
5b36e2ba38 Merge "Revert "Revert "Enable PrecomputedText for BiDi text""" 2018-11-17 01:46:12 +00:00
Siyamed Sinir
956213398d Revert "Revert "Enable PrecomputedText for BiDi text""
This reverts commit 321140ad84.

Reason for revert: we thought this CL caused b/119659731 but apparently it is not.

Change-Id: I5b52cc1facec77d6a0d844bcaac53e90c7ecd132
2018-11-16 23:38:23 +00:00
Siyamed Sinir
bf92c2f4f4 Revert "Revert "Refactor TextLine class""
This reverts commit 3c097aa45e.

Reason for revert: we thought this CL caused b/119659731 but apparently it is not.

Change-Id: Id375c4c8f2bffb7c42dc36bc053d536c6ea57a8d
2018-11-16 23:38:12 +00:00
TreeHugger Robot
2dd6939473 Merge "Revert "Refactor TextLine class"" 2018-11-16 21:37:12 +00:00
TreeHugger Robot
5eee684bd4 Merge "Revert "Enable PrecomputedText for BiDi text"" 2018-11-16 21:37:12 +00:00
Siyamed Sinir
321140ad84 Revert "Enable PrecomputedText for BiDi text"
This reverts commit 6224e238d6.

Reason for revert: b/119659731

Change-Id: I33ea82d69d09f113d594446f8979f0df21200662
2018-11-16 20:03:01 +00:00
Siyamed Sinir
3c097aa45e Revert "Refactor TextLine class"
This reverts commit 888dbca2f7.

Reason for revert: <INSERT REASONING HERE>

Change-Id: I259327a6ca507e2614cacdcdabdeca7df48b8ed2
2018-11-16 19:46:28 +00:00
Haoyu Zhang
c826047f85 Merge "Fix getLineLeft crashes when alignment is null" 2018-11-16 00:19:07 +00:00
Seigo Nonaka
6224e238d6 Enable PrecomputedText for BiDi text
Bug: 119312268
Test: atest CtsTextTestCases
Test: atest CtsWidgetTestCases
Test: atest CtsGraphicsTestCases
Change-Id: Ifddf5a35642a22cbb1665fce65c467e6b21bfea6
2018-11-14 17:13:03 -08:00
Haoyu Zhang
d1e6d2e3c6 Fix getLineLeft crashes when alignment is null
Bug: 119221721
Test: atest StaticLayoutGetLineLeftRightTest
Change-Id: If83ac95f47d76052cf088b7d977ee5cded9a8fee
2018-11-14 13:19:14 -08:00
Seigo Nonaka
888dbca2f7 Refactor TextLine class
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
2018-11-14 13:18:38 -08:00
Haoyu Zhang
9b74c07517 Merge "Fix getLineRight()/getLineLeft() may compute leadingMargin twice" 2018-10-30 18:16:44 +00:00
Branden Archer
ea3bcb762d fix spelling typo in comment
Test: typo in comment, no test necessary

Change-Id: I5a56c289e1e29a8eca33d55a77c52e87efa446a2
2018-10-29 08:49:55 -07:00
Nathan Harold
41e2d7494f Merge "Move some members to the "Q blacklist"." am: f5cf9f24ed
am: 13c9e7e2f3

Change-Id: Ia2419cce28d26d9464da2a5172cb332b629e943e
2018-10-24 16:14:06 -07:00
Bill Yi
8b634e9191 Merge pie-platform-release to aosp-master - DO NOT MERGE
Change-Id: I695db52f5e22509401258e8b083e7650d401d993
2018-10-24 14:48:44 -07:00
Mathew Inwood
45d2c252b1 Move some members to the "Q blacklist".
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)
2018-10-22 17:28:24 -07:00
Qingqing Deng
b3e9481f78 Merge "Disable double cursor for BiDi in Layout." 2018-10-22 20:24:52 +00:00
Haoyu Zhang
7425d982f1 Fix getLineRight()/getLineLeft() may compute leadingMargin twice
Bug: 74129926
Test: atest StaticLayoutGetLineLeftRightTest LayoutTest
Change-Id: I5f05d55eb4115d920ac8e5ecb52fbd16fdf60790
2018-10-19 20:53:28 -07:00
qqd
19799c44c4 Disable double cursor for BiDi in Layout.
-- 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
2018-10-19 19:09:22 -07:00
Seigo Nonaka
9958c4ab21 Introduce FontStyle for future extensibility
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
2018-10-19 14:51:59 -07:00
Haoyu Zhang
0a04650e51 Merge "Add textLocale attributes to TextView and TextAppearanceSpan" 2018-10-19 20:30:02 +00:00
Haoyu Zhang
1137512f7c Add textLocale attributes to TextView and TextAppearanceSpan
Bug: 112390716
Test: atest TextAppearanceSpanTest TextViewTest
Change-Id: I812f76cc3acec14b9839436cc7c5cc1ef827998e
2018-10-18 15:38:30 -07:00
Seigo Nonaka
7b86fe573c Change add{StyleRun, ReplacementRun} to append{StyleRun, ReplacementRun}
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
2018-10-18 14:58:18 -07:00
TreeHugger Robot
e9944aa1dc Merge "Make loadSafeLabel a generic facility as makeSafeForPresentation" 2018-10-16 16:21:10 +00:00
TreeHugger Robot
13635f0ec0 Merge "Fix invalid character access" 2018-10-16 09:08:01 +00:00
Seigo Nonaka
5783c13806 Fix invalid character access
The invalid access has introduced by
I976df4db63be241af395dd30dd94182f76bdae53

Bug: 114454225
Test: atest StaticLayoutLineBreakingTest
Change-Id: I8ad3d7761c98eb8ace97af3a4794d4bfe04c05e0
2018-10-15 18:03:44 -07:00
Haoyu Zhang
36252bf2bf Merge "Add default implementation for LineBackgroundSpan" 2018-10-16 00:31:40 +00:00
Seigo Nonaka
aa35899430 Merge "Make LineBreaker public" 2018-10-15 21:56:12 +00:00
Philip P. Moltmann
c1fda744f0 Make loadSafeLabel a generic facility as makeSafeForPresentation
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
2018-10-15 09:11:52 -07:00