Commit Graph

9049 Commits

Author SHA1 Message Date
Sally Yuen
2875d81a6b Merge "Unregister IA11yManagerClient in ToastPresenter" into sc-dev am: 77ea3710bb
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14805805

Change-Id: I6912ab4b25d3ee759f42a4ca2a0a5f2b013b5a28
2021-06-11 19:17:07 +00:00
Sally Yuen
77ea3710bb Merge "Unregister IA11yManagerClient in ToastPresenter" into sc-dev 2021-06-11 19:14:45 +00:00
Stevie Kideckel
380231724e Merge "Ensure that the RemoteResponse is not empty before acting on it" into sc-dev am: cf30f5dae2
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14934051

Change-Id: I8fc157812d6253093a2e7b6adb21ebc5b5540158
2021-06-11 16:50:17 +00:00
Stevie Kideckel
cf30f5dae2 Merge "Ensure that the RemoteResponse is not empty before acting on it" into sc-dev 2021-06-11 16:39:15 +00:00
Bernardo Rufino
146d92170f Merge "Expand toast javadoc to include rate limiting info." into sc-dev am: 0245b5cbce
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14916753

Change-Id: Ie57ed26801856b321ffa5c1459a5890fc10eaa9e
2021-06-11 12:38:56 +00:00
Bernardo Rufino
0245b5cbce Merge "Expand toast javadoc to include rate limiting info." into sc-dev 2021-06-11 12:28:08 +00:00
Stevie Kideckel
b72cf99044 Ensure that the RemoteResponse is not empty before acting on it
Potential NPE was added in ag/14881530

Fix: 190353630
Test: locally with sample app with and without items
Change-Id: I946b6b6719600cb638db1b15d74a8c3af6587f32
2021-06-10 09:59:01 +00:00
Stevie Kideckel
c4797d84c9 Merge "Fix handling for onItemClick of fixed collection items" into sc-dev am: 0e77904b02
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14881530

Change-Id: I29c72adacb1ad598949984ada9ab4929e5ea1187
2021-06-09 16:02:05 +00:00
Stevie Kideckel
0e77904b02 Merge "Fix handling for onItemClick of fixed collection items" into sc-dev 2021-06-09 15:53:30 +00:00
Jan Tomljanovic
8cf456cea9 Expand toast javadoc to include rate limiting info.
Test: N/A just adding javadoc
Bug: 190468866
Change-Id: I0a1ab865f5db7a990c1a667b729df52c4735a38c
2021-06-09 10:56:22 +01:00
Stevie Kideckel
bfe51b550e Merge "Schedule time ticks for the next minute when no seconds hand is present" into sc-dev am: 80aaf8817a
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14881612

Change-Id: I2a70b6ff64a83f71ee8a1581f362daf7741bd4a3
2021-06-09 08:47:52 +00:00
Stevie Kideckel
968d29f828 Merge "Stop using TIME_TICK broadcast in TextClock" into sc-dev am: a0a7d15be9
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14899456

Change-Id: I6606dbed7263458c023410f405aad9908f42ed76
2021-06-09 08:46:52 +00:00
Stevie Kideckel
80aaf8817a Merge "Schedule time ticks for the next minute when no seconds hand is present" into sc-dev 2021-06-09 08:28:34 +00:00
Stevie Kideckel
95b804ad4f Stop using TIME_TICK broadcast in TextClock
This gets called even when the view is not visible, which is bad for
performance. I've adapted the existing tick framework to handle ticking
for minutes when there aren't seconds in the format.

I verified the correct behavior with sample apps with and without
seconds in the format, including across DST time changes.

Fix: 190467448
Test: locally with sample apps
Change-Id: I75fed5c9d162b5361c31fe22d057a007db0ce75c
2021-06-08 11:17:29 +00:00
Stevie Kideckel
c81323e390 Schedule time ticks for the next minute when no seconds hand is present
The TIME_TICK broadcast was removed as it's bad for performance to use
it while the view is not visible and adds unneeded overhead.

Instead we can use the internal handler callback scheduling method.

Bug: 190274204
Test: verified locally with app, including across DST time skip
Change-Id: I4eb5e64b16c953baf473331dc7d498de19cfdbc9
2021-06-08 08:05:36 +00:00
Stevie Kideckel
bfbe46198c Fix handling for onItemClick of fixed collection items
The onItemClick handling code assumed that the item would be nested at
least one layer deep due to the RemoteViewsAdapter adding a wrapper view
group.

Rather than add another case to that logic, I've refactored this to
traverse the view's children looking for a view with the tag. As the
tag is internal, there should only ever be one child with it and we'll
always want that one to handle the click.

