Commit Graph

1647 Commits

Author SHA1 Message Date
Mathew Inwood
8e742f928e Add maxTargetSdk restriction to unused APIs.
These are APIs that have @UnsupportedAppUsage but for which we don't
have any evidence of them currently being used, so should be safe to
remove from the unsupported list.

This is a resubmit of ag/12929664 with some APIs excluded that caused
test failures; see bugs 171886397, 171888296, 171864568.

APIs excluded:
Landroid/bluetooth/le/ScanRecord;->parseFromBytes([B)Landroid/bluetooth/le/ScanRecord;
Landroid/os/Process;->myPpid()I
Landroid/os/SharedMemory;->getFd()I
Landroid/hardware/input/InputManager;->INJECT_INPUT_EVENT_MODE_WAIT_FOR_FINISH:I

Bug: 170729553
Test: Treehugger
Change-Id: I8285daa8530260251ecad6f3f38f98e263629ca7
2020-10-29 11:51:12 +00:00
Hongwei Wang
286c33a5c5 Merge "Revert "Add maxTargetSdk restriction to unused APIs."" 2020-10-28 23:58:21 +00:00
Hongwei Wang
050275cd83 Revert "Add maxTargetSdk restriction to unused APIs."
This reverts commit 72f07d6a8a.

Reason for revert: Droidcop-triggered revert due to breakage https://android-build.googleplex.com/builds/quarterdeck?testMethod=testAppZygotePreload&testClass=android.app.cts.ServiceTest&atpConfigName=suite%2Ftest-mapping-presubmit-retry_cloud-tf&testModule=CtsAppTestCases&fkbb=6936597&lkbb=6936969&lkgb=6936551&testResults=true&branch=git_master&target=cf_x86_phone-userdebug>, bug b/171886397

Bug: 171886397
Change-Id: Ibe0f0430a3451477c1ee8ef56a596e91ea1e7672
2020-10-28 20:16:22 +00:00
Mathew Inwood
ee5d369323 Merge "Add maxTargetSdk restriction to unused APIs." 2020-10-28 09:39:20 +00:00
Kohsuke Yatoh
1fa0e0852b Merge "Fix typo in documentation." am: dcaacee8af am: 1d04ebf79b am: fad0f95f46 am: 16e63704ec
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1469677

Change-Id: I3570dfa252795302b901ef024084318b20cd1441
2020-10-28 00:39:11 +00:00
Mathew Inwood
72f07d6a8a Add maxTargetSdk restriction to unused APIs.
These are APIs that have @UnsupportedAppUsage but for which we don't
have any evidence of them currently being used, so should be safe to
remove from the unsupported list.

Bug: 170729553
Test: Treehugger
Change-Id: I4c8fd0006f950de9955242e93968fb0996ceb372
2020-10-27 15:46:07 +00:00
Jeff Sharkey
a0cdb4ca3f Merge "Migrate hot codepaths to formatSimple()." 2020-10-22 20:31:28 +00:00
Jeff Sharkey
305ef9e1cf Migrate hot codepaths to formatSimple().
The recently added TextUtils.formatSimple() can efficiently format
simple strings, roughly 6.5x faster than using String.format().

This change starts using this new method in hot codepaths identified
from pprof traces, and this CL alone should reduce system_process CPU
usage by 0.24%.  Linked bug has detailed pprof screenshots.

Bug: 170978902
Test: atest FrameworksCoreTests:android.text.TextUtilsTest
Exempt-From-Owner-Approval: trivial refactoring
Change-Id: Ie5a21a24be6dfcdb29768fe235e20f050fc111c7
2020-10-22 12:48:13 -06:00
Kohsuke Yatoh
5a6e2cf4ce Fix typo in documentation.
There's no such a thing as SpannedStringBuilder.

Change-Id: I41e1f257bb21807e4fc4943798887519ed5b40a9
2020-10-22 18:44:03 +00:00
TreeHugger Robot
5746484a09 Merge "Fix wrong offset of BiDi text by TextShaper" 2020-10-21 20:05:28 +00:00
Jeff Sharkey
1c08f48253 Apply fixes for EfficientStringsChecker.
The recently-built Error Prone checker has found many instances where
we're always paying the cost of StringBuilder concatenation, even in
the typical cases where preconditions are successfully met.

Benchmarks have shown that even when replacing these with varargs
formatter strings, the default case is 20x faster.

Bug: 170978902
Test: none
Exempt-From-Owner-Approval: trivial refactoring
Change-Id: If8c00bc73467bfb91ec16c162969c9d26ca53646
2020-10-20 22:00:16 -06:00
Jeff Sharkey
caf66d02fd Expand formatSimple() to support widths.
One of the highest-traffic users of String.format() is in the
notification code, which uses argument widths.  To support these
use-cases, this change adds argument width support, with tests.

Bug: 170978902
Test: atest error_prone_android_framework_test
Exempt-From-Owner-Approval: trivial additions
Change-Id: I8e36d4725a6d0cc896dedc5c457eb5f38486d7b6
2020-10-20 21:54:26 -06:00
Seigo Nonaka
170e0949f3 Fix wrong offset of BiDi text by TextShaper
This CL includes:
- Fix relative offset of BidiRun by reviving width calculation in TextLine.
- Fix bidi level buffer offset. It shuold be relative to the substring, but
  the absolute offset was passed.
- Removed paint argument from PositionedGlyph which is not used.

Bug: 171275519
Test: atest android.graphics.text.cts.TextRunShaperTest
Test: atest android.text.cts.TextShaperTest

Change-Id: I36949089d744bdfae61995210b2051866a7510ac
2020-10-19 23:31:35 -07:00
TreeHugger Robot
eac0321ff3 Merge changes from topic "oct16b"
* changes:
  Recommend efficient String operations.
  Simple alternative to String.format().
2020-10-16 22:27:50 +00:00
Jeff Sharkey
af7c5f95cb Simple alternative to String.format().
This purposefully supports only a small handful of substitutions to
improve execution speed.  Benchmarking reveals this optimized
alternative performs 6.5x faster for a typical format string.

Add Preconditions overloads that accept varargs to avoid string
formatting overhead in successful case.

Bug: 170978902
Test: atest FrameworksCoreTests:android.text.TextUtilsTest
Test: ./frameworks/base/libs/hwui/tests/scripts/prep_generic.sh little && atest CorePerfTests:android.text.TextUtilsPerfTest
Change-Id: I3fae4dc95cfc98a61c4a7f07ca0781c4a2ee3be9
2020-10-16 13:44:16 -06:00
Roman Kalukiewicz
34573d564a Merge "Add @Nullable annotation to the parameter of Object.equals() methods." 2020-10-16 01:25:15 +00:00
TreeHugger Robot
7347b89fec Merge "Update TextShaper APIs to address API council feedback" 2020-10-15 23:11:03 +00:00
vichang
c9ba946b80 Merge "Allow the skeleton of "jmma" in DateFormat.getBestDateTimePattern()" am: be4e63522f am: aef91d9f66 am: a222a9b750 am: 4d95bacaa8
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1458400

Change-Id: I44f974bceabcee75250ccd491153ef3ac14f5762
2020-10-15 20:20:06 +00:00
Roman Kalukiewicz
24403f7ef2 Add @Nullable annotation to the parameter of Object.equals() methods.
Those annotations could be inferred by some tools (like Kotlin), but the
https://checkerframework.org/ doesn't check inherited annotations
complaining about all equals() invocations that get nullable argument.

The change was generated by running

find . -name \*.java | xargs sed -i 's/public boolean equals(Object /public boolean equals(@Nullable Object /'

in the frameworks/base directory and by automatically adding and
formatting required imports if needed. No manual edits.

Bug: 170883422
Test: Annotation change only. Should have not impact.
Exempt-From-Owner-Approval: Mechanical change not specific to any component.
Change-Id: I5eedb571c9d78862115dfdc5dae1cf2a35343580
2020-10-15 10:48:01 -07:00
Seigo Nonaka
c489d627c9 Update TextShaper APIs to address API council feedback
This CL contains followings:
- Rename TextShaper to TextRunShaper, StyledTextShaper to TextShaper
- Renamed getTotalAdvance to getAdvance
- Rename getStyle to getGlyphStyle
- Rename getOriginX/Y to getOffsetX/Y
- Rename getPositionX/Y to getGlyphX/Y
- Fixed some documentation errors.
- Remvoed GlyphStyle. Added GlyphConsumer instead.

Bug: 170255480
Test: atest TextShaperRunTest GlyphStyleTest TextShaperTest

Change-Id: I0ffd7a3374e9cd1e04872240c2d0da26bc530244
2020-10-14 21:12:36 -07:00
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
Sudheer Shanka
389a1de0ac Merge "Avoid NPE in trimToLengthWithEllipsis()." 2020-10-08 20:15:47 +00:00
Sudheer Shanka
bfdc47752e Avoid NPE in trimToLengthWithEllipsis().
Currently, the text paramter is annotated with @Nullable
but passing a null value will cause an NPE.

Test: atest core/tests/coretests/src/android/text/TextUtilsTest.java
Change-Id: I95a71246aa0fe3398f09cb9b4b037ca096900ad4
2020-10-08 01:46:06 -07:00
Kohsuke Yatoh
291a0f9682 Add API to differentiate grammar suggestions.
The following attributes are added for grammar suggestions.
- SuggestionSpan#FLAG_GRAMMAR_ERROR
- SuggestionsInfo#RESULT_ATTR_LOOKS_LIKE_GRAMMAR_ERROR

Bug: 166304720
Test: atest CtsInputMethodTestCases:SpellCheckerTest
Change-Id: I0e5da3125d28bb881e513d0d69e0a2d336a9f286
2020-10-05 23:29:14 -07:00
Seigo Nonaka
f3a1915b2e Add TextShaper API
TextShaper API provides a primitive text layout result, e.g. what glyph is used etc.

Here is the new APIs and its description

- PositionedGlyphs
This is a native instance backed object that gives layout information to developers.

- GlyphStyle
The glyph style is an object that holds the parameters that will be used for drawing.
This object is a subset of the Paint object for avoiding creating lots of Paint copy.

- TextShaper#shapeText
This does a text shaping and gives TextShaper.Result. This is a native backed primitive
shaping API.

- StyledTextShaper
This is a text shaper for a styled text. This will be the top-level developer facing
API for shaping text.

Bug: 168048923
Test: atest FontTest TextShaperTest StyledTextShaperTest
Change-Id: I2e91d1ef8503b25b28efc94da7de7cad49c4c1a9
2020-09-29 12:38:28 -07:00
Jeff Sharkey
4b5b0174d0 Merge changes from topic "sep11" am: c0b288133a am: 69e6f07347 am: 741c0a78cc am: da7478b570 am: 487d394296
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1426195

Change-Id: Id01f468b43fd5b2aada78608010625b392c1b647
2020-09-15 21:01:48 +00: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
Siyamed Sinir
bc372d0352 Merge "Remove clarabayarri from text OWNERS" am: 3fe6523d2f am: 153ae28af7 am: c7790b29ad am: 0e72570b88 am: 3d690999c3
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1406974

Change-Id: Ifff11b7d1ff7487e15a4c3b62fef285be6928f0c
2020-08-24 12:38:45 +00:00
Siyamed Sinir
c7790b29ad Merge "Remove clarabayarri from text OWNERS" am: 3fe6523d2f am: 153ae28af7
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1406974

Change-Id: I36b8f7edad6cd11e54c89c8adcc43177710d8fac
2020-08-24 11:30:56 +00:00
Clara Bayarri
0ac2e4ac31 Remove clarabayarri from text OWNERS
Change-Id: Ic67b5937d150096fddfe839d3406b29ba4bcb3a7
2020-08-21 17:07:57 +00:00
vichang
bf325c8d05 Merge "Update language in android.text.format to comply with Android’s inclusive language guidance" am: f7b2126b75 am: 80a5722b9b am: ecf22c3507 am: 21ddfb5a16 am: 0f813ef386
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1373056

Change-Id: I0a54d1b90eb7f0dace467d6fe9743c92e943fa3c
2020-07-28 16:30:07 +00:00
vichang
ecf22c3507 Merge "Update language in android.text.format to comply with Android’s inclusive language guidance" am: f7b2126b75 am: 80a5722b9b
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1373056

Change-Id: I453f4d3d600865773861dcb6e78c51185cd037f9
2020-07-28 15:45:40 +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
e78ac20b5d Merge "Update language to comply with Android’s inclusive language guidance" am: dce2f1c04b am: c686b1f21c am: 50015ad612 am: 7ee1dc7321 am: 0ead0fc382
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1371481

Change-Id: Ib0e78ce48eaa0be5cc8dc69d3e5674ac8722a287
2020-07-23 21:14:35 +00:00
Treehugger Robot
50015ad612 Merge "Update language to comply with Android’s inclusive language guidance" am: dce2f1c04b am: c686b1f21c
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1371481

Change-Id: I05712223149c676ae849114562ef6969fbe8ab18
2020-07-23 20:29:38 +00:00
Treehugger Robot
dce2f1c04b Merge "Update language to comply with Android’s inclusive language guidance" 2020-07-23 17:56:04 +00:00
vichang
4909d91045 Merge "Add vichang into OWNER of android.text.format" am: ed7ca56dfc am: 2965200e3c am: c2bfd3c51b am: a75069f84f am: 11ea5fdd5a
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1367377

Change-Id: Iff83d217afef03039256508b31da0fd7c2b1b425
2020-07-23 13:08:04 +00:00
vichang
c2bfd3c51b Merge "Add vichang into OWNER of android.text.format" am: ed7ca56dfc am: 2965200e3c
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1367377

Change-Id: I0226581d23d34a7f3e8ad1377274cf8193d240d4
2020-07-23 12:18:34 +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
vichang
2b05393251 Merge "Remove @CorePlatformApi LocaleData usage in frameworks" am: 3f89b904a8 am: 226e3d7641 am: 9ee26b06fb am: f82c013ec3 am: 6e4f9e9e06
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1367376

Change-Id: I7f0c730abced6a03fb8952d602a398a724667569
2020-07-22 20:28:18 +00:00
vichang
9ee26b06fb Merge "Remove @CorePlatformApi LocaleData usage in frameworks" am: 3f89b904a8 am: 226e3d7641
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1367376

Change-Id: Ib23a5ff1491c89d5cd0f962b1f609c988111c18b
2020-07-22 19:48:40 +00:00
vichang
3f9e52d88b Merge "Use DateFormatSymbols directly instead of using LocaleData" am: 3bd9f08ae5 am: da5838aa43 am: 36a3657be8 am: afbfec08c7 am: eb59659998
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1364767

Change-Id: I4dd7683e1473cde7ea560d43de38ad640fe752f6
2020-07-21 17:53:25 +00:00
vichang
36a3657be8 Merge "Use DateFormatSymbols directly instead of using LocaleData" am: 3bd9f08ae5 am: da5838aa43
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1364767

Change-Id: I8fbfc4e551396b32c1aafab4aa750af1baa7c827
2020-07-21 16:56:31 +00:00
vichang
ebafe9a39d Merge "Remove the duplicated constant declaration in DateUtilsBridge" am: 3db0441e5c am: c52a84acf3 am: 70862e266e am: ba3ebf0844 am: a23606dd5e
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1364765

Change-Id: If89ea1b23a0e34f2f5e556b79f73c44dd257f0bc
2020-07-21 10:23:41 +00:00
vichang
36bde75bdc Merge changes from topic "DateIntervalFormat" am: 6e706c4cee am: 85c56c1fa4 am: c675c3e826 am: d7b8bede26 am: 076b3347b7
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1365636

Change-Id: I987c7a0bf346d6805b615586a3afe76702f30456
2020-07-21 10:22:49 +00:00
vichang
70862e266e Merge "Remove the duplicated constant declaration in DateUtilsBridge" am: 3db0441e5c am: c52a84acf3
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1364765

Change-Id: Iab8475912ecf95b90d24eb5b2dc9165e4442a347
2020-07-21 09:36:43 +00:00
vichang
c675c3e826 Merge changes from topic "DateIntervalFormat" am: 6e706c4cee am: 85c56c1fa4
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1365636

Change-Id: I6ff83f882fac3cf045defe4aa297495d3b011ddc
2020-07-21 09:36:18 +00: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