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
Not used anywhere else in the SDK. Comment indicates it might have been exposed accidentally.
Test: No behavior changes
Bug: 144042891
Change-Id: I79bef5771a33a0cf35637bdc0268dc7d82f74aca
This class hardcodes incorrect assumptions about Google services into an
open source project.
Bug: 144042891
Test: No behavior changes
Change-Id: Ibf811f6390599633056bf1bfe042cb70b2f0f881
Create new API for adding content description into ImageSpan.
Bug: 135497450
Test: Adding CTS tests for new API in linked CL
Change-Id: I6cc58657c1dfbbddf00186aeea1faa0ce876f996
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
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
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
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
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
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
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
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
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
This is from API council feedback.
Bug: 124794899
Test: atest CtsTextTestCases
Test: atest CtsGraphicsTestCases
Change-Id: Ifa95f87067239cca9c0791bf079045e4f645c3ad
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
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
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
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
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
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
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