Commit Graph

8396 Commits

Author SHA1 Message Date
Nikita Dubrovsky
f8143c2042 Merge "Ensure cursor drag is suppressed during selection drag" 2020-01-07 19:23:17 +00:00
Nikita Dubrovsky
c18581d9cc Merge "Suppress cursor drag when the user swipes vertically" 2020-01-07 16:22:21 +00:00
Artur Satayev
ed5a6ae7ae Use new UnsupportedAppUsage annotation.
Existing annotations in libcore/ and frameworks/ will deleted after the migration. This also means that any java library that compiles @UnsupportedAppUsage requires a direct dependency on "unsupportedappusage" java_library.

Bug: 145132366
Test: m && diff unsupportedappusage_index.csv
Change-Id: I41e12e425284e74561c6b61663241df364ae54a1
2020-01-06 12:27:42 +00:00
Daulet Zhanguzin
cb0d19b0b5 Replace com.android.internal.util.Preconditions.checkNotNull with
java.util.Objects.requireNonNull

Bug: 126528330

Test: Treehugger
Exempt-From-Owner-Approval: Global refactoring.
Change-Id: Idf0949bd58a73bef2b5f3ecb6b99b2be2d1059c4
2020-01-03 18:11:08 +00:00
Nikita Dubrovsky
21c6a9653b Ensure cursor drag is suppressed during selection drag
Once a selection drag starts, the cursor drag logic should be
skipped (short-circuited) until the selection drag ends.

Bug: 143852764, 146811252
Test: Manual and unit tests
  atest FrameworksCoreTests:EditorCursorDragTest

Change-Id: I8da82d5c197d8dcaa8d407ae11fac9a5b8521949
2019-12-27 16:21:07 -08:00
Nikita Dubrovsky
cd36c5ea17 Suppress cursor drag when the user swipes vertically
When the EditText component is wrapped in a ScrollView or another
scrollable component, vertical scrolling works without any explicit
logic to suppress the cursor drag. But if the EditText component is
not placed in a scrolling container, swiping vertically will trigger a
cursor drag instead of scrolling unless we add some explicit logic to
suppress the drag for vertical swiping.

The change here implements explicit logic to disambiguate dragging the
cursor vs scrolling. This is done using the following heuristic: the
swipe direction angle must be greater than 30 degrees from vertical in
order to trigger the cursor drag. Otherwise the existing handlers will
pick up the gesture (e.g. scrolling).

Bug: 143852764, 145833335
Test: Manual and unit tests
  atest FrameworksCoreTests:EditorCursorDragTest

Change-Id: Ibc5b2317e06cc36b221609c716c858ad0a70d577
2019-12-20 09:15:53 -08:00
Nikita Dubrovsky
8cdd14c92e Merge "Ability to start a cursor drag from anywhere in an editable TextView" 2019-12-19 19:34:51 +00:00
Nikita Dubrovsky
9a1369b4ad Ability to start a cursor drag from anywhere in an editable TextView
Bug: 143852764, 145535274
Test: Manual testing and unit tests
  atest FrameworksCoreTests:EditorTouchStateTest
  atest FrameworksCoreTests:EditorCursorDragTest
Change-Id: I6de3da98bd1e9e37a7d81e343514cb1e7ab6816a
2019-12-19 08:26:23 -08:00
Artur Satayev
50aa67dff1 Merge "Use new UnsupportedAppUsage annotation." 2019-12-19 13:43:58 +00:00
Yinglei Wang
0d2e2c2be0 Merge "Fix setting state description of toggle button and switch" 2019-12-18 22:59:25 +00:00
Artur Satayev
ad9254cb1d Use new UnsupportedAppUsage annotation.
Existing annotations in libcore/ and frameworks/ will deleted after the migration. This also means that any java library that compiles @UnsupportedAppUsage requires a direct dependency on "unsupportedappusage" java_library.