Fix: 190353630
Test: locally
Test: atest RemoteViewsFixedCollectionAdapterTest
Change-Id: I22057f148d33482ad84fff592b9f7f554fa2bfad
2021-06-07 14:46:52 +00:00
Sally
cda1b9ccec Unregister IA11yManagerClient in ToastPresenter
AccessibilityManager is used to send an a11y event when the Toast is
shown, so unregister the client after it's shown

Test: Track clients in A11yManagerService before and after
multiple toasts are shown with adb shell dumpsys accessibility,
atest ToastUITest
Bug: 189010828

Change-Id: Ie4759d2f67ab9e3149d44169b812d8ec2316c266
2021-06-04 22:50:28 +00:00
George Mount
8fdd193309 Merge "Fix ListView not moving during catch" into sc-dev am: e0fa7da5aa
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14829811

Change-Id: I71ed88df300bfc8831e3900e113a854b5329e4e8
2021-06-04 18:27:19 +00:00
George Mount
60dd581ac2 Fix ListView not moving during catch
Fixes: 189294917

When a ListView has clickable items in it, the over scroll
animation "catch" wasn't properly catching. The problem was
that the over scroll animation was checked and the touch mode
was set, and the touch mode was checked later. Unfortunately,
the touch mode variable that was checked was different from
the one that was set.

Test: manual and new ListViewTest
Change-Id: Iaf9b51d028d1f14195ca38a5fd511141262487ff
2021-06-03 23:52:15 +00:00
Treehugger Robot
8aac56ee8f Merge "/widget/OWNERS: Change TextView to TextView*" am: df2c78d226 am: c34ef6d2df
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1721330

Change-Id: I0ecc013cfed3e20106faea2bcfcaf4966b910a91
2021-06-03 09:40:41 +00:00
Nader Jawad
7d0ed97427 Updated EdgeEffect to respect accessibility settings
Modified EdgeEffect to be disabled if the global
ValueAnimator#areAnimatorsEnabled flag is false

Fixes: 189870180
Test: Added CTS test
Change-Id: I7adb00342f6f89655719d6c5b64316fc58589e0a
2021-06-02 13:08:08 -07:00
Ahaan Ugale
1cd23470b0 /widget/OWNERS: Change TextView to TextView*
Grant access to files related to TextView to the TextView owners.

Change-Id: Ib4bd2b029bc316764ef49d7944e5bee194691bbf
2021-05-27 20:16:29 +00:00
Ahaan Ugale
df75689d4d Translate: Text alpha animation on toggling translated state.
Apply a simple text alpha animation when toggling between original and
translated text. The text is fully faded out, then swapped to the new
text, then the fading is reversed.

Quick toggles are handled by ending the previous animation (which resets
the alpha value) when starting a new one. If the toggle is extremely
fast (<250ms for the currently defined animation duration), the text
stays in it's original state instead of swapping back-and-forth. This is
arguably not ideal, but anyway not worth the complexity for fixing.

There is an unhandled edge case where if the color is changed by the app
during the animation, the app's change would get overridden. It should
be rare and doesn't seem very important to fix.

Bug: 178651829
Test: atest CtsTranslationTestCases
Test: manual - across several apps, while scrolling, concurrently
 interacting with the app, concurrently closing the app, selecting text
 during the animation (with animation speed slowed down to see the
 effect).
Change-Id: I08a26de2253bb345f01186a6748b2d0ff6c2a419
2021-05-27 09:34:18 -07:00
TreeHugger Robot
87d4c9a9ca Merge "Fix a bug in sentence detection when input is too long." into sc-dev 2021-05-25 18:25:52 +00:00
TreeHugger Robot
7568c8cd9a Merge "Fix a bug in SpellCheckSpan update logic." into sc-dev 2021-05-25 18:00:58 +00:00
Stevie Kideckel
ef1e1dfb44 Merge "Add a flag for the fps of the AnalogClock" into sc-dev 2021-05-25 09:58:28 +00:00
George Mount
ebde5e48e6 Merge "Fix overscroll doesn't affect scrolling when released" into sc-dev 2021-05-24 15:19:49 +00:00
TreeHugger Robot
2fdb6bd709 Merge "Revert "Do not invoke textclassifier when dimissing the selection"" into sc-dev 2021-05-24 11:48:28 +00:00
Tony Mak
c103424e3a Revert "Do not invoke textclassifier when dimissing the selection"
Reverting ag/13435448.

The bug that the change fixed was that TextView invokes classifyText
when the selection is going to be dimissed due to an ACTION_UP event.
The fix was that we only  call showFloatingToolbar() if users are
dragging the selection curosr when we get an ACTION_UP event.

