Commit Graph

8516 Commits

Author SHA1 Message Date
Joanne Chung
4661207775 Merge "Fix app crash if the selection is from reverse direction." into rvc-dev 2020-04-20 05:55:46 +00:00
Hui Yu
4db77a9749 Merge "Move noteAppWidgetTapped call into AppWidgetHostView." into rvc-dev 2020-04-18 04:03:52 +00:00
Nader Jawad
2e40bb8b1e Merge "Updated TextView#setCompoundDrawableTintList documentation to refer to BlendMode.SRC_IN instead of PorterDuff.Mode.SRC_IN" into rvc-dev 2020-04-17 01:11:59 +00:00
Shu Chen
9b6af1dcc5 Merge "Prevents multi touch among TextView and handle reviews." into rvc-dev 2020-04-16 15:32:32 +00:00
Joanne Chung
cb3c97db0c Fix app crash if the selection is from reverse direction.
When user types some text and then long presses on end of empty area
to open context menu, if user opens Gboard and selects text from the
reverse direction, SelectionEnd will be less than SelectionStart. The
IllegalArgumentException occurred because TextClassification does not
allow SelectionEnd is less than SelectionStart. We swap the start and
end index if end index is less than start index.

Bug: 150916165
Test: Manual. No crash occurs.
Test: atest FrameworksCoreTests:android.widget.TextViewActivityTest

Change-Id: I8dbc92f0f31e64b7e3a45ae91762e1b741629a8e
2020-04-16 17:37:05 +08:00
Shu Chen
eb8b1ba3df Prevents multi touch among TextView and handle reviews.
- First touch on TextView blocks secondary touches on handles.
 - First touch on handles blocks later touches on TextView but doesn't block secondary touches on other handles.

Bug: 150995597
Test: manually tested & automation tests:
  atest FrameworksCoreTests:EditorCursorDragTest
  atest FrameworksCoreTests:TextViewActivityTest
Change-Id: I7717fc061fc81514fc1dad0d3acbc73e683516cf
2020-04-16 13:58:10 +08:00
Hui Yu
4803268229 Move noteAppWidgetTapped call into AppWidgetHostView.
RemoteViews is public API used out of scope of widget. The correct place
to call noteAppWidgetTapped is in AppWidgetHostView.

Fix: 153676411
Test: manual test, tap a widget, "adb shell dumpsys usagestats | grep
USER_INTERACTION" to oberserve USER_INTERACTION event sent to UsageStas, "adb shell dumpsys appops | grep appWidgetVisible" to observer appWidgetVisible flag.

Change-Id: Ic473211b91fd952dbb81b09b1e1568d6f69a0dd8
2020-04-15 22:06:12 -07:00
Nader Jawad
af5ff36051 Updated TextView#setCompoundDrawableTintList
documentation to refer to BlendMode.SRC_IN
instead of PorterDuff.Mode.SRC_IN

Fixes: 151952140
Test: N/A
Change-Id: Ie4b9a585c2dae49e633f6741180b6749493d069a
2020-04-15 20:21:52 +00:00
Sally Yuen
387529809d Merge "Check for text when adding CollectionInfo and CollectionItemInfo" into rvc-dev 2020-04-07 17:06:04 +00:00
sallyyuen
5a5c74f350 Check for text when adding CollectionInfo and CollectionItemInfo
Generally, the button's text is displayed next to the check box, but
Sound Settings uses its own views to display the text, distinct from
RadioGroup and RadioButton. This results in TalkBack announcing out
of list state too early, since the text content is not considered
part of the collection.

Add a check to exclude buttons with no text when counting the children
to be in the collection. Developers should be either setting the button
text or implementing their own views to appear alongside the buttons.

Bug: 149064784
Test: Added CTS test. Manual testing of Settings -> Sound -> Do no
disturb -> Advanced -> Set Duration for Quick Settings

