Commit Graph

1563 Commits

Author SHA1 Message Date
jasonwshsu
c70a456060 Fix talkback did not speak out ReplacementSpan's content description.
* setContentDescription() back to ReplacementSpan when receiving parcel
* extend writeToParcel to handle AccessibilityReplacementSpan

Bug: 155833272
Test: atest AccessibilityNodeInfoTest#testSetTextWithImageSpan_shouldTextSetToInfo
Change-Id: Iab902bdcee53fc09cbba2c7c06858823524a3af9
2020-05-28 03:34:16 +08:00
Lucas Dupin
9d3b2a446e Merge "Translate text by top" into rvc-dev 2020-04-22 18:42:42 +00:00
Lucas Dupin
798562bfbd Translate text by top
We were centralizing without considering that there could be some
additional translation passed to DynamicDrawableSpan#draw

Test: atest DynamicDrawableSpanTest
Fixes: 154489406
Change-Id: I9615f478d1962b2d6fd54123fc391554073f5bf1
2020-04-21 16:42:27 -07:00
Jeff Sharkey
0223df096c Update some Parcelables to send Strings UTF-8.
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
2020-04-21 22:59:26 +00:00
Rod S
b573a9d949 Update frameworks/base Emoji.java to Unicode 13.
As ICU is updated, delete special cases.

Test: atest core/tests/coretests/src/android/text/EmojiTest.java
Bug: 151964652

Change-Id: I89032c22e5464d257866d926062db34c65943572
(cherry picked from commit 31d7c155b7)
2020-03-19 23:12:53 +00:00
menghanli
a7d97f7ec5 Refines the javadoc of the ReplacementSpan.getContentDescription
- inconsistent for the doc & API implementation.

Bug: 150472098
Test: Manual test
Change-Id: Idb1e35245487ac161225f1e53c6308541694b481
2020-03-18 18:06:36 +08:00
Jayachandran C
207aa3a8e4 Remove API getDefaultSimCountryIso() as per API council feedback
Change Linkify to
1) use fallback context from activity thread when a valid context
   is not passed in the API.
2) use default locale if activity thread returns null context

Bug: 144576376
Bug: 148514283
Test: atest com.android.frameworks.coretests

Change-Id: I145821d12b49fcd4036dafce27857547f293124f
2020-03-09 13:22:36 -07:00
Automerger Merge Worker
fdb676b4dd Merge "Rename ZoneInfoDB -> ZoneInfoDb" am: 402674f2a0 am: c3e31d6ac5 am: f8a4287915
Change-Id: I72978765010e3da52bcdf00299f7ba999bc9201b
2020-01-29 14:33:04 +00:00
Neil Fuller
f14b18e153 Rename ZoneInfoDB -> ZoneInfoDb
Rename ZoneInfoDB -> ZoneInfoDb to conform with coding standards.

Bug: 148086409
Test: treehugger
Change-Id: I2a5eca6bd013d3ca2ba93aabf36745f8873fc6fb
2020-01-28 13:49:48 +00:00
Michael Wallstedt
b73f706c56 Merge "Avoid ambiguous overloads in SpannableStringInternal." 2020-01-10 03:54:29 +00:00
Artur Satayev
2d330f6fa8 Use new UnsupportedAppUsage annotation.
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
Merged-In: I288969b0c22fa3a63bc2e71bb5009fe4a927e154
2020-01-09 15:08:18 +00:00
Artur Satayev
df4395991f Use new UnsupportedAppUsage annotation.
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
2020-01-07 13:29:50 +00:00
Neil Fuller
ee2d1af5d9 Convert some users of Time.format() to an alt.
Convert some frameworks/base/ users of android.text.format.Time.format()
to use calculations based on java.time instead. This avoids future
Y2038 issues associated with Time. A TimeMigrationUtils method is
added that has similar localization behavior to Time's format() method.

This commit only contains a replacement for basic formatting usecases.
Later commits can handle more complex usecases.

The only case that modifies the format is the changes to
CalendarContract.java: the pattern used there was unusual and only
used in logging/debug logic which was switched off by default.

