Commit Graph

9274 Commits

Author SHA1 Message Date
TreeHugger Robot
7f635e3d3b Merge "Implement fallback line spacing for BoringLayout" 2022-01-12 23:14:26 +00:00
Ashwini Oruganti
776b439703 Merge "Revert "Migrate unsafe parcel APIs in framework-minus-apex"" 2022-01-12 23:07:08 +00:00
Bernardo Rufino
331be9a643 Revert "Migrate unsafe parcel APIs in framework-minus-apex"
This reverts commit 90bb3709dc.

Reason for revert: b/214053959

Change-Id: Ic271bab1d3eaf677a5989dda9deb944ee2ad6850
2022-01-12 17:44:44 +00:00
Seigo Nonaka
78c774defb Implement fallback line spacing for BoringLayout
The fallback line spacing is a feature of extending the line height
when the fallback font has taller glyph. This was implemented to
StaticLayout in Android P but not yet implemented in BoringLayout.

This CL enables this feature to the BoringLayout as well.

Not to break existing apps, change this behavior only if the
targetSdk version is T or later.

This is a 2nd attempt of Ia6d6f9f44e73ddaf5e8fe9a8aead7a53efbddd44
The root cause of SystemUI crash was wrong API usage. (start, end) was
passed instead of (start, count).

Bug: 210923482
Test: atest FallbackLineSpacingTest BoringLayoutFallbackLineSpacingTest
Test: atest CtsGraphicsTestCases
Test: atest CtsTextTestCases
Test: atest SystemUITests
Change-Id: I9137607b0120934f7ad2a12c0f0b8aaa52915831
2022-01-12 00:00:53 -08:00
Iris Yang
2e79cc3ec6 Merge "Set launch display id to an action performed on RemoteViews." 2022-01-11 10:24:23 +00:00
John Reck
46cff23420 Merge "Don't animate TextView marquee if not visible" 2022-01-10 15:31:42 +00:00
Shubham Dubey
da511945c3 Revert "Implement fallback line spacing for BoringLayout"
Revert "Add font extent calculation"

Revert "Add test case for fallback line spacing"

Revert submission 16486662-fallback_line_spacing

Reason for revert: Investigate test failures on master


BUGID: b/213826416
BUGID: b/213829920

Reverted Changes:
I06cd7ab71:Add font extent calculation
I6214d52cd:Implement fallback line spacing for BoringLayout
Ia5825c474:Add test case for fallback line spacing

Change-Id: Ia6d6f9f44e73ddaf5e8fe9a8aead7a53efbddd44
2022-01-10 08:58:04 +00:00
Seigo Nonaka
a1b7ced11c Implement fallback line spacing for BoringLayout
The fallback line spacing is a feature of extending the line height
when the fallback font has taller glyph. This was implemented to
StaticLayout in Android P but not yet implemented in BoringLayout.

This CL enables this feature to the BoringLayout as well.

Not to break existing apps, change this behavior only if the
targetSdk version is T or later.

Bug: 210923482
Test: atest FallbackLineSpacingTest BoringLayoutFallbackLineSpacingTest
Test: atest CtsGraphicsTestCases
Test: atest CtsTextTestCases
Change-Id: I6214d52cde25a044bc6e246d2118e35d3a243c9d
2022-01-06 23:03:28 -08:00
Jeff DeCew
2e4df87b87 Merge "Fix crash in RemoteViews w/ Bundle due to Parcel.allowSquashing" into sc-v2-dev am: 88cccabf2b am: c6136c2959
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16553366

Change-Id: I66f9e0b45a2121675387c7d5ccbdf5a4b13ce916
2022-01-05 20:01:28 +00:00
Jeff DeCew
c6136c2959 Merge "Fix crash in RemoteViews w/ Bundle due to Parcel.allowSquashing" into sc-v2-dev am: 88cccabf2b
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16553366

Change-Id: Ib2bed18a6dd1f7b0a872aabb6a8ca9bcf3ac9f4e
2022-01-05 19:54:56 +00:00
Jeff DeCew
a28572eb9d Fix crash in RemoteViews w/ Bundle due to Parcel.allowSquashing
This fixes a failing CTS test, NotificationTemplateTest.