QA has found a bug recently.
When user selects some text and then scrolls the TextView, we hide the
floating toolbar temporarily. When user finishes scrolling, TextView
does not reshow the toolbar immediately due to the fix.

I don't have a fix that I feel comfortable to get into S given
that we are pretty late in the process, so reverting the fix.

Some more details:
IMO, the fix should be calling showFloatingToolbar() only if
TextView has a selection(i.e. TextView.hasSelection()) when we are
processing the ACTION_UP event in updateFloatingToolbarVisibility().
Sadly, it does not work because the selection is not actually dismissed
yet when we are trying to update the visiblity of
the floating toolbar in updateFloatingToolbarVisibility().
The selection is actually dismissed when Editor.onTouchUpEvent is
called to handle the UP event, but updateFloatingToolbarVisibility() is
called before that :/

Moving around the code so that updateFloatingToolbarVisibility() is
called after Editor.onTouchEvent() may work, but I am not comfortable
to get in a risky change like this at the moment.

Reason for revert: b/187862341

Bug: 187862341

Change-Id: Ic49c6792dc86c01fcc78a4d3bc5bfd85b7772197
2021-05-24 11:47:56 +00:00
Nikita Dubrovsky
75dc1f16e3 Merge "Remove verbose logcat messages in TextViewOnReceiveContentListener" into sc-dev 2021-05-23 22:58:38 +00:00
Nikita Dubrovsky
5175c12a13 Remove verbose logcat messages in TextViewOnReceiveContentListener
Bug: 170163502
Test: Manual
Change-Id: Ib34a4375294a2a696cbf26e110602b5de2825184
2021-05-21 16:35:13 -07:00
George Mount
d2cbe50f18 Fix overscroll doesn't affect scrolling when released
Bug: 188531406

When an EdgeEffect is flung past 0 into negative values, it
shows a stretch from the other side. To prevent this, the EdgeEffect
animation is now terminated when it reaches 0. I also made it so
that dragging to a value of 0 releases the EdgeEffect.

I also fixed the nested scrolling so that the stretch release
of ListView occurs before the onNestedPreScroll().

Test: new tests and manual testing
Change-Id: Ia20a6b96d25cf31ef143511828ddce5c33cee804
2021-05-21 18:28:23 +00:00
Joanne Chung
18b1d3bde4 Refine the ViewTranslationCallback usage.
Currently, TextView uses its default implementation even developers
uses setViewTranslationCallback() to set their customized
ViewTranslationCallback, we should only set default TextView
implementation if developers don't set it.

The onViewTranslationResponse() will call getViewTranslationCallback
instead of getting TextView default implementation directly. This can
make sure we can get the expected ViewTranslationCallback.

Bug: 183467275
Test: manual
Test: atest CtsTranslationTestCases

Change-Id: I41417140f8985aec6c80f1bca3cfba804727d5df
2021-05-21 19:11:14 +08:00
Qi Wang
2648035bda Fix a bug in sentence detection when input is too long.
When the unchecked length of the current sentence is too long, the
spell checker should check the first MAX_SENTENCE_LGNTH characters of
the unchecked part. In this case, detectSentenceBOundary should return
[textChangesStart, textChangeStart + MAX_SENTENCE_LENGTH)

Fix: 188875278

Test: manual test
Change-Id: I31847aed2d564f7bc1ff43c83adae3bb7c99c0d1
2021-05-21 17:58:31 +08:00
Qi Wang
7f2343de99 Fix a bug in SpellCheckSpan update logic.
The the text is changed, we need to remove all affected SpellCheckSpan.
However, the previous check logic can not work correctly, and may
leave some out-of-date SpellCheckSpan, which causes problem when the
SpellChecker tries to apply suggestions on those spans later.

Also fixed the bug that the offset is not calculated correctly when we
validate spell checker suggestions.

Fix: 188107864
Change-Id: I8dc806d96b6a75255277d6de013305557835cb6d
Test: atest CtsInputMethodTestCases:SpellCheckerTest
Test: atest android.widget.cts.TextViewTest
2021-05-21 15:15:06 +08:00
TreeHugger Robot
27500d78b3 Merge "Attaching broadcast receiver on attach/detach instead of everytime visibility changes" into sc-dev 2021-05-21 01:11:50 +00:00
Stevie Kideckel
697a23f0cb Add a flag for the fps of the AnalogClock
Bug: 188414386
Test: tested locally
Change-Id: I3e28f63bea6aafa0760c6938b706e44643fc12f3
2021-05-20 15:06:53 +00:00
Joanne Chung
86d3f3deae Merge "Translate TextView content description if exist" into sc-dev 2021-05-20 06:00:56 +00:00
Sunny Goyal
2d3879ea2d Attaching broadcast receiver on attach/detach
instead of everytime visibility changes

