The fallback ascent/descent can be larger than default font top/bottom
height. Not to clip the bottom of the view, adjust the top/bottom with
fallback ascent/descent.
Bug: 210163467
Test: atest StaticLayoutFallbackLineSpacingTest
Change-Id: Ifbf64f6d281d3324a926a6f0b45941824d499179
Add the new input type to indicate that the text conversion suggestions are required by the application. IME should provide the TextAttribute with the text conversion suggestions.
Bug: 194878427
Test: atest android.widget.cts.EditTextTest
Change-Id: Ib37a9816bbf594a5405ea6cd8943fd92491c005b
StyleSpan with Typeface.BOLD will only bold if the text doesn't already
have a BOLD style. But auto-bolded text needs to be further bolded.
If the Typeface style is BOLD, bold more for auto-bold.
(The fake bold works for Typefaces with weight < 700)
Test: manual - settings page, example StyleSpans,
atest StyleSpanTest TextViewTests
Bug: 175177807
Change-Id: Iec7db7eadd18ed6a2efc6ee39b49c1d6cb15d870
when we have overlapped SuggestionSpans, the
range of text being replaced can change depends on
the number of suggestions in the SuggestionSpans, so
accessibility services need to know the text being replaced.
We send text change event with the before text doesn't have the
SuggestionRangeSpan and after text has the SuggestionRangeSpan,
so a11y services can inform the user about the text being
replaced.
Other ui toolkits like compose can convert their style indicating
text being replaced to SuggestionRangeSpan.
Bug: b/143378480
Test: tested the event is sent.
Change-Id: I6d0d33e46f7c8ac9dbcc177ab54718184e715fb6
This change deprecates Linkify.ALL because it uses
Linkify.MAP_ADDRESSES, which is deprecated. The deprecation message is
the same as the one for MAP_ADDRESSES; users are directed to use
TextClassifier.generateLinks() instead.
Bug: 202556787
Test: N/A
Change-Id: I40a344410d2794f590d72faa6fcd9bf4582449bf
It is possible the existing text is changed that triggers a new
translation. We cache the translation response when onShowTransltion
is called. We should keep the translation response is updated if this
is a new translation result.
Bug: 200232741
Test: atest CtsTranslationTestCases
Test: manual. The issue app works fine.
Change-Id: Iaf7423cd35d4484e33de84e478256b77a000f390
Instead of iterate all ellipsized characters, only iterate the necessary
ranges for copying.
Bug: 188913943
Test: atest CtsTextTestCases CtsGraphicsTestCases CtsWidgetTestCases
Change-Id: I3d03b1e3897e427c23fbe51315f412c57a4ce9e9
(cherry picked from commit 2c6121f3e3)
Instead of iterate all ellipsized characters, only iterate the necessary
ranges for copying.
Bug: 188913943
Test: atest CtsTextTestCases CtsGraphicsTestCases CtsWidgetTestCases
Change-Id: I3d03b1e3897e427c23fbe51315f412c57a4ce9e9
Some apps operate on the view text based on layout calculations made on
the transformed text. This can cause issues (even crashes) if the
transformed text is longer than the original, as is often the case with
Translate. A previous temporary fix,
I685ae4a9752c817db81f0d736f1d746b2e4a9839, ellipsized the translated
text. This change fixes it properly by instead padding the original
text.
A followup change will make this controllable by API instead of padding
every TextView.
The en space character, U+2002, is used for the padding here. It seems
to work well in practice for multiple languages. We don't make this
configurable through API as it could make debugging harder (issues
triggered by server-side changes).
Bug: 179693024
Test: atest CtsTranslationTestCases
Test: manual - toggling between original and translated, scrolling, new
views appearing, multiple apps
Change-Id: I9d7db5d2bc200e4042baf3267796f00cfc298f19
Ellipsizes the translated text if it's longer than the view text. This
fixes a crash in apps that operate on the view text based on layout
calculations made on the transformed text.
A proper fix will follow to modify the UiTranslationManger API to make
this compat behavior happen only on request, and probably change the
behavior to instead add padding to the view text to make it match the
translated text length.
Bug: 179693024
Test: atest CtsTranslationTestCases
Change-Id: I685ae4a9752c817db81f0d736f1d746b2e4a9839
It already uses the transformed text characters, but uses the length of
the base text. This does not account for TransformationMethod2, which
can change length, including AllCapsTransformationMethod ("ß" becomes
"SS") and TranslationTransformationMethod (arbitrary length changes).
This change does not fix updates that happens through
DynamicLayout.ChangeWatcher; those will be fixed in separate change(s).
Bug: 178650596
Test: atest DynamicLayoutBlocksTest DynamicLayoutTest TextLayoutTest \
TextViewTest
Test: manually on a sample app with AllCaps
Test: manually with Translate on a real app
Change-Id: Iec4699c8d9967cb4622fe59ba91849642d72b52e
DynamicLayout uses a static StaticLayout instance internally to avoid
allocations. For the specific case of multiline, TruncateAt.START, and
no ellipsization needed (may also be triggered by slightly different
params), the ellipsis results for a reused static instance are not
modified. If the instance was previously ellipsized, the new result
keeps that ellipsization result even though it shouldn't be ellipsized
(at least for some lines).
Bug: 179524847
Test: atest DynamicLayoutBlocksTest DynamicLayoutTest TextLayoutTest \
TextViewTest
Change-Id: I1b4142648ec1b6b3fc2ece0ec55aac9539497134
FontManager is an interface of communicating with FontManaserService.
With this CL, system apps can know the primitive information about
what font files are installed and how it is configured.
This CL also adds shell command of dumping font configuration.
Example usages are:
# dump primitive font configuration.
adb shell dumpsys font
# dump fallback font list
adb shell cmd font dump serif
Bug: 173619554
Test: atest FontManagerTest
Test: Manually confirmed above commands works.
Change-Id: I5cb855308e199ac38bd7b56b60821346247bdce3
The initial APIs for auto translation flow. The implementation of
sending request and dealing spans will on the follow up changes.
Bug: 172969740
Test: manual build pass. Use a sample app to call api get expected
result.
Change-Id: Ief45190026e6205ff18366c1aaba8f424a4df00c
This CL breaks system font initialization step into three sub-steps
to be able to expose font configuration as SystemApi. The font
initialization step is now following three steps:
1. Parse XML files. This is SystemFonts#getSystemFontConfig and
SystemFonts#getSystemPreinstalledFontConfig. The first API gives
you the current FontConfig and the second API gives you plain
vanilla FontConfig without any updates.
2. Build font family fallback list from FontConfig. The font family
fallback is a intermediate state that can be used for custom
Typeface. This state is kept for dumping in shell command later.
This is useful for checking what font will be used by the fallback
since family fallback is still printable.
3. Build typeface mapping. The typeface mapping is the final state to
be used by application. This is no longer printable.
Bug: 173619554
Test: atest TypefaceTest TypefaceSystemFallbackTest StaticLayoutTest
Test: atest CtsGraphicsTestCases CtsTextTestCases
Change-Id: I4e21fc7c41f2fb7975d03c1d5f5536a23e8abb09
Use the Inet4AddressUtils common utility instead.
NetworkUtils is moving to the connectivity module, so its hidden symbols
are not accessible from the framework. Use the Inet4AddressUtils utility
instead.
NetworkUtils.intToInetAddress is also deprecated.
Bug: 174436414
Test: m
Change-Id: Ia4f4de2f23b2e2be056f78cc30259814f9a4dc91
We can only safely use TextUtils.formatSimple() when formatting
strings that don't appear in UI, since locales can use different
glyphs for representing numerals.
Bug: 174576537
Test: manual
Exempt-From-Owner-Approval: revert
Change-Id: Iafba1ccde239e3053b2a462c3d0c248795fbf5fc
Use @EnabledSince instead of @EnabledAfter for DISALLOW_DUPLICATE_FIELD_IN_SKELETON
Test: m
Bug: 172238506
Change-Id: I041e1e2694f310d638e31b475f29d0d214711dd5
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
Merged-In: I626caf7c1fe46c5ab1f39c2895b42a34319f771a
Change-Id: I54e5ecd11e76ca1de3c5893e3a98b0108e735413
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
Merged-In: I8285daa8530260251ecad6f3f38f98e263629ca7
Change-Id: I626caf7c1fe46c5ab1f39c2895b42a34319f771a
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