Fixes: 207741735
Bug: 212731590
Test: atest NotificationTemplateTest
Change-Id: Ide0241121d0824a2ba8c721c968e39f3c627f79d
2021-12-30 16:45:17 -05:00
Beverly
5e12fbeae1 Update Toast documentation
to explicitly callout the 2-line limit
Note: more information can be found in
https://developer.android.com/guide/topics/ui/notifiers/toasts
which is also linked in the documentation but
could be missed.

Test: manual
Fixes: 207767563
Change-Id: Icc7fbf6fddf101bd2422bbeab04e0da8084c6698
2021-12-21 14:11:08 -05:00
TreeHugger Robot
5d8375c44d Merge "Use IMM#invalidateInput() in EditText#setText() (2nd try)" 2021-12-20 19:11:13 +00:00
Yohei Yukawa
2b4a008f3f Use IMM#invalidateInput() in EditText#setText() (2nd try)
With this CL, EditText#setText() actually starts using

  InputMethodManger#invalidateInput(),

which does not block the UI thread.

See the previous CL [1] about how that API actually works.

There should be no observable changes from the viewpoint of IMEs.

Note that this CL was once reverted due to Bug 208941904, which was
caused by a misbehaving InputConnection#endBatchEdit() implementation
as a combination of the following bugs:

 * Chromium (crbug.com/1277732)
 * EditableInputConnection (Bug 209958658)

Now those two bugs were addressed.  We have also implemented a
safeguard [2] against the same type of app issues so that the system
can gracefully fall back to the previous behavior as needed.

 [1]: I3161755779080f98bcef0e47dd0c5247d8a3a256
      daa6695c2e
 [2]: I109e0c26d8249fc2e01323e3e1cb36395fa7cc97
      60c7c55c36

Bug: 203086369
Fix: 209008342
Test: atest CtsInputMethodTestCases
Change-Id: I2ce4be729e23ef686e128f832f8cf7debdcd551e
2021-12-17 20:03:31 +00:00
Bernardo Rufino
90bb3709dc Migrate unsafe parcel APIs in framework-minus-apex
Migrate the following unsafe parcel APIs in framework-minus-apex:
* Parcel.readSerializable()
* Parcel.readArrayList()
* Parcel.readList()
* Parcel.readParcelable()
* Parcel.readParcelableList()
* Parcel.readSparseArray()

This CL was generated by applying lint fixes that infer the expected
type from the caller code and provide that as the type parameter
(ag/16365240).