Bug: 145132366
Test: m && diff unsupportedappusage_index.csv
Change-Id: I5be7335b23a92b8ac80d2fd890198273b66ad644
2019-12-18 16:27:02 +00:00
Sally Yuen
a9c4305ecc Merge "Use CollectionInfo and CollectionItemInfo api in RadioGroup and RadioButton" 2019-12-17 19:41:46 +00:00
TreeHugger Robot
7edf546fb9 Merge "Revert "Revert "Cleaning up listener when task completes""" 2019-12-17 17:05:54 +00:00
yingleiw
6a55e06d96 Fix setting state description of toggle button and switch
We should set the state description whenever textOn and textOff are
updated. Setting it multiple times doesn't hurt because the
setStateDescription method won't do anything if the state description is
the same.

Test: tested with talkback test app. Without the change, a toggle button
with textOn and textOff set won't have them announced as the state
before a click happens. After the change, a toggle button with textOn
and textOff set has them announced as state.

Change-Id: Ia1cc6218c8cd0125c123c9b650bb4963825db23a
2019-12-16 17:58:20 -08:00
Tiger Huang
4a7835ffb6 Window Manager Flag Migration (7/n)
Introduce new APIs in Window/WindowManager.LayoutParams for developers
to decide which types of insets at which side a window should avoid:

    setFitWindowInsetsTypes(@InsetsType int types)
    setFitWindowInsetsSides(@InsetsSide int sides)
    setFitIgnoreVisibility(boolean ignore)

The existing logic in DisplayPolicy.layoutWindowLw uses combinations of
window types, window flags, and system UI flags to decide what frames a
window should have, which is very complex, difficult to maintain, and
should be replaced with the new APIs.

Bug: 118118435
Test: atest InsetsSourceProviderTest InsetsStateControllerTest
            InsetsPolicyTest WindowStateTests CommandQueueTest
            RegisterStatusBarResultTest InsetsFlagsTest
            LightBarControllerTest RegisterStatusBarResultTest
            ViewRootImplTest DisplayPolicyLayoutTests
            DisplayPolicyInsetsTests DisplayPolicyTests
            TaskSnapshotSurfaceTest
Change-Id: I06ddc9d0d2887ba4ded7bb8adbf9c9c0da4bf7b4
2019-12-16 17:08:21 +08:00
sallyyuen
69a146ca9c Use CollectionInfo and CollectionItemInfo api in RadioGroup and
RadioButton

Allow RadioGroups to be recognized as groups of
objects by accessibility services. This lays a foundation to better
describe these groups by exposing the number of buttons and the position of
each.

Bug: 144591511
Test: Tested on various app permission fragments in Settings and in the
time picker in Clock. Added cts tests.

Change-Id: Ie0c41d8c9b131ca29bba5387171a85dfdbb8db7e
2019-12-13 10:25:39 -08:00
Sunny Goyal
cc554e6770 Revert "Revert "Cleaning up listener when task completes""
This reverts commit 25978ac5b4.

Reason for revert: fixing the original bug
Bug: 145829442

Change-Id: Ib0a5ca722f3f66b5501df4a478d82eb3625f113d
2019-12-12 22:26:00 +00:00
Winson Chung
25978ac5b4 Revert "Cleaning up listener when task completes"
This reverts commit 4c980fe0e0.

Reason for revert: b/146116098

Change-Id: Ifafe0542e91661e52662d711a848996cbb3f57c8
2019-12-12 17:53:33 +00:00
Sunny Goyal
4c980fe0e0 Cleaning up listener when task completes
The caller can hold on the Cancellation signal even after the task
completes which stores a reference of the original RemoteViews and
all the resources associated with it.

Bug: 145829442
Test: Verified Appwidget functionality
Change-Id: I6998980b5bf64dd59fa1b53240440b29df0fb866
2019-12-09 11:21:02 -08:00
Nikita Dubrovsky
d63f2035bd Consolidate tracking of touch state in Editor (editable TextView)
The goal of these changes is to consolidate the state that needs to be
tracked for user motion events (touches, clicks, etc), in order to make
it easier to add/update functionality in the future.