> Adding a broadcast receiver makes a synchronous system API call
  which can delay draw pass
> Also removing TIME_TICK broadcast, instead using an internal timer
  to aboud unnecessary calls while app is stopped

Bug: 188574817
Test: Manual
Change-Id: I37677aa40189bf4fb75e7e2372bda81ea3e6fda3
2021-05-19 12:51:15 -07:00
TreeHugger Robot
ee438f960a Merge "Deprecate Context#createApplicationContext" into sc-dev 2021-05-19 15:35:09 +00:00
Ryan Mitchell
c54ebba25b Deprecate Context#createApplicationContext
If an application caches an ApplicationInfo and uses it to call
Context#createApplicationContext, the app will not get the most recent
version of the overlays for that application. To make things worse, the
LoadedApk stored in ActivityThread#mResourcePackages is updated using
the old ApplicationInfo causing further uses of the cached LoadedApk to
return outdated information.

Deprecate Context#createApplicationContext, convert all internal uses
to Context#createPackageContext(String packageName, ...) and log
whenever any one calls Context#createApplicationContext with an
outdated ApplicationInfo to detect debug issues in using old infos.

Bug: 188059515
Test: change wallpaper and observe widgets get reloaded with most
      recent overlays
Change-Id: I2aeefa8c0e66264859109975a54c4f73f76ad710
2021-05-18 09:07:58 -07:00
George Mount
290fcdde7d Merge "Fixes minimum date in DatePicker" into sc-dev 2021-05-17 20:50:56 +00:00
Joanne Chung
9753899a97 Translate TextView content description if exist
Screen reader(Talkback) will read content description first if the
developers set. We only translate TextView text, this may cause the
screen reader will not read the translated text if the developers set
content description.

To fix the issue, we also send the content description to translate.
When the translated text is shown, we also set content description
with translated content description and reset to original content
description if show original text.

Bug: 187134784
Test: atest CtsTranslationTestCases
Change-Id: I6986384260627a0539780b7293d47666c442d852
2021-05-17 14:05:52 +08:00
George Mount
4f2b9ad2bd Fixes minimum date in DatePicker
Fixes: 158448787

When the day is earlier in than the minimum date, but
the year is later, then the year is changed, the date
gets set to a day that is earlier than the minimum date.
This CL ensures that the year change can't bring the
date outside of the range of minimum to maximum dates.

Test: manual testing
Change-Id: I0034bd513275267ecf9554f673533852e68dd854
2021-05-14 20:23:37 +00:00
Stevie Kideckel
4a787a1839 Performance/jank improvements to AnalogClock
This addresses rounding of the seconds hand fraction to avoid
advancing by inconsistent amounts.

It also moves to a less janky 30FPS update rate.

This also optimizes seconds ticking to only schedule callbacks as needed
and avoids spurious updates to the content description.

Also, potential NPE fix and dead code removed.

Bug: 186099601
Test: Local testing with sample app
Change-Id: I771b4c3f1d18f7836cd42202810a1495d25a9db5
2021-05-12 16:55:25 +00:00
Nikita Dubrovsky
4b2ab9bba3 Merge "Make drop consistent with paste for multiple text items in a ClipData" into sc-dev 2021-05-07 16:57:02 +00:00
Pierre Barbier de Reuille
6d82bd39e7 Merge "Save/restore view states when reapplying RemoteViews for color changes" into sc-dev 2021-05-06 18:54:54 +00:00
Nikita Dubrovsky
e480958234 Make drop consistent with paste for multiple text items in a ClipData
A ClipData can contain multiple items, for example:
```
ClipData clip = ClipData.newPlainText("label", "ONE");
clip.addItem(new ClipData.Item("TWO"));
clip.addItem(new ClipData.Item("THREE"));
```

When a clip like this is pasted, the TextView impl inserts a newline
between each item. When the same clip is inserted via drag-and-drop,
no newlines are inserted.

This change makes the behavior of drop and paste consistent by updating
drop to match the paste behavior (since pasting has been around longer
and is more common).

Bug: 187428338
Test: atest CtsWidgetTestCases:TextViewReceiveContentTest
Change-Id: I08f30e619b858a4586ab9b4ed287be28b218231e
2021-05-06 11:50:52 -07:00
George Mount
9d7658ac57 Merge "Allow fling during stretch in ListView" into sc-dev 2021-05-05 15:50:08 +00:00
Nader Jawad
603d612707 Merge "Update hole punch logic in HWUI" into sc-dev 2021-05-05 02:59:18 +00:00