A few observations:
* In some classes we couldn't migrate because the class also belonged to
another build module whose min SDK wasn't current (as is the case for
framework-minus-apex), hence I suppressed the lint check
(since I'll eventually submit the lint check to the tree).
* In some cases, I needed to do the cast in
https://stackoverflow.com/a/1080525/5765705 to make the compiler happy
since there isn't another way of providing a class of type
Class<MyClassWithGenerics<T>>.
* In the readSerializable() case, the new API also requires the class
loader, that was inferred to by InferredClass.class.getClassLoader().
* Note that automatic formatting and import rely on running hooked up
to the IDE, which wasn't the case here.

Bug: 195622897
Test: TH passes
Change-Id: I11a27b9bdab7959ee86e90aa1e1cbebd7aaf883c
2021-12-15 18:21:38 +00:00
Iris Yang
30691cd24d Set launch display id to an action performed on RemoteViews.
When user click notification's action (i.e. answer call), the activity
wouldn't display as the user is interacting with.
Add ActivityOptions#setLaunchDisplayId to the display that the given view
is currently on. So the activity will be launched to the display as the
user is interacting with.

Bug: 191222363
Test: Manually tested using Exo. Open calling application(e.g.WhatsApp)
on Exo virtual display, and answer the call from the notification of
phone.
https://drive.google.com/file/d/1OhS1yn5nCcUe1Aiti3_MLL7k5BLFf7_W/view?resourcekey=0-CCR2Mihn-cfCSIqQZMg-ow

Change-Id: I215519965074b2ddc66eb0a53320673295d4fb17
2021-12-15 09:41:22 +00:00
TreeHugger Robot
80bad32262 Merge "Release stretch overscroll when new items are added." into sc-v2-dev am: f0786d5d90
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16468159

Change-Id: Ib03a37982c6921d0325f1fea2e03c8b50bf305c3
2021-12-15 01:15:38 +00:00
George Mount
aab9304c6a Release stretch overscroll when new items are added.
Bug: 206526994

When items are added to a ListView, any current stretch
should be released and a new touch should scroll and not
stretch.

Test: new tests. manual test
Test: If426eddf2e582169090e5e5e5694668c583288dc
Change-Id: I1f0ae1aa38b064dbb399e46869d8f14ac9d22a92
2021-12-14 17:38:40 +00:00
Joanne Chung
3a6037d159 Merge "Fix translation animation flash for the same translation" into sc-v2-dev am: 1ff5a29afd am: 5c32e894cb
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16432382

Change-Id: Ifb0b11a3afe6591d0651d4ea2949ed691b1bc756
2021-12-13 03:11:29 +00:00
Joanne Chung
5c32e894cb Merge "Fix translation animation flash for the same translation" into sc-v2-dev am: 1ff5a29afd
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16432382

Change-Id: I6cb7a365fb9bfb6e719227d2292aa08a5609396b
2021-12-13 02:54:00 +00:00
Joanne Chung
a5d4f094e8 Fix translation animation flash for the same translation
The system received the same multiple translation responses in a very
short time. We use a isShowingTranslation flag to determine if the
duplicated responses to call onShowTranslation. However the
isShowingTransation flag is set in a post runnable, this may cause the
system  allow the duplicate responses can call onShowTranslation
because the isShowingTransaltion isn't set true yet.

Use multiple flags isShowingTranslation and a new isRunningAnimation
to check if the same translation response should skip to call
onShowTranslation.

Bug: 207457172
Test: manual
Test: atest CtsTranslationTestCases
Change-Id: I7003b7f49fc0a8ce2e909228bcb89acedee6d3d0
2021-12-10 05:00:00 +00:00
Stevie Kideckel
224126d7a0 Merge "Copy caches when initializing RemoteViews" into sc-v2-dev am: 45cf23a6a4 am: 81bd66a5a5
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16422417

Change-Id: I91e713a1c8e363f27199f2903d45f254101dec8a
2021-12-08 23:19:59 +00:00
Stevie Kideckel
81bd66a5a5 Merge "Copy caches when initializing RemoteViews" into sc-v2-dev am: 45cf23a6a4
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16422417

Change-Id: I965ad2bc3ddf198d96440b0a363a5fc76ea64be0
2021-12-08 23:03:33 +00:00
Stevie Kideckel
8d3c1aa054 Copy caches when initializing RemoteViews
If the BitmapCache is not copied when cloning RemoteViews, then Bitmaps
will be dropped.

Fix: 208865678
Test: cts, verified locally

Change-Id: I7547ab3a60ac3ee16b9cfb8d592988d0e410172d
2021-12-08 18:38:08 +00:00
Yinglei Wang
2fbe059072 Merge "Make SuggestionRangeSpan public" 2021-12-06 23:24:44 +00:00
yingleiw
dd5ca6bf56 Make SuggestionRangeSpan public
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
2021-12-06 12:42:53 -08:00
Yinglei Wang
8c0d172d51 Merge "Add AccessibilityAction ACTION_SHOW_SUGGESTIONS" 2021-12-03 23:28:51 +00:00
Yohei Yukawa
1f9ee62670 Revert "Use IMM#invalidateInput() in EditText#setText()"
This reverts commit 01732bb37a [1].

Reason for revert: Caused regression in Chrome Omnibox

 [1]: I8d2e0be22454b106ded15c78c876b55dc6e60a13

Bug: 203086369
Fix: 208941904
Test: presubmit
Change-Id: I5915f6bad63d8e978cb98a79076b9c57089422f8
2021-12-03 14:58:08 +00:00
George Mount
d96a2d3e6d Release stretch overscroll when new items are added.
Bug: 206526994

When items are added to a ListView, any current stretch
should be released and a new touch should scroll and not
stretch.

Test: new tests. manual test
Test: If426eddf2e582169090e5e5e5694668c583288dc
Change-Id: I1f0ae1aa38b064dbb399e46869d8f14ac9d22a92
2021-12-02 13:48:14 -08:00
yingleiw
fbfd734049 Add AccessibilityAction ACTION_SHOW_SUGGESTIONS
And implement it for editable text to show the popup
window for typo correction.

Bug: b/143378480

Test: tested with modified talkback.
Change-Id: I8bb1ec87f6bb2177fb4b8fb9a88bfbe10b374173
2021-12-02 12:04:52 -08:00
Nahun Kim
8b7b56f016 Remove unnecessary null check code for RemoteView
* It can not be null and before the statement rv has been already used.

Test: Make AppWidget on the front page.
Fixes: 168335785

Change-Id: If622ef693fb806a2b0d7a86182f9ccb10c80eba6
2021-11-29 22:27:37 +00:00
Yinglei Wang
f52b121fda Merge "Send TYPE_VIEW_TEXT_CHANGED a11y event when SuggestionSpan is added" 2021-11-18 20:13:09 +00:00
yingleiw
63ab661d5a Send TYPE_VIEW_TEXT_CHANGED a11y event when SuggestionSpan is added
When user types space after a word, we receive a text
change event, but the suggestion span is not added to
the text yet. The spell checker adds the span after the
text change event is sent. Previously we send the event
in onSpanAdded in TextView, but we don't do anything or
update the before text for span removed. This is a bit
confusing and error prone. This change moves the send
event logic into spell checker.

Bug: b/143378480

Test: tested with talkback.
Change-Id: Ibd45843494304602b177df8da520a51058989f10
2021-11-17 20:01:30 -08:00
Yohei Yukawa
01732bb37a Use IMM#invalidateInput() in EditText#setText()
With this CL, EditText#setText() actually starts using

  InputMethodManger#invalidateInput(),

which does not block the UI thread.

See the previous CL [1] about how that API actually works.

There should be no observable changes from the viewpoing of IMEs.

 [1]: I3161755779080f98bcef0e47dd0c5247d8a3a256

Bug: 203086369
Test: atest CtsInputMethodTestCases:EditTextImeSupportTest
Change-Id: I8d2e0be22454b106ded15c78c876b55dc6e60a13
2021-11-17 15:22:34 -08:00
Stevie Kideckel
899cc0319c Merge "Optimize parcelization protocol in RemoteViews and RemoteCollectionItems" into sc-v2-dev am: 742187b89d am: 80dd4b4290
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16047867

Change-Id: I8a158874f028642a5c47ad98308ff3d5a69780b6
2021-11-17 23:02:21 +00:00
Stevie Kideckel
80dd4b4290 Merge "Optimize parcelization protocol in RemoteViews and RemoteCollectionItems" into sc-v2-dev am: 742187b89d
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16047867

Change-Id: I8a8e729bcbb1c8f47325bdffaecee2db4eee6137
2021-11-17 21:37:43 +00:00
Stevie Kideckel
742187b89d Merge "Optimize parcelization protocol in RemoteViews and RemoteCollectionItems" into sc-v2-dev 2021-11-17 21:24:39 +00:00
TreeHugger Robot
994199991b Merge "Check if the view can be recycled if viewId is set" into sc-v2-dev am: 8b5c93d9ea am: 5df3511ad7
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16214434

Change-Id: I9fb4df9313fe4c87b901ab0288e152809a100a74
2021-11-11 23:32:59 +00:00
TreeHugger Robot
5df3511ad7 Merge "Check if the view can be recycled if viewId is set" into sc-v2-dev am: 8b5c93d9ea
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16214434

Change-Id: I8fd756eda96b9b5f81f19f1c1324a929238246c9
2021-11-11 23:13:57 +00:00
Pierre Barbier de Reuille
ff55ff2c96 Check if the view can be recycled if viewId is set
Previously, the recycling was only checked for multiple layout, as it
was assumed the AppWidgetHostView would make the basic check. However,
adapters views (e.g. ListView, ...) do not make any recycling check,
instead relying on caching using the Layout id. The caching cannot be
changed as it is common to other parts of Android.

Note, however, that some apps are already using this lack of test to
create the view themselves and use reapply to apply the RemoteViews. So
we limit the test to uses involving changing the viewId.

This CL ensures the view can be recycled when reapplied, always.

Bug: 181985606
Test: atest android.widget.cts.RemoteViewsRecyclingTest
Change-Id: Ib4f908c66a666faa4e6c27e2be38246eb7748f61
2021-11-10 12:33:49 +00:00
Stevie Kideckel
3a69c3a3fe Optimize parcelization protocol in RemoteViews and RemoteCollectionItems
By using "squashing", each ApplicationInfo is only written to the parcel
once. Subsequent writes write only a single int as a reference.

This makes the earlier system with ELIDE_DUPLICATES unnecessary.

Squashing relies on testing for equality, and ApplicationInfo does not
implement equals, therefore I've added a shared cache based on package
name and uid so that we can force all RemoteViews of the same package to
use the same ApplicationInfo object.

There is also a mechanism to update the ApplicationInfo to a new one
(needed for dynamic colors).

This saves space for addView calls as well as RemoteCollectionItems
usage. After this change, each incremental item in a collection adds 48
bytes as a base (before this was multiple kilobytes).

This approach also supports collections with RemoteViews from multiple
packages. Each ApplicationInfo in the entire hierarchy is written at
most once.

Bug: 202831917
Test: locally, atest RemoteViewsTest, atest RemoteViewsFixedCollectionAdapterTest
Change-Id: Ie1b1dc8760247aa771451149243efd63d36da368
2021-11-09 20:20:15 +00:00
TreeHugger Robot
77230512f4 Merge "Revert "Always check if the view can be recycled."" into sc-v2-dev am: 533ce6f9f0 am: f3ba2931ea
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16213673

Change-Id: I01773d86e94717a2a9d935982717c4e5a1164101
2021-11-09 00:17:44 +00:00
TreeHugger Robot
f3ba2931ea Merge "Revert "Always check if the view can be recycled."" into sc-v2-dev am: 533ce6f9f0
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16213673

Change-Id: Ic2750b05631c05fee6d3930f956b4568c0d87edd
2021-11-08 23:41:46 +00:00
Daniel Chapin
951bc7d892 Revert "Always check if the view can be recycled."
Revert "Add test checking view recycling is always tested"

Revert submission 16149646-betterRecycling

Reason for revert: Droidfood Blocking Bug: 205503898
Reverted Changes:
Ib01c511e4:Always check if the view can be recycled.
If11dcd323:Add test checking view recycling is always tested

Change-Id: Id08d5ea3602d9d3ca03e148e57a9f97435534e2c
2021-11-08 17:20:04 +00:00
TreeHugger Robot
da66fe3237 Merge "Always check if the view can be recycled." into sc-v2-dev am: 1c3b93b10a am: 3af77fe304
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16153069

Change-Id: I3250675f3d830463e83b232d1c23af17f8cde317
2021-11-02 19:32:31 +00:00
TreeHugger Robot
3af77fe304 Merge "Always check if the view can be recycled." into sc-v2-dev am: 1c3b93b10a
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16153069

Change-Id: I57aa0dad1d62f578e28e4daaa5510e46242e7e19
2021-11-02 19:30:54 +00:00
Saho Kobayashi
112fe310bb Merge "Fix focus transition when the direction is backward." 2021-11-02 01:44:33 +00:00
Pierre Barbier de Reuille
8011a28559 Always check if the view can be recycled.
Previously, the recycling was only checked for multiple layout, as it
was assumed the AppWidgetHostView would make the basic check. However,
adapters views (e.g. ListView, ...) do not make any recycling check,
instead relying on caching using the Layout id. The caching cannot be
changed as it is common to other parts of Android.

This CL ensures the view can be recycled when reapplied, always.

Bug: 181985606
Test: atest android.widget.cts.RemoteViewsRecyclingTest
Change-Id: Ib01c511e4a793cce1519157aea06e194a2d8f855
2021-11-01 10:37:12 +00:00
TreeHugger Robot
4858cd4c75 Merge "Check if a view can be recycled in async case." into sc-v2-dev am: 6c20a8f525 am: e330f4fcf3
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16140774

Change-Id: Ia95b7c7f524b27878ae178251cad857c76202115
2021-10-29 08:52:59 +00:00
TreeHugger Robot
e330f4fcf3 Merge "Check if a view can be recycled in async case." into sc-v2-dev am: 6c20a8f525
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16140774

Change-Id: Id6d5f841f32ba8fdca10a4e8bf404534376357d3
2021-10-29 08:36:19 +00:00