These changes are intended to fully preserve existing behavior from the
user perspective. For the most part, the logic is completely unchanged
(just that the code is pulled out), but it's worth calling out the
following subtle changes to the logic. These changes don't affect any
user-visible behavior.

1) In Editor.onTouchEvent, the recorded position of the last down event
is now updated before SelectionModifierCursorController.onTouchEvent()
is invoked.

2) In Editor.updateTapState (now in EditorTouchState.update), instead
of using SystemClock.uptimeMillis() for the event time, we use
event.getEventTime().

Bug: 143852764
Test: Manual testing and unit test
  atest FrameworksCoreTests:EditorTouchStateTest
Change-Id: Ic40b5e53412294d365bc9d787e7013a44fe11ffa
2019-12-05 15:56:29 -08:00
David Castro
530c32a56e Merge "Removes reference to deprecated code sample, https://github.com/googlesamples/android-CustomChoiceList." into qt-dev am: 3b74a86752 am: 3a6d5555cd am: 56be7c0b58
am: 1294b8b570

Change-Id: I687031198545e945dcd72950d3c195d312c2d338
2019-11-25 07:22:29 -08:00
David Castro
1294b8b570 Merge "Removes reference to deprecated code sample, https://github.com/googlesamples/android-CustomChoiceList." into qt-dev am: 3b74a86752 am: 3a6d5555cd
am: 56be7c0b58

Change-Id: I8ee35a24fc7fe2549e7a7a2c0875c0ea24e32476
2019-11-22 09:09:15 -08:00
David Castro
56be7c0b58 Merge "Removes reference to deprecated code sample, https://github.com/googlesamples/android-CustomChoiceList." into qt-dev am: 3b74a86752
am: 3a6d5555cd

Change-Id: I7684da1e104dac4f62ed3a7ef3f928c1598509aa
2019-11-22 09:02:02 -08:00
David Castro
3a6d5555cd Merge "Removes reference to deprecated code sample, https://github.com/googlesamples/android-CustomChoiceList." into qt-dev
am: 3b74a86752

Change-Id: I2b5e70ef834a0d0f4ccc3689d036321094a24170
2019-11-22 08:55:24 -08:00
TreeHugger Robot
3674ae2f7b Merge "Use static filter for inflater of RemoteViews" 2019-11-22 01:02:28 +00:00
Bernardo Rufino
540ad7a28f Add TEST_MAPPINGs for toasts
Following revert of ag/9699132 due to related broken tests that weren't
executed in presubmit.

Test: croot frameworks/base/core/java/android/app && atest --dry-run --test-mapping
Test: croot frameworks/base/core/java/android/widget && atest --dry-run --test-mapping
Test: croot frameworks/base/services/core/java/com/android/server && atest --dry-run --test-mapping
Change-Id: I819cf354315e240b28dba294c08cf08bba6aada2
2019-11-21 10:28:22 +00:00
David Castro
2ec0df7dfc Removes reference to deprecated code sample, https://github.com/googlesamples/android-CustomChoiceList.
BUG:140947822

Change-Id: I77b9e3a5b466afea51467418f25ffe7f1b921c7d
2019-11-20 23:06:01 +00:00
Yinglei Wang
0b60fc71e3 Merge "change CompoundButton button to use the accessibility state API" 2019-11-20 18:37:31 +00:00
Bernardo Rufino
5cf5c3fe63 Merge "[Roll Forward] Block background custom toasts" 2019-11-20 17:50:40 +00:00
Bernardo Rufino
60c39b3bc8 [Roll Forward] Block background custom toasts
Previous CL (ag/9699132) broke CTS ToastTest and was reverted (ag/9754500).
This was because the test was posting a background toast and verifying it
wasn't clickable. Test has been updated to use a foreground toast in ag/9754274
and I will also look into having it be executed in presubmit.(b/144810971).

-- Previous CL description (updated "Test:" lines)

To assess app compatibility problems early on, this CL blocks background
custom toasts in a non-secure way. We create a new method in the AIDL called
enqueueTextToast() that now contain the same parameters as
enqueueToast(), receiving the view created inside the app's process. But this
method will, in the future, contain a CharSequence instead of
ITransientNotification, for window creation inside the system.