Bug: 16550209
Test: build / boot / treehugger
Test: atest FrameworksCoreTests:android.text.format.TimeMigrationUtilsTest
Change-Id: Ib142979858012bb766b4c107d41a21b0324de506
Merged-In: Ib142979858012bb766b4c107d41a21b0324de506
2019-12-16 09:30:36 +00:00
Mike Wallstedt
6d11ca4423 Avoid ambiguous overloads in SpannableStringInternal.
As documented in Effective Java (http://go/ej3e#page=259), overloaded
methods with the same number of parameters can be confusing when the
parameters are in the same type hierarchy.

Aside from readability concerns, this may be related to some crashes
observed in Photos Android. For example in b/144849105 AutoCompleteViewBinder
calls the SpannedString constructor, which delegates to SpannedStringInternal.
The overload of copySpans that accepts a SpannedStringInternal has a call to
isOutOfCopyRange that should make the failure in checkRange impossible.

Bug: 144849105
Test: Simple refactor.
Change-Id: I47d01cffe6f66c4d631a9ef1341bf118fb6e51e4
2019-12-12 16:19:09 -08:00
Automerger Merge Worker
00d15617ed Merge "Deprecate incorrect year constant" am: 9fbb152eb2 am: 2b446998a1 am: 2c8f4df701
Change-Id: I4ee9f166508b4aaa2b99935e3dbc4307b18a7b0f
2019-12-12 23:54:33 +00:00
Treehugger Robot
9fbb152eb2 Merge "Deprecate incorrect year constant" 2019-12-12 22:56:13 +00:00
Charles Munger
d8e9c3a887 Merge "Deprecate AlteredCharSequence" am: ea4916dac7 am: cb90a87d2e
am: ee6451246e

Change-Id: I990dc63ec32cd6ec7c6f783179a887dcac4c264d
2019-12-10 08:35:53 -08:00
Charles Munger
49d17aa440 Deprecate incorrect year constant
Bug: 144042891
Test: No behavior changes
Change-Id: I5c92f371a49bac3adc4d0174505998b15537a0aa
2019-12-10 08:24:17 -08:00
Charles Munger
ea4916dac7 Merge "Deprecate AlteredCharSequence" 2019-12-10 16:20:40 +00:00
Automerger Merge Worker
57253a47ef Merge "Deprecate LoginFilter" am: 254411a902 am: 755f6ae1a3
Change-Id: I995410bc4e2f56cfad092435eb34a570b58261b7
2019-12-04 18:03:39 +00:00
Treehugger Robot
254411a902 Merge "Deprecate LoginFilter" 2019-12-04 01:45:49 +00:00
Charles Munger
e011b5772c Deprecate AlteredCharSequence
Not used anywhere else in the SDK. Comment indicates it might have been exposed accidentally.

Test: No behavior changes
Bug: 144042891
Change-Id: I79bef5771a33a0cf35637bdc0268dc7d82f74aca
2019-11-22 23:45:51 +00:00
Charles Munger
c24469af09 Deprecate LoginFilter
This class hardcodes incorrect assumptions about Google services into an
open source project.

Bug: 144042891
Test: No behavior changes
Change-Id: Ibf811f6390599633056bf1bfe042cb70b2f0f881
2019-11-22 15:17:45 -08:00
Jayachandran C
dc8cb2905e Add static version of getSimCountryIso() called getDefaultSimCountryIso()
This new system API will use the default subscription to get the ISO

Bug: 140768340
Test: Sanity
Change-Id: I362acaed0085a535104a1f0af606fd0891608c8d
2019-11-15 11:18:52 -08:00
Kevin Chang
143000b23f Merge "Create new API for ImageSpan" 2019-10-08 06:09:44 +00:00
Kevin Chang
78840ec064 Create new API for ImageSpan
Create new API for adding content description into ImageSpan.

Bug: 135497450
Test: Adding CTS tests for new API in linked CL
Change-Id: I6cc58657c1dfbbddf00186aeea1faa0ce876f996
2019-10-02 09:26:39 +08:00
Seigo Nonaka
7c38cafc22 Do not compute outside given range in TextLine
This is second attempt of I646851973b3816bf9ba32dfe26748c0345a5a081
which breaks various layout test on application.
The empty string must be also handled by the TextLine since it
retrieves the default line height from the empty string.

Bug: 140632678
Test: StaticLayoutTest
Test: Manually done
Change-Id: I7089ed9b711dddd7de2b27c9c2fa0fb4cb53a735
2019-09-16 16:12:51 -07:00
Seigo Nonaka
7554fa20b5 Do not compute outside given range in TextLine
This is second attempt of I646851973b3816bf9ba32dfe26748c0345a5a081
which breaks various layout test on application.
The empty string must be also handled by the TextLine since it
retrieves the default line height from the empty string.

Bug: 140632678
Test: StaticLayoutTest
Test: Manually done
Change-Id: I7089ed9b711dddd7de2b27c9c2fa0fb4cb53a735
2019-09-16 22:28:18 +00:00
Adam Seaton
21f57c8264 Merge "Revert "don't compute outside of visible range"" into qt-dev am: e4d9618d67 am: 3d623d54f2 am: a824053914
am: 0956d8ad6e

Change-Id: I9295cc82104dacada13fb28d1429616d968ca5cf
2019-09-14 06:03:54 -07:00
Adam Seaton
b4583e4dcd Revert "don't compute outside of visible range"
bug:141016653
This reverts commit 0a57fe099a.

Reason for revert: CL is implicated in https://b.corp.google.com/issues/141016653

Change-Id: I39954226cb8971ee17e367692b3fd0e29871ad48
2019-09-13 22:09:30 +00:00
Seigo Nonaka
0a57fe099a don't compute outside of visible range
Bug: 140632678
Test: manually done
Test: TreeHugger
Change-Id: I646851973b3816bf9ba32dfe26748c0345a5a081
2019-09-11 11:28:34 -07:00
Seigo Nonaka
a930e6e76f don't compute outside of visible range
Bug: 140632678
Test: manually done
Test: TreeHugger
Change-Id: I646851973b3816bf9ba32dfe26748c0345a5a081
2019-09-11 00:41:13 +00:00
Neil Fuller
b75c38dbe9 Merge "Fix bug in Time.getJulianDay()" 2019-08-28 08:19:13 +00:00
Neil Fuller
5898cc1060 Fix bug in Time.getJulianDay()
Time is generally deprecated because it has various problems
including Y2038 issues. The static Time.getJulianDay() method
doesn't have Y2038 issues but it did have an issue with
negative millis values which is fixed in this commit.

See the associated cts change for improved tests.

Documentation has also been improved in this commit.

Bug: 16550209
Test: atest android.text.format.cts.TimeTest
Change-Id: Ia4092efc92a24cd5741b2a8dd75a0680008cce27
2019-08-21 15:34:55 +01:00
Neil Fuller
7a0837fb0e Fix Y2038 issue in DateUtils.isToday()
Before this change isToday() would stop working in Y2038
because android.text.format.Time doesn't work after Y2038.

This commit fixes the code by using java.time classes that
are Y2038 safe.

Bug: 16550209
Test: atest android.text.format.cts.DateUtilsTest
Change-Id: Ied339a694819c308add8645c7434b645dc1ccdde
2019-08-19 15:19:26 +01:00
Neil Fuller
cac13d44ab Merge "Convert some users of Time.format() to an alt." 2019-07-23 07:49:41 +00:00
Neil Fuller
9aa7b74a7a Convert some users of Time.format() to an alt.
Convert some frameworks/base/ users of android.text.format.Time.format()
to use calculations based on java.time instead. This avoids future
Y2038 issues associated with Time. A TimeMigrationUtils method is
added that has similar localization behavior to Time's format() method.

This commit only contains a replacement for basic formatting usecases.
Later commits can handle more complex usecases.

The only case that modifies the format is the changes to
CalendarContract.java: the pattern used there was unusual and only
used in logging/debug logic which was switched off by default.

Bug: 16550209
Test: build / boot / treehugger
Test: atest FrameworksCoreTests:android.text.format.TimeMigrationUtilsTest
Change-Id: Ib142979858012bb766b4c107d41a21b0324de506
2019-07-19 16:30:30 +01:00
TreeHugger Robot
a33ce8a337 Merge "Fix Layout.primaryIsTrailingPreviousAllLineOffsets" 2019-06-26 00:18:11 +00:00
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
Mihai Popa
71a0018948 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:06:33 +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