Commit Graph

8411 Commits

Author SHA1 Message Date
Nikita Dubrovsky
e6cf79bcab Merge "Enable cursor drag by default for editable TextViews" 2020-01-15 18:52:56 +00:00
Nikita Dubrovsky
ca73951a92 Merge "Add explicit check to not trigger a cursor drag via the mouse" 2020-01-15 18:46:59 +00:00
Nikita Dubrovsky
f32903df0f Merge "Handle ACTION_CANCEL in EditorTouchState (editable TextView)" 2020-01-15 16:42:49 +00:00
TreeHugger Robot
ae6c8788fb Merge "Add Callback API to Toast" 2020-01-15 14:09:51 +00:00
TreeHugger Robot
f129f86a57 Merge "Rename the api from refresh() to refreshTime() to make it more clear" 2020-01-15 09:12:43 +00:00
Nikita Dubrovsky
81a734c5f0 Enable cursor drag by default for editable TextViews
Bug: 143852764
Bug: 145535274
Test: Manual and ran tests
  atest FrameworksCoreTests:EditorCursorDragTest
  atest FrameworksCoreTests:TextViewActivityTest
  atest FrameworksCoreTests:TextViewActivityMouseTest
Change-Id: I19ec46194a2ee9926070010b85f45c12135c950b
2020-01-14 22:54:08 -08:00
Nikita Dubrovsky
bd50f3b07a Add explicit check to not trigger a cursor drag via the mouse
Cursor drag without the handle is only for touch and should not trigger
for events from a mouse. This was already the case before this CL but it
was not explicit: SelectionModifierCursorController happened to trigger
first so the cursor drag would not get activated. This change updates
the cursor drag logic so that mouse events are explicitly excluded from
the feature.

Bug: 145535274
Bug: 143852764
Test: Manual and automated tests
  atest FrameworksCoreTests:EditorCursorDragTest
  atest FrameworksCoreTests:TextViewActivityMouseTest

Change-Id: I3ccf5106b8e9a9e3c271dff38a4d6a0c0aa19597
2020-01-14 22:49:25 -08:00
Nikita Dubrovsky
d69517ebf1 Merge "Fix NPE in InsertionPointCursorController.onTouchEvent" 2020-01-14 16:00:53 +00:00
Nikita Dubrovsky
99b55fa6a5 Fix NPE in InsertionPointCursorController.onTouchEvent
Calls to SelectionModifierCursorController must be guarded by
hasSelectionController() because it's possible to have a TextView
with an Editor but no selection controller if the TextView is
configured to have non-selectable text.

Bug: 147366705
Bug: 145535274
Bug: 143852764
Test: Manual and unit test
  atest FrameworksCoreTests:EditorCursorDragTest
Change-Id: I7fdec754e6fa51561b08fab024ea672c43f2c8f5
2020-01-13 21:54:20 -08:00
Nikita Dubrovsky
b7e8cfc356 Handle ACTION_CANCEL in EditorTouchState (editable TextView)
When testDragAndDrop_longClick() performs the long-press, the events
triggered are ACTION_DOWN, ACTION_CANCEL, ACTION_DOWN, ACTION_CANCEL.
It's not clear why there is the additional ACTION_DOWN / ACTION_CANCEL
pair; performing the same gesture manually only produces a single
ACTION_DOWN / ACTION_CANCEL pair. Still, Editor should be able to handle
this scenario since ACTION_CANCEL is a valid event.

Previously there was no handling for ACTION_CANCEL in EditorTouchState
at all, so the sequence of events triggered by the test would end up
getting treated as a double-tap scenario and drag-and-drop would not be
started.

This CL adds handling for ACTION_CANCEL in EditorTouchState, attempting
to follow GestureDetector as closely as possible (essentially resetting
state whenever ACTION_CANCEL is received, so that subsequent events
start a "fresh sequence").

Bug: 29591177
Test: Manual and ran tests
  atest FrameworksCoreTests:TextViewActivityMouseTest
  atest FrameworksCoreTests:TextViewActivityTest
  atest FrameworksCoreTests:EditorTouchStateTest
  atest FrameworksCoreTests:EditorCursorDragTest

Change-Id: Ia0ee531af64083a4f670842188bdc7e35b617397
2020-01-12 17:01:26 -08:00
TreeHugger Robot
1370da8bb7 Merge "Updates Icon type checks in framework to include TYPE_URI_ADAPTIVE_BITMAP" 2020-01-10 20:28:03 +00:00
Bernardo Rufino
3231f610d5 Add Callback API to Toast
In preparation for moving text toasts to system UI, we need a new way of
telling if a toast is being displayed or not since the view won't live
in the app's process. This is needed for our CTS tests and good to have
for developers so we don't take the functionality away from them, so
making it a public API.

Also updated tests in topic CL.

Bug: 128611929
Bug: 144754526
Test: atest android.widget.cts.ToastTest
Change-Id: I41ff1ed11d5af66e415c772c2e5f611a3d1b17fc
2020-01-10 18:49:02 +00:00
Nikita Dubrovsky
1f78b11bbf Simplify state in SelectionModifierCursorController
This change removes some code from SelectionModifierCursorController
in favor of calling EditorTouchState instead.

Bug: 143852764
Test: Manual and unit tests
  atest FrameworksCoreTests:EditorTouchStateTest
  atest FrameworksCoreTests:EditorCursorDragTest
  atest FrameworksCoreTests:TextViewActivityTest
  atest FrameworksCoreTests:SuggestionsPopupWindowTest

Change-Id: I40f0ad8bd4eb0d4af33d0e2cd1a79c99812a9c40
2020-01-09 19:28:17 -08:00
Mehdi Alizadeh
d9e0ead0e7 Updates Icon type checks in framework to include TYPE_URI_ADAPTIVE_BITMAP
Bug: 142831407
Test: atest RemoteViewsTest StatusBarIconViewTest
Change-Id: If55935a194d1e4fb22c5afe1ee102e5b167b0d1d
2020-01-09 20:11:11 +00:00
shawnlin
f45e024338 Rename the api from refresh() to refreshTime() to make it more clear
Test: make api-stubs-docs-update-current-api, make
Bug: 140102239
Change-Id: Ieb7403748b8b8a7f7c967b7228733a19caf4a306
2020-01-08 14:11:21 +08:00
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