We use PlatformCompat infrastructure to check if the change is enabled.

I learned with this change that if user blocks notifications for an app, it
won't be able to show background toasts, allowing me to re-use the foreground
check that was already in place.

This change will display a text toast (from the system) in case the app's
custom toast gets blocked, this is temporary to get feedback from
dogfood.

Test: With sample app, verify that:
      1. Posting text toast in bg works
      2. Posting custom toast in fg works
      3. Posting custom toast in bg does NOT work
Test: atest CtsToastTestCases CtsWindowManagerDeviceTestCases:ToastTest
      CtsWidgetTestCases:ToastTest CtsToastLegacyTestCases
Test: Working on CTS
Bug: 128611929

Change-Id: I25c6339c6adeb907878596332f57e2fa229bfda9
2019-11-20 09:16:31 +00:00
Yinglei Wang
fab7312a43 Merge "Adopt the accessibility state api in progress bar" 2019-11-20 01:09:53 +00:00
Long Ling
24b3ed84a0 Merge "Revert "Editor: do not blink when invisible to user"" 2019-11-19 22:49:55 +00:00
yingleiw
473fc125fa change CompoundButton button to use the accessibility state API
Test: tested with updated talkback (see CL/274237446). It works as
before.

Change-Id: I928350c8bc9112252e8b8a703c465489f03fde11
2019-11-19 12:13:56 -08:00
Long Ling
0c27fbbec7 Revert "Editor: do not blink when invisible to user"
This reverts commit 6fef46e473.

Reason for revert: regression issue b/144403447

Bug: 144403447
Change-Id: Ie5917bb39c77fc08bb1d40ce78e68b37bf591d85
2019-11-19 18:41:53 +00:00
Bernardo Rufino
a229e8f1c1 Merge "Revert "Block background custom toasts"" 2019-11-19 16:29:44 +00:00
Bernardo Rufino
15fecc3662 Revert "Block background custom toasts"
This reverts commit 880cf32c70.

Reason for revert: Broke CtsWindowManagerDeviceTestCases ToastTest.testToastIsNotClickable()

Change-Id: Ia108eeee81b673306d0e552e01d18e1558a00dd8
2019-11-19 16:25:20 +00:00
Artur Satayev
785d3a03b9 Merge "Add @UnsupportedAppUsage annotations for greylist." 2019-11-19 15:05:51 +00:00
Artur Satayev
751e55114c Add @UnsupportedAppUsage annotations for greylist.
go/cleanup-greylist-txt

These have already been greylisted, however due to bugs/omissions in the tooling have been kept in go/greylist-txt instead of being annotated in the code.

This is partial merge of aosp/Id6c1f5e403a0e66edb1102ee45f3bf19f244fb09. Telephony greylist cleanup has been done separately. Note that annotations outside of frameworks/base/ have been merged from AOSP.

Bug: 137350495
Test: m
Exempt-From-Owner-Approval: merge
Change-Id: I015c466e8b69cc0fed5e9d394ba865aad11d8ba6
2019-11-19 15:05:35 +00:00
Bernardo Rufino
f2e1609f54 Merge "Block background custom toasts" 2019-11-19 11:18:48 +00:00
Bernardo Rufino
880cf32c70 Block background custom toasts
To assess app compatibility problems early on, this CL blocks background
custom toasts in a non-secure way. We create a new method in the AIDL called
enqueueTextToast() that now contain the same parameters as
enqueueToast(), receiving the view created inside the app's process. But this
method will, in the future, contain a CharSequence instead of
ITransientNotification, for window creation inside the system.

We use PlatformCompat infrastructure to check if the change is enabled.

I learned with this change that if user blocks notifications for an app, it
won't be able to show background toasts, allowing me to re-use the foreground
check that was already in place.

This change will display a text toast (from the system) in case the app's
custom toast gets blocked, this is temporary to get feedback from
dogfood.

