Commit Graph

1573 Commits

Author SHA1 Message Date
Jason Hsu
540918349a Merge "Fix talkback did not speak out ReplacementSpan's content description." into rvc-dev am: dac6071aca
Change-Id: I762f05ffdba5a63e1d805beed44e28a8020fbc33
2020-05-30 01:12:12 +00:00
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
Neil Fuller
29867f046d Merge "Be more defensive around invalid tzids" am: f60c302dad am: 96c57398b4
Change-Id: If8695ee257155eaedc901aa797f1939eab0c721e
2020-05-26 10:54:50 +00:00
Neil Fuller
26fe60a188 Be more defensive around invalid tzids
Add checks during boot in case the persist.sys.timezone property is set
to a bad ID.

This can happen in the rare case of a mainline rollback: i.e. if a device has
been set to a new ID and then the update is rolled back. Using GMT as a
fallback probably works without this change (it does in java.util.TimeZone),
but relies on all code, including native code that uses
persist.sys.timezone directly, knowing to interpret a bad ID as "GMT".
This commit makes that choice more explicit and defensive.

This change also removes the possibility of IOException, which is never
thrown, from some ZoneInfoDb methods.

Bug: 155738410
Test: boot with a valid id, verify persist.sys.timezone is unchanged
Test: boot with an invalid id set,  verify persist.sys.timezone is "GMT"
Merged-In: I6dc0f4f81848efbbaec6a11a62014471a0ef01fd
Change-Id: I6dc0f4f81848efbbaec6a11a62014471a0ef01fd
Exempt-From-Owner-Approval: Approved / landed internally
2020-05-26 10:19:53 +00:00
Andrew Sapperstein
3b0ca2b358 Merge changes from topic "cherrypick-ctor-refs-03y8i58ine" into rvc-dev am: 975ca816ec
Change-Id: I30efa4f3aefc466e138541b34ae8901005ee9902
2020-05-02 00:36:11 +00:00
Andrew Sapperstein
f181c2f44b Fix broken @see tags in public documentation. am: 8fe35e5f21
Change-Id: Ic95104f61b736d05f18c7465e77951771f39fcbf
2020-05-02 00:36:07 +00:00
Andrew Sapperstein
8fe35e5f21 Fix broken @see tags in public documentation.
These were previously being suppressed by doclava but with this change,
all failures are fixed and the suppression logic has been removed.

To fix the issues, there were a few possible changes made:
- broken reference to a public API (such as incorrect parameters): fixed
- unnecessary @link inside an @see tag: fixed
- @see referring to an @hide or @SystemApi: reference removed
- broken references to inner class constructors
 - worked around by fully qualifying the constructor

Bug: 6963924
Test: make doc-comment-check-docs
Exempt-From-Owner-Approval: cherry-picked from master
Change-Id: Ifbdce2de96cdffa560bd90f549fa7184d1f9af85
Merged-In: Ifbdce2de96cdffa560bd90f549fa7184d1f9af85
(cherry picked from commit e0624c7a40)
2020-05-01 18:25:32 +00:00
Lucas Dupin
5ed8accfa2 Merge "Translate text by top" into rvc-dev am: 9d3b2a446e
Change-Id: Idf2aa1f5399d19cd8a642a4d49fd8fd3d9640b21
2020-04-22 18:46:44 +00: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
eb80b15511 Merge changes from topic "apr19" into rvc-dev am: b67e70aa40
Change-Id: Ic5abb1e4e727a6d7869dcb7a46cee64d225c4c61
2020-04-21 23:01:53 +00: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
Fredrik Roubert
f030962cce Merge "Add "ftp" to the list of URL schemes that get linkified." am: cc7a0e7152 am: d13a70de57
Change-Id: I0a0099a4fdc1bcdf76d097313f4f938f3bf9049b
2020-04-01 19:21:38 +00:00
Fredrik Roubert
0b4907e839 Add "ftp" to the list of URL schemes that get linkified.
Fixes: 152892738
Change-Id: I888c5b12ebb417309250a25dc70baedad2cf7d7c
2020-03-31 21:40:41 +02: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