Commit Graph

1524 Commits

Author SHA1 Message Date
Mihai Popa
7ad499d007 Fix Layout.primaryIsTrailingPreviousAllLineOffsets
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
2019-06-25 23:09:02 +00:00
Torne (Richard Coles)
aa68ab8288 Clarify problems with Linkify.MAP_ADDRESSES.
Update the documentation for WebView.findAddress, as well as the related
functionality in Linkify and TextView, to clarify why the method is
deprecated, why it should not be used, and that it can cause unexpected
exceptions to be thrown from several places on older OS versions.

Fixes: 24676033
Test: m offline-sdk-docs
Change-Id: I45d82b9a4c9cf62d9566898dd21cd2139ad98f37
2019-06-04 14:14:05 -04:00
Qingqing Deng
41f9d352cd Update isNewEmoji to check Unicode 12.
Bug: 127811703
Test: Verified on Device.
Test: atest frameworks/base/core/tests/coretests/src/android/text/EmojiTest.java
Test: atest cts/tests/tests/text/src/android/text/cts/EmojiTest.java
Change-Id: Id2409dd96243bf74ff1c717a8cc458a6ebf24deb
2019-05-20 15:19:35 -07:00
Anton Hansson
a6101e8b2d Make data warning notification use IEC units
This makes the number presented to the user consistent between
Settings and the notification. Previously the notification used
SI units while Settings used IEC units.

I haven't tested the TYPE_LIMIT_SNOOZED notification as I'm not
sure how to trigger it (though I don't see any reason why it
wouldn't get the same treatment).

Bug: 91635986
Test: manually:
      1) set a limit for 10 MB
      2) use >10 MB of data
      3) verify notification and Settings agree on data use
Change-Id: I31f157332ac273ae260651eb426ab97258180176
2019-03-29 15:50:09 +00:00
TreeHugger Robot
0a8d0b237a Merge "Add code sample and result image for LineHeightSpan" 2019-03-20 16:01:50 +00:00
TreeHugger Robot
117b108506 Merge "Update LineBackgroundSpan.Standard java doc" 2019-03-19 17:23:01 +00:00
Haoyu Zhang
7ad6a515d8 Update LineBackgroundSpan.Standard java doc
Add code demo and result image.

Bug: 1526775
Test: make offline-sdk-docs
Change-Id: Ie8f7aa67a49dd79389e3973c2d94a204a1315e11
2019-03-18 17:46:23 -07:00
Haoyu Zhang
10b1aeec15 Add code sample and result image for LineHeightSpan
Bug: 112621694
Test: make offline-sdk-docs
Change-Id: I6d8f022eb24d1d1b17a97999d15a798a04ec0df3
2019-03-18 16:49:50 -07:00
TreeHugger Robot
7e8c759140 Merge "Change TabStop type from int to float" 2019-03-13 23:00:28 +00:00
TreeHugger Robot
4d64b65dc0 Merge "Convert ImageSpan sample code to Java" 2019-03-13 11:11:06 +00:00
Seigo Nonaka
d5621edc35 Change TabStop type from int to float
This is from API council feedback.

Bug: 124794899
Test: atest CtsTextTestCases
Test: atest CtsGraphicsTestCases
Change-Id: Ifa95f87067239cca9c0791bf079045e4f645c3ad
2019-03-12 12:27:47 -07:00
Seigo Nonaka
fb1b479314 Hide packing structure from public API
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
2019-03-11 16:51:47 -07:00
Seigo Nonaka
de41eeaafd Address API review from the council
Here are the list this CL includes:
- Adding missing @NonNull, @Nullable, @IntRange annotations
- Added @Px annotation to Paint.set/getWordSpacing
- Change Builder classes to final.
- Change FileDescriptor to ParcelFileDescriptor as described in guideline.
- With this change, additional error handling is required in old
  Typeface.Builder but we can keep the same behavior (silently fallback to
  system fallback in error case).
- Fix comment in getLineHyphenEdit in LineBreaker.Result
- Rename setJustified to setJustificationMode in LineBreaker.Builder

Fix: 126702154
Fix: 126701272
Fix: 126701569
Fix: 126701953
Fix: 126701507
Fix: 126701667
Fix: 126700866
Fix: 126701009
Fix: 126700795
Fix: 126700292
Fix: 126699209
Fix: 124795407
Fix: 124795470
Bug: 124794844
Bug: 124794899

Test: m update-api
Test: TreeHugger

Change-Id: If6e8566b0eef9151d35d75b7f258128d7d3df358
2019-03-07 18:23:35 -08:00
Haoyu Zhang
924d93bb31 Convert ImageSpan sample code to Java
Bug: 127617625
Test: make offline-sdk-docs
Change-Id: I74a79fa6f0adc650d175cca3caa61c37df20df38
2019-03-06 15:23:09 -08:00
Haoyu Zhang
7c89460967 Add NonNull annotaion for LineHeightSpan.Standard
Bug: 126699237
Test: atest LineHeightSpan_StandardTest
Change-Id: I527f622077e0899e84ed28dc91f481e5195d735d
2019-03-04 13:23:13 -08:00
Jeff Sharkey
9e8f83db6d All Parcelable CREATOR fields are @NonNull.
If they were null, then the Parcelable would fail to work.

Bug: 126726802
Test: manual
Change-Id: I7929ffa2f20e5de1c8e68e8263cca99496e9d014
Exempt-From-Owner-Approval: Trivial API annotations
2019-02-28 23:29:04 -07:00
Lucas Dupin
660d7fc4e8 Make DynamicDrawableSpan#ALIGN_CENTER public API
Bug: 123340905
Test: make update-api
Test: atest DynamicDrawableSpanTest
Change-Id: I0951091710a46434425359b148a9e7ea0adbc3d1
2019-02-21 09:59:51 -08:00
Lucas Dupin
e570af67de Restore keyguard status area header
Fixes: 123340905
Fixes: 123958307
Test: atest KeyguardSliceViewTest
Test: manual, playing media
This reverts commit ed00262486.

Change-Id: I1cc60346f9176b913ee0404b2b31981f736664ce
2019-02-12 15:21:24 -08:00
Haoyu Zhang
97b1d50f82 Add maxTargetSDK equals P for UnsupportedAppUsage of sCached
We figured out this non-SDK API is mainly used for a previous
memory workaround. Since the bug was fixed, this API is not
allowed to access.

Bug: 123768439
Test: N/A
Change-Id: Ib04bf7e630aee0896c8432aa9c5b794440ea7a2d
2019-02-06 13:51:58 -08:00
Eugene Susla
85114dc5fe Merge "Migrate system dialer config to RoleManager" 2019-02-05 17:38:16 +00:00
Seigo Nonaka
bd959fb7d4 Update BoringLayout.isBoring Javadoc
Bug: N/A
Test: TreeHugger

Change-Id: I92fe34eb34facc6011843d679feb78ff0ea44087
2019-01-29 15:14:19 -08:00
Eugene Susla
8758d320b4 Migrate system dialer config to RoleManager
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
2019-01-28 16:02:32 -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