Test: With sample app targeting SDK 29, verify that:
      1. Posting text toast in bg works
      2. Posting custom toast in fg works
      3. Posting custom toast in bg does NOT work
Test: With sample app targeting SDK 28, verify that 1, 2 and 3 above work.
Test: Working on CTS
Bug: 128611929
Change-Id: Icecbbeff081fa5e7c4329bf3b383d6859520b517
2019-11-18 15:45:41 +00:00
yingleiw
6ab02c1fa4 Adopt the accessibility state api in progress bar
When the progress changes, instead of sending TYPE_VIEW_SELECTED event,
CONTENT_CHANGE_TYPE_STATE_DESCRIPTION event sent. Developers can
override onInitializeAccessibilityNodeInfo() and call
info.setStateDescription() to provide customized state description.

Bug: 123346875
Test: The default implementation of StateDescriptionFormatter maintains
the current format talkback uses. Also tested on talkback_test to set
customized state description based on progress.
Note: this change should not be merged until CL/275509401 (google3) is merged.

Change-Id: I8f1a0c91c55a498593c360483827ed050656d943
2019-11-14 11:54:23 -08:00
Zhen Zhang
6e9e5faa97 Use static filter for inflater of RemoteViews
This will get rid of the RemoteViews leak caused by ViewStub keeping
reference of LayoutInflater. But subclasses of RemoteViews won't be
affected to avoid breaking overriden usage.
Bug: 141699084
Test: Manually test. Leak disappeared. atest RemoteViewsTest

Change-Id: I1b287a166df92e424208ae35eb84bfd6aa553ddf
2019-11-12 17:18:44 -08:00
Joshua Baxter
060e5ba459 Merge "docs: fix typos" into qt-dev am: 748dd651f4 am: fcf4eace37 am: 2612ee2d6d
am: 87256ee062

Change-Id: I9f05a39824c22d7f253b4701a831ee14cba8c80f
2019-11-12 15:52:33 -08:00
Joshua Baxter
87256ee062 Merge "docs: fix typos" into qt-dev am: 748dd651f4 am: fcf4eace37
am: 2612ee2d6d

Change-Id: I621be1458f5e642615b671a428114e8436d15b0b
2019-11-12 15:38:02 -08:00
Joshua Baxter
2612ee2d6d Merge "docs: fix typos" into qt-dev am: 748dd651f4
am: fcf4eace37

Change-Id: I7644a7262bf0ac26870c5c106d94832015f3bff2
2019-11-12 15:33:33 -08:00
Joshua Baxter
fcf4eace37 Merge "docs: fix typos" into qt-dev
am: 748dd651f4

Change-Id: I795c039941adfb8d6743d7af3224231f864efd57
2019-11-12 15:29:04 -08:00
Joshua Baxter
5f005c9eb7 docs: fix typos
bug: 119075364

Change-Id: I452fc3bb80ffc7466d096b7eaf5becd18bc1fb45
test: make ds-docs
2019-11-11 21:56:38 +00:00
Artur Satayev
756d3b447a Merge "Add @UnsupportedAppUsage annotations for greylist." am: 423c3a32d6
am: 7a565c45b1

Change-Id: I48075ef4296e0b55c0055f7364c5129bbd60e9ed
2019-11-11 09:33:13 -08:00
Artur Satayev
7a565c45b1 Merge "Add @UnsupportedAppUsage annotations for greylist."
am: 423c3a32d6

Change-Id: I5387b4742fdaf67ad3189356f2361f73969b53a8
2019-11-11 09:13:24 -08:00
Artur Satayev
fc46be7dbd Add @UnsupportedAppUsage annotations for greylist.
go/cleanup-greylist-txt

These have already been greylisted, however due to bugs/omissions in the tooling have been kept in go/greylist-txt instead of being annotated in the code.

Bug: 137350495
Test: m

Change-Id: Id6c1f5e403a0e66edb1102ee45f3bf19f244fb09
Merged-In: Id6c1f5e403a0e66edb1102ee45f3bf19f244fb09
2019-11-08 16:17:13 +00:00