Commit Graph

9242 Commits

Author SHA1 Message Date
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
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
TreeHugger Robot
4f7df47ee6 Merge "Require onCheckIsTextEditor() for IME_FLAG_NAVIGATE_{NEXT,PREVIOUS}" 2021-10-28 21:16:04 +00:00
Pierre Barbier de Reuille
206066b6cc Check if a view can be recycled in async case.
When implementing the code, it seems this was forgotten :( If the view
id of the root of the RemoteViews is changed, currently, the top-level
view will be re-used, which is an error.

Bug: 181985606
Test: atest android.widget.cts.RemoteViewsRecyclingTest
Change-Id: I5a8addb08f597ec574e3ed49d1318771e4c7c767
2021-10-28 14:51:39 +00:00
Saho Kobayashi
a891919a66 Fix focus transition when the direction is backward.
Currently, when SearchView is focused, the focus is moved to the
internal view. This blocks users to move the focus back to the previous
view by Shift + Tab.
Send focus to the previous view instead of the internal view when the
direction is backward.

Bug: 191405735
Test: atest SearchViewTest SearchView_CursorTest
Change-Id: I668ce13472b80da2e57e84fac4966294d7848170
2021-10-28 09:45:45 +09:00
Yohei Yukawa
4bd98255ed Require onCheckIsTextEditor() for IME_FLAG_NAVIGATE_{NEXT,PREVIOUS}
TextView#onCreateInputConnection() has automatically set the following
EditorInfo flags depending on the presence of focusable elements next
to it.

 * EditorInfo#IME_FLAG_NAVIGATE_NEXT
 * EditorInfo#IME_FLAG_NAVIGATE_PREVIOUS

With those flags, IMEs may offer some additional UI for users to
trigger InputConnection#performEditorAction() with the following
command to achieve tabbing navigation to switch to other focusable
elements.

 * EditorInfo#IME_ACTION_NEXT
 * EditorInfo#IME_ACTION_PREVIOUS

The problem of the current TextView implementation is that it does not
check whether the next element is also a text input field or not.  As
a result, users might be navigated to a UI element that does not
natively support InputConnection APIs, which results in connecting the
IME to a fallback InputConnection.  We have actually received multiple
bug reports that the IME was still shown but not tapping its keys did
nothing.

Based on such feedback, this CL aims to narrow down the condition to
automatically set those navigation flags in TextView.  With this CL,
those flags will no longer be set if the next View in question returns
true from  View#onCheckIsTextEditor().

See also the corresponding CTS CL [1] to find examples of how it
behaves now.

 [1]: I1b75b85f6c1fa4ff90ffa7d584f033b9510d2a36

Fix: 31099943
Test: atest CtsInputMethodTestCases:EditTextImeSupportTest
Change-Id: Id004a77453952f36a2c572697db31c87518f842f
2021-10-27 13:11:48 -07:00
TreeHugger Robot
59e5fa40f8 Merge "Check if APK paths are valid right before creating the context." into sc-v2-dev am: cff5e32516 am: fc3b9c489d
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16004854

Change-Id: I2a81b2cee43744e32a3546f93498377d1367a090
2021-10-25 13:03:08 +00:00
TreeHugger Robot
fc3b9c489d Merge "Check if APK paths are valid right before creating the context." into sc-v2-dev am: cff5e32516
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16004854

Change-Id: I3688df62ad391be9c8ee6f86c3e4042adc6a18e5
2021-10-25 12:42:37 +00:00
Pierre Barbier de Reuille
acfcc90ebd Check if APK paths are valid right before creating the context.
The check has to be done in RemoteViews and in AppWidgetHostView right
before creating the context used to inflate the app widget. Further, the
APK is cached potentially in two places: in the APK with code and the
APK without codes, so both places are updated if present.

Test: manual, see bug for details
Fix: 202369942

Change-Id: I5718f67711a3332a942d3c037eef7f30379549a4
2021-10-25 08:20:10 +00:00
Joanne Chung
bcfaf36b3e Merge "Fix not show translation if call startTranslation after pauseTranslation" into sc-qpr1-dev am: e82a38a8ee am: d8b714a0ec am: 804a1c3cdb
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16001112

Change-Id: Ic67b20c8d27e1ac8ed1c84e9ddb3a081f92ec0af
2021-10-09 03:12:05 +00:00
Joanne Chung
d8b714a0ec Merge "Fix not show translation if call startTranslation after pauseTranslation" into sc-qpr1-dev am: e82a38a8ee
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16001112

Change-Id: I103defd38bad4cfd7fde80b2f9d629fc8bc93144
2021-10-09 02:42:24 +00:00
Joanne Chung
5667540a7d Fix not show translation if call startTranslation after pauseTranslation
It is possible the developer calls pauseTranslation() to show the
original text but it calls startTranslation() to show translated
text. Ideally the developer should call resumeTranslation but it
also make sense to call startTranslation() to show translated text.

When receiving translation response, we avoid showing transaltion
if the view already has the response and it's the same. But it is
good to also check if the view is showing translated text or not.
If the view is not translated text, it is possible developer calls
startTranslation() instead if calling pauseTranslation() to show
translated again, the fixing can resolve this case.

The issue case can be fixed by this change. But there is a deeper
problem about it's useless the caller call finishTranslation(). This
is planned to be fixed in next release.

Bug: 201238016
Test: manual. The issue case is fixed.
Test: manual. Test some chat apps, it still works fine.
Test: atest CtsTranslationTestCases
Change-Id: I699d0fa1d60ac96db094adcc6e17f4203df03214
2021-10-07 06:04:06 +00:00
Mark Hansen
8813394b76 Avoid double-calling super.getText() in EditText.getText()
Just a small cleanup. TextView.getText() looks like it has some logic we might not want to repeat.

Change-Id: I364458d979275ad5dff24983e4ee2b9469f91155
2021-10-06 04:10:43 +00:00
TreeHugger Robot
b742cf8625 Merge "Send TYPE_VIEW_TEXT_CHANGED a11y event when SuggestionSpan is added" 2021-09-25 02:47:34 +00:00
yingleiw
bc3dd0b7fa 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, but currently TextView doesn't send
any notification. This change sends a TYPE_VIEW_TEXT_CHANGED
event with the from and to index of the span, and beforeText
which doesn't have the span and afterText which has the
span.

Bug: b/143378480

Test: tested with talkback.

Change-Id: If16c2c578be5dcae20a9fd7014ff6fba2d487670
2021-09-24 18:27:52 -07:00
Treehugger Robot
f51d54f295 Merge "fix google widget timing issue" am: 56db11dfc2 am: 86170faab2 am: df65b78e27 am: afee7bdd08 am: 539bd560f6
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1782431

Change-Id: I5a996aaefd12f8ca6c33cca0fcedb09f0c46e972
2021-09-24 20:09:24 +00:00
Treehugger Robot
afee7bdd08 Merge "fix google widget timing issue" am: 56db11dfc2 am: 86170faab2 am: df65b78e27
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1782431

Change-Id: I5d6bf8dac1a50b62eacbe9dd5255dd5af4dfbedb
2021-09-24 19:50:41 +00:00
Treehugger Robot
df65b78e27 Merge "fix google widget timing issue" am: 56db11dfc2 am: 86170faab2
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1782431

Change-Id: I3a800bd8b3a728d07048f9fd4396fb02d5316c91
2021-09-24 19:29:52 +00:00
Treehugger Robot
86170faab2 Merge "fix google widget timing issue" am: 56db11dfc2
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1782431

Change-Id: I6d2490247f198ff5f04c064956dbd252b35204c4
2021-09-24 19:15:07 +00:00
Treehugger Robot
56db11dfc2 Merge "fix google widget timing issue" 2021-09-24 18:57:13 +00:00
Joanne Chung
0a8e3c16b5 Merge "Fix the existing translation doesn't update for new translated result." into sc-qpr1-dev am: 0287b4722c am: 2b55842700 am: 8b7eb90c86
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15853776

Change-Id: I85232df3ddb496fcdb7709804e9dc94f75b5193a
2021-09-23 07:04:41 +00:00
Joanne Chung
7672bbc915 Fix the existing translation doesn't update for new translated result.
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
2021-09-19 15:16:57 +00:00
TreeHugger Robot
d09cb05324 Merge "Make RemoteViewsContextWrapper take the user id of the application info." into sc-qpr1-dev am: 85f26920cd am: d0efbee1c8 am: 4140cc224b
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15740826

Change-Id: I1b0709a89af28238bb6c209bb0074a9a69c409a0
2021-09-02 22:38:03 +00:00
Pierre Barbier de Reuille
b6ee41aa6d Make RemoteViewsContextWrapper take the user id of the application info.
This is important to ensure sub-contexts know the user id used to create
the current context, or when using a work profile, a new context will be
created each time.

Fix: 197761162
Test: Manually with hand-made app widget
Change-Id: Ifb4a6dad152acbd2b2853ba8bf5cf1e131d55394
2021-09-02 11:33:43 +01:00
TreeHugger Robot
7e10f513f3 Merge "Fix OOB crash in ContentCapture for translated views" into sc-dev am: f7fb6c535e am: 8737b67e6e am: 2f64986be1 am: a09d2a8581
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15546784

Change-Id: I707049893d1ba46617426d38b3e397d1055cfe68
2021-08-15 02:19:15 +00:00
TreeHugger Robot
f7fb6c535e Merge "Fix OOB crash in ContentCapture for translated views" into sc-dev 2021-08-13 21:59:25 +00:00
Ahaan Ugale
273a0eabc8 Fix OOB crash in ContentCapture for translated views
When a view is partially visible on the screen, ContentCapture reports
only the visible portion (+ a few additional lines). The offsets
calculated for this can be out of bounds if the view's displayed text
is longer from the original text.

Fix: 196414491
Test: manual - translate app to lang with more characters and trigger
 a relayout (by scrolling for an app with ListView)
Test: atest CtsContentCaptureServiceTestCases
Change-Id: Iae98133c48cc67a0b00f1b0ab8b93e5adb293423
2021-08-12 14:21:00 -07:00
TreeHugger Robot
7b3de9dc37 Merge changes I7a3ba2af,Ifa89ae43 into sc-dev am: 0f1dd468bd am: 737b70c1f7
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15504100

Change-Id: Ia50f8a6ae7bbecebdf755d1d83d7ee81b71be547
2021-08-10 22:57:41 +00:00
Ryan Mitchell
a57b0e9c4e Revert "Revert "Apply overlay updates to widget provider info""
Bug: 15332156
Bug: 195649929
This reverts commit 471720cccf.

Change-Id: Ifa89ae43613add1137ddeca4cb40543a3a01d6a7
2021-08-09 13:15:12 -07:00
Patrick Baumann
fa6fb840d7 Merge "Revert "Apply overlay updates to widget provider info"" into sc-dev am: e2c96ac3ad am: 2ce43f896d
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15463732

Change-Id: Ie1195b563767aa37a1e2d406ab1822f05b7c6cae
2021-08-05 18:32:31 +00:00
Patrick Baumann
e2c96ac3ad Merge "Revert "Apply overlay updates to widget provider info"" into sc-dev 2021-08-05 18:07:10 +00:00
Patrick Baumann
471720cccf Revert "Apply overlay updates to widget provider info"
This reverts commit 0bf76b6296.

Bug: 193866093
Fixes: 195267626
Reason for revert: b/195267626

Change-Id: I598a99f761e66d8bedbb0745d488ccc35fff9201
2021-08-04 20:05:36 +00:00
Lucy Chang
efedeff5a6 Merge "Marks disabled list item to be non-longClickable for accessibility" 2021-08-03 02:14:08 +00:00