Commit Graph

9107 Commits

Author SHA1 Message Date
Ahaan Ugale
d6f1da05ce Merge changes from topic "tr-anim" into sc-dev am: 27008c1123 am: 565c15a8d6 am: 2af2705bed
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14661091

Change-Id: I396b6f349e72410c10890e1814866805bc239933
2021-05-28 03:30:19 +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
94ea91221a Merge "Fix a bug in sentence detection when input is too long." into sc-dev am: 87d4c9a9ca am: fd4cb6a4bd am: de4067a73b
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14674299

Change-Id: I85adf98689190991b18a24e53e2d092628e01208
2021-05-25 18:58:53 +00:00
TreeHugger Robot
f5fc0d66ae Merge "Fix a bug in SpellCheckSpan update logic." into sc-dev am: 7568c8cd9a am: 65b6f47a1c am: 9c49ef5e66
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14609923

Change-Id: I6c24521988dea14817f93482930d1f79bca511fe
2021-05-25 18:30:05 +00: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
69f0d3fe50 Merge "Add a flag for the fps of the AnalogClock" into sc-dev am: ef1e1dfb44 am: 5a2a0bfc18 am: 4e292b515e
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14663326

Change-Id: Id3a471f408f79537ed8aa7a5769376b83bf54b96
2021-05-25 13:21:53 +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
17d24b05ab Merge "Fix overscroll doesn't affect scrolling when released" into sc-dev am: ebde5e48e6 am: 95734a666f am: ad0562edf8
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14681840

Change-Id: Ie15a8da1bc43631bda39f594cdec9ac44f6e48a5
2021-05-24 15:56:00 +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
082bd2a4b9 Merge "Revert "Do not invoke textclassifier when dimissing the selection"" into sc-dev am: 2fdb6bd709 am: b9f59a5adf am: 088e171268
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14519405

Change-Id: I0c90116764a5ac6c4371ccfa6ff2446e17a8d3a3
2021-05-24 12:55:05 +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
ce33dd6adc Merge "Remove verbose logcat messages in TextViewOnReceiveContentListener" into sc-dev am: 75dc1f16e3 am: 41c61e595a am: b9c3d048f0
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14687886

Change-Id: I8e9b751a6bc28e128e72e29d0342618e26da0cad
2021-05-23 23:47:09 +00:00
Nikita Dubrovsky
75dc1f16e3 Merge "Remove verbose logcat messages in TextViewOnReceiveContentListener" into sc-dev 2021-05-23 22:58:38 +00:00
Joanne Chung
7229007466 Merge "Refine the ViewTranslationCallback usage." into sc-dev am: cee152ee43 am: df12bfb9ff am: f14bf04771
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14186069

Change-Id: I28792837248882200481e439971b57cc32758e86
2021-05-22 08:25:51 +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
ee3e729371 Merge "Attaching broadcast receiver on attach/detach instead of everytime visibility changes" into sc-dev am: 27500d78b3 am: d7a005cfe5 am: c2649fd1b7
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14648155

Change-Id: I9fef1ade8078763b856035c39f3e98b4a82d5335
2021-05-21 01:45:14 +00: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
7fafecc477 Merge "Translate TextView content description if exist" into sc-dev am: 86d3f3deae am: 15676878d8 am: cbccbd1cd9
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14543285

Change-Id: Ifca78d32251c4cfee704aac6b86c11bc9d24b956
2021-05-20 06:37:58 +00:00
Joanne Chung
86d3f3deae Merge "Translate TextView content description if exist" into sc-dev 2021-05-20 06:00:56 +00:00
TreeHugger Robot
e7e7374c5c Merge "Deprecate Context#createApplicationContext" into sc-dev am: ee438f960a am: d95a9ebbfb am: 891659ba75
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14528644

Change-Id: I396eb97e5b36556757caf269b0e565459c62828b
2021-05-20 04:17:25 +00:00
George Mount
2288eebbd1 Merge "Fixes minimum date in DatePicker" into sc-dev am: 290fcdde7d am: d85a7e41c8
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14553791

Change-Id: I4438e06a717b80357fcd419f148016fbc8941b6a
2021-05-19 23:24:44 +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
34728341f2 Merge "Performance/jank improvements to AnalogClock" into sc-dev am: 9a0e124b1a
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14487521

Change-Id: I2d2573363e627afb36009f11b300f4d08e5490ef
2021-05-12 21:49:54 +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
Lucy Chang
53b8cf32a9 Merge "Don't send AccessibilityEent if text is unchanged" 2021-05-12 06:48:21 +00:00
Nikita Dubrovsky
2f9684b65b Merge "Make drop consistent with paste for multiple text items in a ClipData" into sc-dev am: 4b2ab9bba3
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14455023

Change-Id: I729c08eb540e4618388e48897507226e84a96c6b
2021-05-07 16:58:09 +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
66b91b4a27 Merge "Save/restore view states when reapplying RemoteViews for color changes" into sc-dev am: 6d82bd39e7
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14294133

Change-Id: Ia13bc70ef250cf3356cae421eb97b3b100909efa
2021-05-06 19:00:18 +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
Yinglei Wang
bb5482d835 Merge "Use state description of "in progress" for indeterminte ProgressBar" 2021-05-06 17:43:17 +00:00
yingleiw
bc45cab1f2 Use state description of "in progress" for indeterminte ProgressBar
When a ProgressBar is set to indeterminate, we assign a default
state description of "in progress" to AccessibilityNodeInfo. We
only assign default state description to AccessibilityNodeInfo,
but not to View. If the developer
sets a custom state description through either View API or
AccessibilityNodeInfo API, the custom state description will
be used for both indeterminate and determinate progressbar instead
of default ones.

We put the "in progress" in state description instead of content
description to prevent accessibility services like talkback from
automatically assigning a state description when the state description
is null or empty.

Fix: b/182582617

Test: tested manually with a material linear indeterminate progressbar
with talkback. It says "In progress, progress bar".
Unit tests added.

Change-Id: I24477622bf8992f80a19b8df3a6032bac7f9d5bd
2021-05-05 21:07:48 -07:00
George Mount
fd308c1823 Merge "Allow fling during stretch in ListView" into sc-dev am: 9d7658ac57
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14392463

Change-Id: I6b4ec30213c0f36ed2a7dce944b9e5fde96de4e8
2021-05-05 15:56:24 +00:00
George Mount
9d7658ac57 Merge "Allow fling during stretch in ListView" into sc-dev 2021-05-05 15:50:08 +00:00
Nader Jawad
af62127679 Merge "Update hole punch logic in HWUI" into sc-dev am: 603d612707
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14244206

Change-Id: I25572446223bf7266c05d6442e0415065f774a83
2021-05-05 03:05:11 +00:00
Nader Jawad
603d612707 Merge "Update hole punch logic in HWUI" into sc-dev 2021-05-05 02:59:18 +00:00
Stevie Kideckel
691ff96db6 Save/restore view states when reapplying RemoteViews for color changes
This ensures that adapters have their caches filles and other benefits
such as lists maintaining their scroll positions

Bug: 183503469
Test: validated with local app that service is not called on drag for
colors changing and that flicker is removed

Change-Id: I043d1d7a547b012f7a12eb555b35854a9bb7109b
2021-05-04 23:18:45 +01:00
George Mount
d317ef65a8 Allow fling during stretch in ListView
Bug: 186430321

ListView should accept a fling while stretching.

Test: New test
Test: manual testing
Change-Id: I67221e06818d9953882e16d1c72f2d9e6b191ebb
2021-05-04 15:15:10 +00:00