In I021ff2a97a60396fb1b6e4940d91d3cd6ccb6196, new API for
InputFilter.AllCaps was added. It accepted null as input. This CL
changes that so null locales would be rejected.
Test: bit CtsTextTestCases:android.text.cts.InputFilter_AllCapsTest
Fixes: 64261334
Bug: 37222101
Change-Id: Ic87942c3f341f71bc3c1c833b52ea3e751461e47
Resources.getFont may load other package's font. Stop loading font
resources unless the developer allowed to do so.
Bug: 64115349
Bug: 35763094
Bug: 62813533
Test: bit CtsTextTestCases:android.text.style.cts.TextAppearanceSpanTest
Change-Id: Ifa1b57a70650ba086b38407c0ed5b4048983e7e5
This reverts commit 0d253e46aa.
The original CL changed Typeface internal methods and broke
TypefaceCompatApi26Impl in support library which uses reflections.
Ideally, TypefaceCompatApi26Impl must fall back to public API
implementation but due to lack of method availability check, it ended up
crashing the application.
The original patch didn't change any behaviors in MR1, so reverting
that change is the best solution for MR1.
Bug: 64033594
Change-Id: Ie86afeb1b809e57915d62c1db5a70c8d210d2354
Test: N/A
To be able to parcel/unparcel Typeface, keep it in static context.
Bug: 62850669
Test: Manually done
Test: bit CtsTextTestCases:android.text.style.cts.TextAppearanceSpanTest
Change-Id: I408cd33b98d8bb13776560231d1eeaac0a7c6bf8
(cherry picked from commit c49ee3bde9)
Also clean up lower-level drawing of strike-through in Cavas.cpp.
We still cannot use the strike-through information from the font
since Skia doesn't provide it, so we are going with the default
values.
Test: Manual
Test: bit CtsTextTestCases:*
Test: adb shell am instrument -w -e package android.text com.android.frameworks.coretests/android.support.test.runner.AndroidJUnitRunner
Bug: 32907446
Change-Id: Iee6f8102a35eba0ff4127dbbef189529ab573e6d
Use ICU's MeasureFormat to the degree possible for formatting file
sizes.
Bug: 36994779
Test: adb shell am instrument -w -e package android.text com.android.frameworks.coretests/android.support.test.runner.AndroidJUnitRunner
Test: bit CtsTextTestCases:*
Change-Id: I4ad3b568ae7585b6ff56fddb79ded7c5b2118176
Introduce new attribute "fallbackFor" to font element.
By specifying name of the family to this attribute, that font is used
when the developer specifies the font family.
For example, if fonts.xml has the following family entry,
<family lang="ja">
<font fallbackFor="serif">NotoSerifJP-Regular.ttf</font>
<font>NotoSansJP-Regular.ttf</font>
</family>
the Japanese text is rendered by NotoSansJP-Regular.ttf by default.
Then, if developer specifies fontFamily="serif" in TextView, the Japanese
text is rendered by NotoSerifJP-Regular.ttf.
Bug: 37328609
Bug: 31491668
Test: bit FrameworksCoreTests:android.graphics.TypefaceSystemFallbackTest
Change-Id: I2744db7384c8056795e841c88b387545434131f4
Previously, localizable strings were used instead, causing various
difficulties and inconsistencies. The formatting code also
hard-coded the pluralization rules for English and used it for all
locales.
Now we use ICU's MeasureFormat. There are some small formatting
differences with the previous code, but they are not important,
especially since the old strings were not necessarily well-thought.
Bug: 36994779
Test: adb shell am instrument -w -e package android.text com.android.frameworks.coretests/android.support.test.runner.AndroidJUnitRunner
Change-Id: Ie8cb119a76e89e2ee971353761fbd54e0d9a556c
Previously, locale lists and LocaleSpans were ignored in deciding line
breaking and hyphenation in layouts.
Now, we pass both changing locale information and the whole locale
list to Minikin.
Fixes: 21571721
Bug: 25122192
Test: adb shell am instrument -w -e package android.text com.android.frameworks.coretests/android.support.test.runner.AndroidJUnitRunner
Change-Id: Ia93b0b7cbe54de65bb0ec4937e65cc7993559a6f
Previously, it was using the locale's country code, which doesn't
make sense, since the locale's country code means which dialect of
the language the system should function in. We should use the SIM
card's country code instead.
Change-Id: Ib942f92f3218c943669fc6150d6cc6b4e340b451
Fixes: 30000652
Test: cts-tradefed run cts-dev --module CtsTextTestCases
Test: adb shell am instrument -w -e package android.text com.android.frameworks.coretests/android.support.test.runner.AndroidJUnitRunner
Test: Manual
The new code support non-BMP characters, as well as locale-specific
uppercasing and fine-grained span copying.
The modern capitalization code in AllCapsTransformationMethod is
moved to TextUtils now, so InputFilter.AllCaps can share it.
Fixes: 37222101
Test: New CTS and core tests are added.
Test: cts-tradefed run cts-dev --module CtsTextTestCases
Test: adb shell am instrument -w -e package android.text com.android.frameworks.coretests/android.support.test.runner.AndroidJUnitRunner
Change-Id: I021ff2a97a60396fb1b6e4940d91d3cd6ccb6196
Previously, font underline position and thickness were fixed in Android.
Although a custom font may have specified a different value, such a value
would never be used. Now we use the values from the font if they are
provided and fall back to the old default values only if needed.
Bug: 62353930
Test: adb shell am instrument -w -e package android.graphics com.android.frameworks.coretests/android.support.test.runner.AndroidJUnitRunner
Test: adb shell am instrument -w -e package android.text com.android.frameworks.coretests/android.support.test.runner.AndroidJUnitRunner
Test: cts-tradefed run cts-dev --module CtsTextTestCases
Test: Manual
Change-Id: I6bf21000dd69a2780c894b231638bc0c122e41f4
In TextLine#handleRun(), exit early and shape the text as one whole
if there were spans, but none of them were a subclass of
MetricAffectingSpan or CharacterStyle.
Change-Id: I859c896ddb9c4828bfddf200e913e98262da6ea3
Fixes: 30985144
Test: cts-tradefed run cts-dev --module CtsTextTestCases
Test: adb shell am instrument -w -e package android.text com.android.frameworks.coretests/android.support.test.runner.AndroidJUnitRunner
Also, in TextLine, fix underline color and thickness to come from the
underline info rather than the TextPaint object.
Bug: 32907446
Bug: 62353930
Test: Manual
Test: cts-tradefed run cts-dev --module CtsTextTestCases
Test: cts-tradefed run cts-dev --module CtsWidgetTestCases
Change-Id: I259e9cf635a7056ccd367baa77c03100c69e3b98
Previously, we had singled out UnderlineSpan for special treatment
for proper kerning at span boundaries. That had the limitation that
any other span that used underlining, or even subclasses of
UnderlineSpan were not getting the fix.
With this CL, we actually look at all the effects of applying a
span's updateDrawState() and if the changes were only in underlining,
we merge the pieces and call handleText() on the merged chunk of
text.
Change-Id: I829162c758192b80594f164d1105699224b627ba
Bug: 32907446
Test: cts-tradefed run cts-dev --module CtsTextTestCases
Test: cts-tradefed run cts-dev --module CtsWidgetTestCases
Test: manual
Previously, text that was partially annotated with an UnderlineSpan
could have a different width than text without it, since underlined
text was separated into a separate piece of text and was measured
separately, causing kerning at the span boundaries to disappear.
Change-Id: I118de8524c500fb6a4b05b1bf65fe93dc67f204c
Bug: 32907446
Test: cts-tradefed run cts-dev --module CtsTextTestCases
Test: manual
The changes in I666da5eeb39f780c341597f347bfcba21eb34295 introduced
the concept of lines that need to be always redrawn, but it broke
tests for DynamicLayout#updateBlocks() that didn't need to set up the
actual lines.
Now, during the test setup, we insert empty lines to match the number
of lines needed.
Test: adb shell am instrument -w -e class android.text.DynamicLayoutBlocksTest com.android.frameworks.coretests/android.support.test.runner.AndroidJUnitRunner
Test: adb shell am instrument -w -e class android.text.DynamicLayoutTest#testGetBlocksAlwaysNeedToBeRedrawn_thai com.android.frameworks.coretests/android.support.test.runner.AndroidJUnitRunner
Test: adb shell am instrument -w -e class android.text.DynamicLayoutTest#testGetBlocksAlwaysNeedToBeRedrawn_en com.android.frameworks.coretests/android.support.test.runner.AndroidJUnitRunner
Test: cts-tradefed run cts-dev --module CtsTextTestCases
Change-Id: I4bfc82db4beef1b740433a25a3ae29201f54d9d3
Fixes: 38029583
Text classification is now being done entirely in the app's proccess.
See android.view.textclassifier.TextClassificationManager
Reverts Ic428d00f291e268211866b3fc6b7acbc3eb04e1e
Test: bit FrameworksCoreTests:android.view.textclassifier.TextClassificationManagerTest
Fixes: 36852122
Change-Id: Iffff3ab6e7d3b761576eb6bdcd5032db34b7a1b2
This switches TextUtils.concat() to use SpannableStringBuilder
if there are any spans in the input strings. As a result, we can
avoid crashes when concatenating two CharSequences can result in
paragraph spans that now don't happen to be at paragraph boundaries.
Also document the exact behavior of the method for edge cases based
on the previous implementation.
Change-Id: I9caffbe95ed729b9c10d63a9e7d22b1e8c7185a3
Fixes: 28271770
Test: CTS tests added and old CTS tests continue to pass.
Test: cts-tradefed run cts-dev --module CtsTextTestCases --test android.text.cts.TextUtilsTest
For AssistStructure, and AutofillValue, create a copy of the text in
setText and forText methods if it is a Spanned.
Fixes: 36838999
Test: cts-tradefed run cts -m CtsAutoFillServiceTestCases
Test: cts-tradefed run cts -m CtsAssistTestCases
Test: cts-tradefed run cts --test android.widget.cts.TextViewTest -m \
CtsWidgetTestCases
Change-Id: I52e780fa9baa17c375d3945dc714171f41fd7db5
Reverts I772961bd20bff4817a060f14a843abeceb55ac92
Until we bring back TextClassifier.getLinks
See I275a9d055ef0ab68f3ca339c37ee939257c4bd54
Test: none
Bug: 22362008
Bug: 37565246
Change-Id: I2948f22cf4c3462491f47376af48624697703969
Services recycle nodes when gathering possible actions
for users to take. It's very confusing for them if they
can't recycle the node without breaking their ability
to activate a clickable span inside it.
Making ClickableSpans used for accessibility independent
of their parent nodes.
Also adjusting the value used for invalid window ids to
come from AccessibilityWindowInfo. I must have missed this
in an earlier cleanup. I needed the value for the spans,
so I figured I might as well use the correct one.
Bug: 37004527
Test: Now recycling the node in the a11y cts test.
Change-Id: I6de4e98a182dd43c4fcd0430a3c082fcc8e458c7
We now use ICU's new functionality for casing edits to preserve
the spans while applying AllCapsTransformationMethod.
Test: Manual
Test: CTS tests added and pass
Bug: 7198872
Bug: 19047649
Bug: 19713814
Bug: 34853618
Bug: https://code.google.com/p/android/issues/detail?id=67509
Change-Id: I0df388e79894961efb272d497f1dcc0570a6c085
By I9ccafe7a53935960566243e2856e166878ca59ae, FontManager was gone.
So FontConfig is no longer need to be parcelable.
We can drop Parcel interface from FontVariationAxis.
Bug: N/A
Test: N/A
Change-Id: I33e92abf1e1063af312f0b7d9d6b8bd938d09c0e
FindAddress method only ever worked on US addresses and being a part
of WebView API, it required the users that did not use WebView otherwise
to pay a heavy penalty. Further, it was also used by Linkify.
The new way to find addresses is using TextClassifier.
Bug: 22362008
Test: WebView.findAddress.
Change-Id: I772961bd20bff4817a060f14a843abeceb55ac92
Update SpannableStringBuilder, SpannedString and SpannableString classes
so that they don’t enforce paragraph constraint for copy constructors.
If a paragraph constraint is not satisfied for a span, that span is not
copied. Before this change it would throw an exception.
Test: New tests added for SpannableStringBuilder and SpannableString
cts-tradefed run cts -m CtsTextTestCases
Bug: 36511794
Change-Id: I62abf08a8d4fe7e342ed97b8e8c3a577a9397e39
Because English time patterns use uppercase letters by default (and a
comma to separate date and time when both are represented), we were
concluding they need internationalized input. Although they
literally do, let's keep the world simple and assume they don't need
internationalized input.
Compared to Nougat, we will now accept uppercase AM and PM and comma
for English if the IME allows them, we just continue to not signal
that an internationalized layout is needed.
Test: CTS tests pass
Bug: https://code.google.com/p/android/issues/detail?id=2626
Bug: https://code.google.com/p/android/issues/detail?id=82993
Bug: 8319249
Bug: 33276673
Bug: 34394455
Bug: 37079150
Change-Id: I82bfde323ba49ae1a27ff5c2e729063b7d81dcc8
Since the characters that need to be entered for an internationalized
input type may not be available on the old non-internationalized
layouts, switch to the full text layout if there are any such
characters.
TextView is also modified to call the locale-aware listeners if
the target SDK is set to O or later.
Test: Manual
Bug: https://code.google.com/p/android/issues/detail?id=2626
Bug: https://code.google.com/p/android/issues/detail?id=82993
Bug: 8319249
Bug: 33276673
Bug: 34394455
Change-Id: I544bf0cc893a475ab5bf88cbad01cb981c6fef91