Change-Id: Ie9abe4cccc4ab53e79a583b9a2ce45535dcf1cc0
2020-04-06 14:00:21 -07:00
Bernardo Rufino
78f5d83ac8 Wire user info and use user context for text toasts
Text toasts don't currently support multi-user. This CL prepares toasts
for multi-user by wiring the user information from who requested the
toast (in the form of uid) to ToastUI, where text toasts are actually
rendered.

We go only as far as obtaining a new user-specific context for that user
and using that to construct the view. Actual support will come in future
CLs.

Bug: 151414297
Test: atest android.widget.cts29.ToastTest android.widget.cts.ToastTest
      ToastWindowTest ToastUITest NotificationManagerServiceTest
      LegacyToastTest
Change-Id: I8c92453c6a2b73c31f9a41ca9ff463d194d4f44f
2020-04-06 20:20:09 +01:00
Bernardo Rufino
dd4f238127 Refactor ToastPresenter to perform show()/hide()
In order to support multi-user, we need to create a new context based on
the user id and retrieve the services from it
(http://b/151414297#comment9). This meant retrieving the services in
ToastUI.showToast() instead of on its constructor, which would make the
code diverge from Toast$TN.handleShow(). In order to avoid that, now
seemed a good time to refactor ToastPresenter to perform show() and
hide().

This means ToastPresenter will now be instantiated in every request for
a new toast in ToastUI, but fortunately with the refactor we were able
to get rid of ToastEntry (which was also beign instantiated in every
request).

Also found out a bug with this where window tokens were being used to
locate the toasts instead of the (non-window) tokens. This is a bit
confusing because the method NM.finishToken(package, token) receives a
non-window token to locate the ToastRecord and then finish its window
token. This didn't have any side-effects because NM itself finishes the
tokens after a time-out. Added a test for this.

Bug: 152973950
Test: atest android.widget.cts29.ToastTest android.widget.cts.ToastTest
      ToastWindowTest ToastUITest NotificationManagerServiceTest
      LegacyToastTest
Change-Id: I13cf18890ca22022adb7576c8ecf3285a9b82299
2020-04-03 12:57:08 +00:00
Bernardo Rufino
884e9515d6 Merge "Rename test in TEST_MAPPING" into rvc-dev 2020-04-03 10:02:09 +00:00
Bernardo Rufino
434c17c0e6 Rename test in TEST_MAPPING
ToastTest became ToastWindowTest in ag/10919524, updating TEST_MAPPING
to reflect that.

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
Bug: 152973950
Change-Id: I5b9e9b83d17c4a93a1e830c26d7f44001ccf175d
2020-04-03 08:48:00 +01:00
Feng Cao
59b682f5cd Define custom equals method for bundles in the inline APIs
Test: atest android.view.inputmethod.cts
Bug: 152811052

Change-Id: I15051493bb37f05b579b16d6e7fee36b05ab10cc
2020-04-01 12:46:15 -07:00
Feng Cao
edb332c645 Replace Nullable bundle with NonNull and use Bundle.EMPTY
Test: atest InlineSuggestionsRequestTest
Bug: 152525467

Change-Id: Ie510e08ced8be4cc8df486f1acfa6eb330d194ef
2020-03-31 14:50:51 -07:00
Svet Ganov
5baa279868 Properly layout InlineContentView
bug:152723089
bug:152319052

Test: atest android.view.inputmethod.cts.InlineSuggestionTest

Change-Id: I656c2fb75560719210aa1efe8b9f06a0ced4d7e0
2020-03-31 03:37:24 +00:00
Adam He
f27433af0f Migrate android.view.inline to android.widget.inline
Old APIs are kept and marked as @hide + @removed to maintain
compatibility.

Bug: 151262653
Test: manual verification
Change-Id: Ia50a1f87c194211be5256e948d43fb54c1cbf941
2020-03-29 17:29:32 -07:00
Shu Chen
27daeb0307 Merge "Calculates the slop values per upper/lower line height." into rvc-dev 2020-03-25 09:54:48 +00:00
Shu Chen
afbcf851d3 Calculates the slop values per upper/lower line height.
Also applies the max/min damping range for slop.
The max/min damping range includes lineHeight + slop.
Note: slop must >= zero.

Bug: 150531840
Test: manual & automated tests
  atest FrameworksCoreTests:EditorCursorDragTest
  atest FrameworksCoreTests:TextViewActivityTest

Change-Id: I26cdf69fd2cf7d4514dd2a902ed34c480c9e8781
2020-03-25 15:56:06 +08:00
Bernardo Rufino
c797aac41e Gate toast block and remove warning
Gate background custom toast block on targetSdk for beta 1, after
having gathered dogfood feedback. So, enabling the change for apps with
targetSdk > Q (>= R). Also removed warning toast.

Added tests in topic CL to cover all the cases.

Bug: 144152069
Test: atest android.widget.cts29.ToastTest android.widget.cts.ToastTest
Change-Id: If368a97a2a8ff56770635615f89c79007bb27075
2020-03-24 20:22:18 +00:00
Bernardo Rufino
255094826d Clarify Toast.Callback javadoc
Text was ambiguous and could mean callback object construction instead
of toast construction.

Test: Builds
Bug: 144152069
Change-Id: I06160de2b85f339517ae45d3bd4cc1098f433ef0
2020-03-24 18:12:44 +00:00
Hui Yu
3dc45fbc57 Update AppOps & UsageStats when app widget tapped.
When the app widget on the launcher is tapped on:
1. Update AppOps. AppOps treats the underlying app as foreground so the app can get while-in-use
permission.
2. Report a USER_INTERACTION event to UsageStats so UsageStats can
update mLastTimeUsed and mLastTimeVisible of this package.

Bug: 149043079
Test: manual test, tapped on a widget.
Change-Id: Ic8c91190881cf5dcf89f0f72cfd410b0c2e86bf6
2020-03-21 08:36:54 -07:00
TreeHugger Robot
4f4706de1f Merge "Fix PopupWindow's wrong location" into rvc-dev 2020-03-19 21:51:45 +00:00
Sally Yuen
56da5ed373 Merge "Implement ACTION_LONG_CLICK for accessibility" into rvc-dev 2020-03-18 21:45:46 +00:00
sallyyuen
cc02ea36b2 Implement ACTION_LONG_CLICK for accessibility
Due to changes in R, the a11y framework no longer dispatches touch
events for a long press. This prevents the activation of EditText's floating menu.

We can re-enable it by implementing the proper a11y action
ACTION_LONG_CLICK. The menu itself is diffult to access through TalkBack's linear
navigation, but this is future work for a separate known issue.

Start and stop the menu for editable TextViews, which includes EditTexts.
Since touch events are no longer sent by a11y, separate the
accessibility handling from the touch handling infrastructure for long clicks in Editor.

We can't go through the main performLongClick code because it doesn't
actually start the action mode but rather sets pending, which routes
back to TextView. There's too little separation between the touch events and action logic.

Whoever touches the performLongClick code may need to also make
corresponding changes to the a11y path, but I suspect this won't happen often.

Remove the onInitializeA11yNodeInfo override for EditText because this
is handled by TextView.

Bug: 148127445
Test: Tested text fields in various apps. ag/10602004. atest
FrameworksCoreTests:TextViewActivityTest#testToolbarAppearsAccessibilityLongClick

Change-Id: I3958e5b80e6156e03c99335e0d0b671438965ebb
(cherry picked from commit 3f1203fb78)
Merged-In: I3958e5b80e6156e03c99335e0d0b671438965ebb
2020-03-17 18:30:08 +00:00
Tony Mak
a10f2b981a Merge "Remove local text classifier and related tests." into rvc-dev 2020-03-17 11:50:58 +00:00
Shu Chen
422e7eada2 Merge "Makes the finger-to-cursor distance configurable via DeviceConfig." into rvc-dev 2020-03-17 03:18:55 +00:00
Tony Mak
293bdf360a Remove local text classifier and related tests.
1. libtextclassifier and libtextclassifier-java are no longer built
   into framework/base.
2. Removed local text classifier code
3. Removed local text classifier test code.
   All of them should be already moved to libtextclassifier/tcs side.
4. Unify all the TC related log tags to "androidtc".

BUG: 147412216

Test: mts-tradefed run mts-extservices
Test: atest frameworks/base/core/java/android/view/textclassifier
Test: Sanity test: Smart selection

Change-Id: Icb1076153f51d5674c8a6c58681ffed5aa772149
2020-03-16 20:16:17 +00:00
Sunny Goyal
838c49bed6 Merge "Updating widgets docs" into rvc-dev 2020-03-16 20:07:53 +00:00
Sunny Goyal
296d4b5821 Updating widgets docs
Bug: 151195866
Test: N/A
Change-Id: Ice98b876c64653bde7337ac123746392790dea1b
2020-03-13 14:02:32 -07:00
Shu Chen
c331032de5 Makes the finger-to-cursor distance configurable via DeviceConfig.
Bug: 149885871
Test: manual tested.
Change-Id: I545be8aa594dde6c3412167fcdf1bad3403a11a3
2020-03-12 10:58:48 +08:00
TreeHugger Robot
592181386c Merge "Making time-zone an API constant" into rvc-dev 2020-03-12 01:23:28 +00:00
TreeHugger Robot
f5589a71e0 Merge "Temporary fix to disable augmented autofill requests coming from password fields." into rvc-dev 2020-03-11 21:43:58 +00:00
Suprabh Shukla
2e7408eddb Making time-zone an API constant
This is already effectively an API the way it is documented.
Updating all the references of the hard-coded constant.

Test: make update-api && make

Bug: 151112929
Change-Id: Iadeb03c516215cfc51bc8604b67250348d5a4375
2020-03-10 18:05:02 -07:00
Adam He
ef0fe20852 Temporary fix to disable augmented autofill requests coming from
password fields.

Bug: 141703197
Test: atest android.autofillservice.cts.augmented
Change-Id: I05330988899a4c21d69c655a39c29fd0fea298c3
2020-03-10 10:47:09 -07:00
Jacky Kao
4686370935 Merge "Improvement of IME Enter Action" into rvc-dev 2020-03-10 04:05:58 +00:00
Dieter Hsu
04a579c6b7 Merge "Update API ExtraRenderingInfo by review feedback" into rvc-dev 2020-03-10 03:08:50 +00:00
Shu Chen
45b08852ad Merge "Unifies the finger-to-cursor distance between drag cursor and drag handle." into rvc-dev 2020-03-09 23:46:42 +00:00
Shu Chen
7700342166 Unifies the finger-to-cursor distance between drag cursor and drag handle.
This cl also fixes the way to simulate the touch events in EditorCursorDragTest, with correct raw X/Y.

Bug: 150534899
Test: manual & automated tests
  atest FrameworksCoreTests:EditorCursorDragTest
  atest FrameworksCoreTests:TextViewActivityTest

Change-Id: I0e9ef73082534ab98ddeddee0218374ed6d556a2
2020-03-09 10:58:23 +08:00
Dieter Hsu
809a286aef Update API ExtraRenderingInfo by review feedback
Bug: 150685398
Test: m update-api docs
Change-Id: Id21dbde8d15dc936fbbe157b1b50e19564dcd051
Merged-In: Id21dbde8d15dc936fbbe157b1b50e19564dcd051
(cherry picked from commit 327bb81a78)
2020-03-06 05:15:41 +00:00
Jacky Kao
e09f66e71d Improvement of IME Enter Action
1. Remove the internal using argument, ACTION_ARGUMENT_IME_ACTION_ID_INT.
2. Add more descriptions about this accessibility action, ACTION_IME_ENTER

Bug: 150831470
Test: atest AccessibilityTextActionTest
Change-Id: Icfebdf280e3441bf7b2b6f55c3febbe3a1d98de6
2020-03-05 15:21:09 +08:00
Bernardo Rufino
0a7ced1dd3 Show toasts from system/sysUI to all users
The package name test is safe:
* If it's used by Toast class in an app, apps have access to layout
  params anyway via getWindowParams() and applied flag is already
  protected by INTERNAL_SYSTEM_WINDOW permission.
* If it's used by ToastUI class in sys UI on behalf of another app,
  sys UI is trusted domain and can't be messed up by another app. It
  also has INTERNAL_SYSTEM_WINDOW permission.

Bug: 149408635
Test: atest ToastUITest android.widget.cts.ToastTest
      android.widget.cts29.ToastTest android.server.wm.ToastTest
Test: Change phone to vibration/silent in secondary user and observe
      toast is displayed.

Change-Id: I227e9f74166300fcb3ba8f3871b464afe6ec6a28
Merged-In: I227e9f74166300fcb3ba8f3871b464afe6ec6a28
(cherry picked from commit caef507aa9)
2020-02-28 21:42:36 +00:00
Bernardo Rufino
dee28c91a3 Unify toast presentation code
Extract window layout construction and view inflation from Toast and
ToastUI into common @hide class ToastPresenter. This is desirable by
itself but also in preparation for making system toasts visible to all
users.

Bug: 149408635
Test: atest ToastUITest android.widget.cts.ToastTest
      android.widget.cts29.ToastTest android.server.wm.ToastTest

Change-Id: Ifdd7ee37687da2e4c7abed61569cf342f95b2611
Merged-In: Ifdd7ee37687da2e4c7abed61569cf342f95b2611
(cherry picked from commit aea2c50cd8)
2020-02-28 16:18:42 +00:00
Shu Chen
2c591e8c6b Merge "Makes sure the magnifier source bounds doesn't beyond the surface." into rvc-dev 2020-02-27 11:47:13 +00:00
hh83.kim
4ebacd3abf Fix PopupWindow's wrong location
Sometimes, we have seen cases that Popupwindow is located in the wrong place.
So we suggest some modification of logics in tryFitVertical and tryFitHorizontal methods of PopupWindow.
In those methods, there exists a statement whether the positions of anchor (anchorTopInScreen and anchorLeftInScreen) are bigger than 0.
However, there are some cases that those values become positive even though corresponding popup windows are not visible to user (places out of window area),
especially on devices with displaycuout, or apps with multiwindow modes.
So we modify to the anchor's top and left position values should be compared with top and left value of displayFrame, respectively, not 0.

Test: CtsWidgetTestCases:test android.widget.cts.PopupWindowTest

Bug: b/135749682
2020-02-26 10:10:44 -08:00
Sunny Goyal
c444b514bf Removing possible user defined strings from bugreport view-dump
Bug: 64101886
Test: Verified build
Change-Id: Ifad98a268fc17a2e1572ca3e0962a89447083294
2020-02-25 10:00:37 -08:00
Shu Chen
d06b330767 Makes sure the magnifier source bounds doesn't beyond the surface.
Test: locally verified.
Bug: 150122887
Change-Id: I3df94f0f073197f4a321faac24fa222f9dbb1674
2020-02-24 22:53:59 +08:00
Nikita Dubrovsky
72a7f8a7b3 Merge changes from topic "cursor-control-flags"
* changes:
  Allow setting defaults for DeviceConfig flags plumbed via settings
  Use DeviceConfig flags for cursor drag and insertion handle gestures
2020-02-20 04:23:20 +00:00
Shu Chen
c54b3fad76 Merge "Supports dynamic height for the new magnifier." 2020-02-20 00:43:39 +00:00