Commit Graph

1547 Commits

Author SHA1 Message Date
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
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
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
Seigo Nonaka
fb1b479314 Hide packing structure from public API
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
2019-03-11 16:51:47 -07:00
Seigo Nonaka
de41eeaafd Address API review from the council
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
2019-03-07 18:23:35 -08:00
Haoyu Zhang
924d93bb31 Convert ImageSpan sample code to Java
Bug: 127617625
Test: make offline-sdk-docs
Change-Id: I74a79fa6f0adc650d175cca3caa61c37df20df38
2019-03-06 15:23:09 -08:00
Haoyu Zhang
7c89460967 Add NonNull annotaion for LineHeightSpan.Standard
Bug: 126699237
Test: atest LineHeightSpan_StandardTest
Change-Id: I527f622077e0899e84ed28dc91f481e5195d735d
2019-03-04 13:23:13 -08:00
Jeff Sharkey
9e8f83db6d All Parcelable CREATOR fields are @NonNull.
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
2019-02-28 23:29:04 -07:00
Lucas Dupin
660d7fc4e8 Make DynamicDrawableSpan#ALIGN_CENTER public API
Bug: 123340905
Test: make update-api
Test: atest DynamicDrawableSpanTest
Change-Id: I0951091710a46434425359b148a9e7ea0adbc3d1
2019-02-21 09:59:51 -08:00
Lucas Dupin
e570af67de Restore keyguard status area header
Fixes: 123340905
Fixes: 123958307
Test: atest KeyguardSliceViewTest
Test: manual, playing media
This reverts commit ed00262486.

Change-Id: I1cc60346f9176b913ee0404b2b31981f736664ce
2019-02-12 15:21:24 -08:00
Haoyu Zhang
97b1d50f82 Add maxTargetSDK equals P for UnsupportedAppUsage of sCached
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
2019-02-06 13:51:58 -08:00
Eugene Susla
85114dc5fe Merge "Migrate system dialer config to RoleManager" 2019-02-05 17:38:16 +00:00
Seigo Nonaka
bd959fb7d4 Update BoringLayout.isBoring Javadoc
Bug: N/A
Test: TreeHugger

Change-Id: I92fe34eb34facc6011843d679feb78ff0ea44087
2019-01-29 15:14:19 -08:00
Eugene Susla
8758d320b4 Migrate system dialer config to RoleManager
Test: adb logcat | grep Telecomm  - to ensure correct default dialer detected
go to settings-default apps and ensure correct dialer selected in UI
Change-Id: Ib34c07b8259875dfb3c8ea848410436cbeec3796
2019-01-28 16:02:32 -08:00
Yohei Yukawa
17ace29a10 Deprecate SuggestionSpan#ACTION_SUGGESTION_PICKED
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
2019-01-21 09:24:26 -08:00
Kiyoung Kim
0fe161dffd Schematize Display system properties
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
2019-01-15 20:03:11 +00:00
Siyamed Sinir
584d6d8cc5 Change UrlSpanFactory to a Function
Test: atest android.text.util.cts.LinkifyTest
Test: atest android.text.util.LinkifyTest

Bug: 28536972
Bug: 32613009
Bug: 29150779
Bug: 112303511
Change-Id: I73976e3e0bea6e61804d7735fb5901c91cb53758
2019-01-14 11:08:25 -08:00
Qingqing Deng
ef20b233c8 Annotate SuggestionSpan.getUnderlineColor
-- Annotate return value with @ColorInt

Bug: 122517884
Test: atest CtsTextTestCases:android.text.style.cts.SuggestionSpanTest
Change-Id: I3bd7449e2d17cdfa06f3b62358ec1bba667a1fc3
2019-01-09 12:22:02 -08:00
Haoyu Zhang
eccdc6b698 Fix that TextLine overwrites wordSpcing on paint
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
2019-01-08 15:22:27 -08:00