Commit Graph

1595 Commits

Author SHA1 Message Date
Victor Chang
02d0c76bc6 Allow the skeleton of "jmma" in DateFormat.getBestDateTimePattern()
'a' and 'j' specify the intent to use 12-hour format,
and the locale default 12-hour format, and they shouldn't be used
in the same skeleton, because they contradict to each other.

A skeleton, e.g. "jmma", is mapped into "ahmma" internally
by #mapSkeletonMetacharacters, and thus the internal skeleton
has duplicated fields "a".

This is a regression when we moved the implementation of
android.text.format.DateFormat#getBestPattern() from
udatpg_getBestPattern in ICU4C to ICU4j DateTimePatternGenerator
in the CL https://r.android.com/1355735.
The expected pattern generated from skeleton of "jmma" is
"h:mm a".

Bug: 170233598
Test: DateFormatTest
Change-Id: I13929f4b5bc66aaa90e0cef666cf52d7c32122ac
2020-10-14 14:10:01 +01:00
Jeff Sharkey
a8cec413b6 Update language to comply with Android's inclusive language guidance
See https://source.android.com/setup/contribute/respectful-code for reference

Test: none
Bug: 168334533
Exempt-From-Owner-Approval: docs updates
Change-Id: I245b8d9cac722da76ea67983738a3cbb9deb68df
2020-09-14 10:00:07 -06:00
Xin Li
628590d7ec Merge Android R (rvc-dev-plus-aosp-without-vendor@6692709)
Bug: 166295507
Merged-In: I3d92a6de21a938f6b352ec26dc23420c0fe02b27
Change-Id: Ifdb80563ef042738778ebb8a7581a97c4e3d96e2
2020-08-31 21:21:38 -07:00
Clara Bayarri
0ac2e4ac31 Remove clarabayarri from text OWNERS
Change-Id: Ic67b5937d150096fddfe839d3406b29ba4bcb3a7
2020-08-21 17:07:57 +00:00
vichang
f7b2126b75 Merge "Update language in android.text.format to comply with Android’s inclusive language guidance" 2020-07-28 15:08:47 +00:00
Victor Chang
304910489a Update language in android.text.format to comply with Android’s inclusive language guidance
See https://source.android.com/setup/contribute/respectful-code for reference

Bug: 161896447
Test: m droid
Change-Id: I643275c1ea39fa1a5fef7283076827b93dffcab1
2020-07-27 15:44:28 +01:00
Treehugger Robot
dce2f1c04b Merge "Update language to comply with Android’s inclusive language guidance" 2020-07-23 17:56:04 +00:00
Seigo Nonaka
f47561320f Update language to comply with Android’s inclusive language guidance
See https://source.android.com/setup/contribute/respectful-code for reference

Bug: 161896447
Test: atest TextViewTest
Change-Id: I83f253f6edfb2724972793b3495835540b7b52e4
2020-07-22 22:54:14 -07:00
Victor Chang
bbe4493efb Add vichang into OWNER of android.text.format
Most android.text.format classes are wrappers of ICU4J or libcore.

Test: n/a
Change-Id: I3269efece738cfc7344d1823f7a79677f6cb93fc
2020-07-20 21:17:48 +01:00
Victor Chang
55a6efbfd9 Remove @CorePlatformApi LocaleData usage in frameworks
They can be replaced by the public API provided by ICU4J instead.
No extra layer of caching equivalent to the LocaleData cache is
added because ICU4J has caches instances, e.g. DateFormatSymbols,
etc.

Bug: 160606356
Test: atest FrameworksCoreTests:android.text.format
Change-Id: I07048e0e1a4835d2744b7fce6a5ed79a112e456b
2020-07-20 21:09:40 +01:00
Victor Chang
c744bd5f64 Use DateFormatSymbols directly instead of using LocaleData
Bug: 160606356
Test: atest FrameworksCoreTests:android.text.format
Change-Id: Id5d70328ab146d439ed45135e0fa9d1b9cc95257
2020-07-20 21:09:40 +01:00
Victor Chang
6a691eeec7 Remove the duplicated constant declaration in DateUtilsBridge
Bug: 160606356
Test: m droid FrameworksCoreTests
Change-Id: Ifa79b2a29c6fc0c767337efe569da2d2ba29f959
2020-07-20 21:09:40 +01:00
Victor Chang
3a3a8ada42 Make a copy of DateIntervalFormat from libcore - part 2
Bug: 160606356
Test: atest FrameworksCoreTests:android.text.format
Change-Id: I4c4253c707211f2a5ee0a11da107ab1dd6c4fab8
2020-07-20 21:09:40 +01:00
Victor Chang
8ee3807a01 Make a copy of DateIntervalFormat from libcore
It allows the removal of @CorePlatformApi in libcore.icu

Bug: 160606356
Test: n/a
Change-Id: Id0ed2d212b6cd84ff73edc70794e002ea5f63cd0
2020-07-16 16:23:58 +01:00
vichang
f5ed148053 Merge changes from topic "DateUtilsBridge" am: 59d12aa8bd am: f65666d055
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1356708

Change-Id: Idd5d71f2d6b787ddbece60746c97dd2713ecc7cc
2020-07-13 10:22:38 +00:00
vichang
59d12aa8bd Merge changes from topic "DateUtilsBridge"
* changes:
  Move/Copy some libcore.icu classes to android.text.format
  Copy some libcore.icu classes to android.text.format
2020-07-13 10:02:16 +00:00
vichang
8a202538bc Merge "Remove libcore.icu.ICU usage in android.text.format.DateFormat" am: ec71624f22 am: 3b25f55042
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1355737

Change-Id: Ibc2b1561f316afe2371d9549190a0c328a180141
2020-07-13 02:31:18 +00:00
Victor Chang
5e348b2a28 Move/Copy some libcore.icu classes to android.text.format
Bug: 160606356
Test: atest FrameworksCoreTests:android.text.format
Change-Id: I5a3e954419e8bd282ec5dd057b241c3572be6831
2020-07-10 18:00:29 +00:00
Victor Chang
cdf1423650 Copy some libcore.icu classes to android.text.format
Bug: 160606356
Test: N/A
Change-Id: I408ed56e240d2379fb49a52a19f134d83a2b601f
2020-07-07 18:30:55 +01:00
Victor Chang
a0d05f4fdc Remove libcore.icu.ICU usage in android.text.format.DateFormat
The methods can be implemented with ICU4J directly.

Bug: 160606356
Test: atest android.text.format.DateFormatTest
Test: atest CtsTextTestCases:android.text.format.cts.DateFormatTest
Change-Id: I3d5f639a94026c599b487563c95bf9d165adfeec
2020-07-06 21:30:24 +01:00
vichang
26ed852eaf Merge "Use new package name for ZoneInfo and libcore.timezone" am: af6f8e2301 am: 64937407f2
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1346485

Change-Id: I5ded5092e4c7706f58417a5c97f3207524b44a95
2020-06-30 17:23:46 +00:00
Victor Chang
2ea241f6ee Use new package name for ZoneInfo and libcore.timezone
Bug: 141747409
Test: None
Merged-In: Id99a345ec024179295063c3644f72c062cb50554
Change-Id: Id99a345ec024179295063c3644f72c062cb50554
2020-06-30 13:53:47 +01:00
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