Commit Graph

8557 Commits

Author SHA1 Message Date
Seigo Nonaka
ba987ca94f Override isRestricted for preventing unexpected resource loading
Bug: 179461812
Test: atest FontResourceTest
Change-Id: Ifb731310d31b80522bc82052625716083cac9e6f
(cherry picked from commit 0de34e9d87)
2021-03-12 19:32:27 +00:00
Shu Chen
62f51e6722 Makes the multi-touch prevention only works for editable TextView.
The original logic of preventing the multi-touch issue for the edtiable
text view was introduced by ag/10930920.
Turns out the non-editable text views are affected.

The root cause of the issue is that:
 - the ACTION_DOWN/ACTION_UP events, as well as ACTION_PONITER_DOWN /
   ACTION_POINTER_UP, could be generated by different fingers,
 - and View#onTouchEvent() gets muted when isFromPrimePointer() == false,
 - so that no gesture is generated, e.g. click, long press, etc.

Note that View#onTouchEvent() is necessary to be muted to prevent long press
on text or scrolling while dragging the insertion handle view.

Bug: 169288151
Change-Id: Ia763e94be727ad23bb13839f146293f1579d03ec
(cherry picked from commit 265096d9da)
2020-10-23 05:31:30 +00:00
yingleiw
8e36f0a26e Add accessibility manager enabled check in progressbar
formatStateDescription() in onProgressRefresh() is causing performance
degradation with accessibility off.

Note that stateDescription is set in onInitializeAccessibilityNodeInfo
to ensure that accessibility always get the update-to-date
stateDescription. Otherwise, stateDescription might be stale on first
accessibility focus and the user might get wrong information.

Fix: b/166215147

Test: tested with talkback enabled from the beginning or from the
middle.

Change-Id: I9fb99b479b172d87c8d0fa1b8765dab53445b993
(cherry picked from commit fc9d9b800f)
2020-09-08 19:15:19 +00:00
TreeHugger Robot
01d9441cec Merge "Update docs to clarify how providers can create style bundles and Slices for inline suggestions." into rvc-dev am: 18cff6082d am: 6128b1ba0f
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12265211

Change-Id: I83317ac5a0f2d33ff2403a0b3777f06a15fc347b
2020-08-18 00:35:23 +00:00
Nikita Dubrovsky
81fa5e436a Add DeviceConfig flag for drag direction angle threshold for cursor drag
Bug: 160786691
Test: Manual and unit tests
  atest FrameworksCoreTests:EditorTouchStateTest
  atest FrameworksCoreTests:EditorCursorDragTest
Change-Id: Ib2e88fbdce4f901772d73bc7ee60483c98e02509
Merged-In: Ib2e88fbdce4f901772d73bc7ee60483c98e02509
(cherry picked from commit 8bac79d651)
2020-08-05 20:15:49 +00:00
Adam He
5277e0781d Update docs to clarify how providers can create style bundles and Slices
for inline suggestions.

Fixes: 162437790
Test: atest android.autofillservice.cts.inline
Change-Id: If02b34ec7978897545c0b7eabfebb8db0b9417c0
2020-08-03 13:06:38 -07:00
Shu Chen
0cb53bb606 Ensures the slop value is fixed cross lines.
In Q, the slop is a fixed value calculated based on
TextView.getLineHeight().
In R (before this cl), the slop is a dynamic value based on the height
of the current line.

It's been confirmed as the root cause of the regression bug b/159528374.

This cl changes the slop value back to the fixed value.

Bug: 159528374
Test: Verified locally.
Change-Id: I182d22779f1c1155ae2e0b0deb0455bd270b2fd9
Merged-In: I182d22779f1c1155ae2e0b0deb0455bd270b2fd9
2020-07-22 13:00:48 +00:00
TreeHugger Robot
4bd5923372 Merge "Fixes the issue multi-touch causing launcher icons to be not clickable." into rvc-dev am: 94df031718 am: fed46df3f3
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12163209

Change-Id: I2769a7cfc03bfc2c86cb0b627c4a5605c1e2df0d
2020-07-17 17:30:07 +00:00
Pinyao Ting
b4444ff0a1 Fixes the issue multi-touch causing launcher icons to be not clickable.
The issue occurs because TextView#isFromPrimePointer assumes multi-touch
events are happening on the same TextView and relies on
ACTION_UP/ACTION_CANCEL to reset the Prime pointer id.

consider following scenario:
1. ACTION_DOWN (pointer 0) landed on ViewA,
   ACTION_DOWN (pointer 1) landed on ViewB.
2. ACTION_MOVE landed on both ViewA and ViewB, triggering a drag.
3. When all fingers are released, ACTION_CANCEL (pointer 0) will be
   landed on both ViewA and ViewB, so the prime pointer in ViewB is not
   reset due to pointer index mismatch.

This CL always reset prime pointer id whenever ACTION_UP/ACTION_CANCEL
is triggered.

Bug: 157399040
Test: manual
Change-Id: Id35d9eac939378482fa50e85bb5cda58469240ad
2020-07-16 20:59:10 -07:00
Seigo Nonaka
223c8e0118 Apply max char length when setSingleLine is called.
Bug: 145128646
Test: atest android.widget.cts.EditTextTest
Change-Id: I1f2fd6c97c5cdeb7be5017d4c6aeb19fd269e939
Merged-In: I1f2fd6c97c5cdeb7be5017d4c6aeb19fd269e939
2020-07-09 22:57:52 +00:00
Seigo Nonaka
a0c653945b Set upper-limit for the single line edit text.
Bug: 145128646
Test: atest EditTextTest#testSingleLineMaxLength
Change-Id: I32b28dcc8c18386839b5adea5b73c77896036567
Merged-In: I32b28dcc8c18386839b5adea5b73c77896036567
2020-07-09 15:42:28 -07:00
Nikita Dubrovsky
b1ad3b6800 Change cursor drag threshold from 30 to 45 degrees from vertical
Bug: 158948887
Test: Manual and unit tests
  atest FrameworksCoreTests:EditorTouchStateTest
  atest FrameworksCoreTests:EditorCursorDragTest
Change-Id: I6b30c0d6ef9c93fd4fd6aae3004cd6965e9d7be4
2020-07-01 13:14:19 -07:00
Jorim Jaggi
37cf2279c9 Merge "Pass in callsite of SurfaceControl constructor explicitly (1/3)" into rvc-dev 2020-06-26 23:58:17 +00:00
Jorim Jaggi
d42ab1b938 Pass in callsite of SurfaceControl constructor explicitly (1/3)
Creating a new Throwable (and filling in the stack trace) can take
up to 150us. Since we do this on the critical path when sending
over SurfaceControl via binder multiple times, this is too much.
Instead, add an option to pass in callsite manually.

Bug: 159056748
Change-Id: I46c339c15a07192d61c4c546e46f260684a47120
Merged-In: I46c339c15a07192d61c4c546e46f260684a47120
Exempt-From-Owner-Approval: Large scale refactor
2020-06-26 15:35:23 +02:00
Qi (wangqi) Wang
db0dbea190 Fix the visibility of SurfaceView in InlineContentView.
SurfaceView doesn't respect the visibility of its ancestor so we need to
update it accordingly inside InlineContentView.

Test: manually
Bug: 158714351

Change-Id: If482747d6ae5d7628b46de837c11b6232406120c
2020-06-24 19:45:46 -07:00
Svet Ganov
4846803547 Address missed comments from previous CL
bug:153826463

Test: atest android.widget.cts.inline.InlineContentViewTest#testReparenting

Change-Id: Iddb1f4d2e0b7043517616d0ec3678a55f9eda34c
2020-06-24 06:39:28 +00:00
Svet Ganov
a5b4990d96 Handle reperenting of InlineContentView
When an inline content view is reparented its surface is
getting offset and not being under the view itelf. This is
because the surface views manage the postion of their
surface and are assuming a location based off the window's
surface position. However after a reparenting the inline
content view's surface position becomes relative to that
of the new parent surface view. For example, two surface
views at position (10, 10) being reparented would reslut
in the surface of the parent being at (10, 10) while the
surface of the child being at (20, 20) while both views
would still be at (10, 10).

To address this we are intecepting when an inline content
view's surface is reparented and get a weak reference to
the view that owns the new parent surface. We then position
the inline content view's surface relative to the view that
owns the new parent surface, i.e. we position the surface
such that its location would not change because of the
fact it is being reparented.

While at this make sure the inline content view is marked
as not important for a11y to ernsure the a11y plugins don't
try to click on the view tree in the app's process but
insted on the views in the remote proccess, i.e. on the
embedded view tree.

bug:153826463

Test: atest android.widget.cts.inline.InlineContentViewTest#testReparenting

Change-Id: I2cff4b88d404a740bc447668e948eabccad084d2
2020-06-24 06:27:17 +00:00
Svetoslav Ganov
449851f8e2 Merge "Support clipping in InlineContentView" into rvc-dev 2020-06-23 22:43:14 +00:00
Nikita Dubrovsky
e97b0ecadc Fix double-tap detection in TextView's SelectionModifierCursorController
This restores the logic removed from SelectionModifierCursorController
in ag/9994946. A quick sequence of "tap", "drag", "tap" events (such
as when quickly scrolling a small input field) should *not* be treated
as a double-tap.

Bug: 158948887
Test: Manual and unit tests
  atest FrameworksCoreTests:EditorTouchStateTest
  atest FrameworksCoreTests:EditorCursorDragTest
Change-Id: I9fb9cb06b1e208946566a0f70697c62ee7684ca0
2020-06-22 17:14:03 -07:00
Svet Ganov
787ec3f050 Support clipping in InlineContentView
Support clipping for InlineContentView's backing surface
to enable suggestions clipping that does not require re-
parenting which has side effects.

bug:153826463

Test: atest android.widget.cts.inline.InlineContentViewTest#testReparenting

Change-Id: Ia2988ebd660323bf65f0141b4b542a9c4320e178
2020-06-22 16:50:49 -07:00
Yuncheol Heo
c53014cbf6 Merge "Gets the userId from Context for AccessibilityManager in ToastPresenter." into rvc-dev 2020-06-18 17:29:13 +00:00
Yuncheol Heo
a3ad557655 Gets the userId from Context for AccessibilityManager in ToastPresenter.
- In Android Auto, android.widget.cts.ToastTest#testShow_whenTextToast_sendsAccessibilityEvent failed is failed, since AccessibilityManager in ToastPresenter is initialized with the wrong userId.
- ToastUI creates the Context from the uid of the received message, so we can get the correct userId from the Context.

Bug: 154644563
Test: atest android.widget.cts29.ToastTest android.widget.cts.ToastTest
      android.server.wm.ToastWindowTest ToastUITest
      NotificationManagerServiceTest LegacyToastTest
Change-Id: I138620a0a52e65429157719f588c4be56b075368
2020-06-17 22:53:43 +00:00
Qi (wangqi) Wang
d0292964f3 Make underlying SurfaceView respect visibility of InlineContentView.
SurfaceView doesn't respect its ancestor's visibility change, so we need
a OnPreDrawListener listener to update it according to visibility change
in the view hierarchy.

Bug: 158714351

Test: verified locally

Change-Id: I7d6a7db48e037ed7d4ec2ecb23a158e8d1c43240
2020-06-12 18:53:34 -07:00
Abodunrinwa Toki
934df62467 Merge "Disable language logging in TextClassifier/TranslateEvent" into rvc-dev 2020-06-11 16:40:13 +00:00
Feng Cao
10e6217a8d Fix NPE in InlineContentView
* The NPE is due to in the InlineContentView we try to reparent the
  surface view which is no longer attached to the window, this can
  happen if the InlineContentView is attached to window and then
  immediately detached from the window, before the surface package
  is returned from the remote view process.
* Release the surface package immediately in this case, so the
  remote view can be released.

Test: atest android.autofillservice.cts.inline
Bug: 158139090

Change-Id: I9efdf8ba182a1d66334362edcfb6ba58fcdc222a
2020-06-08 18:52:21 -07:00
Tony Mak
a67cba7381 Disable language logging in TextClassifier/TranslateEvent
Bug: 158481016
Test: atest android.widget.cts.TextViewTest
Test: atest tests/tests/textclassifier/src/android/view/textclassifier/cts
Change-Id: I7e9ea69f67858714a7fd3b0d06ad1b88000999e0
2020-06-08 17:54:47 +00:00
Yuichiro Hanada
93ec9b85e5 Revert tab key behavior on multiline EditTexts.
This CL reverts ag/10267783 effectively.
ag/10267783 makes tab key insert \t character on multiline text fields,
however, it broke the existing apps which depends on the previous
behavior.

Bug: 154290658
Test: manual - Tab key on multiline text fields advance focus
Test: atest TextViewTest#testKeyNavigation
Change-Id: I9836ce29321ca789bce6636514ce9a8dbf923ada
2020-05-13 21:26:36 +09:00
Feng Cao
b46851c964 Support re-attaching the inline suggestion view to window
* Before this change, when the inline suggestion view is detached from
  the IME window (e.g. due to layout change), the remote view content
  will not show again even after the view is reattached to the window
  on the IME side. This patch fixes it by requesting the remote view
  owner (the ext services) for a new SurfacePackage when the view is
  re-attached to the window (see javadoc of SurfaceControlViewHost for
  why this works).
* This patch also fixes the issue where the SurfaceControlViewHost was
  never released in the ext services. This is done by notifying the
  ext services (through system server) when the view is detached from
  the IME window, and then the system server will release the
  SurfaceControlViewHost if after N(=500) ms the view is not re-attached
  to a window.
* After the SurfaceControlViewHost is released, if the view is
  re-attached to the window later, a new SurfaceControlViewHost will be
  created to back the same InlineContentView.
* The current code structure also lays a foundation for a subsequent
  change to allow reusing the same remote view for inline suggestions
  during filtering.

Test: atest CtsAutofillServiceTestCases (sanity test)

Bug: 153615023
Bug: 154683107

Change-Id: Idc587e1e82a96b792c351796464821b7aad7cd89
2020-05-06 19:30:39 -07:00
Andrew Sapperstein
8fe35e5f21 Fix broken @see tags in public documentation.
These were previously being suppressed by doclava but with this change,
all failures are fixed and the suppression logic has been removed.

To fix the issues, there were a few possible changes made:
- broken reference to a public API (such as incorrect parameters): fixed
- unnecessary @link inside an @see tag: fixed
- @see referring to an @hide or @SystemApi: reference removed
- broken references to inner class constructors
 - worked around by fully qualifying the constructor

Bug: 6963924
Test: make doc-comment-check-docs
Exempt-From-Owner-Approval: cherry-picked from master
Change-Id: Ifbdce2de96cdffa560bd90f549fa7184d1f9af85
Merged-In: Ifbdce2de96cdffa560bd90f549fa7184d1f9af85
(cherry picked from commit e0624c7a40)
2020-05-01 18:25:32 +00:00
TreeHugger Robot
d725389a55 Merge "Update the documentation for inline suggestion APIs" into rvc-dev 2020-05-01 01:42:05 +00:00
TreeHugger Robot
5630dc86ed Merge "Use TextClassicationSession to call smart selection APIs." into rvc-dev 2020-04-29 17:34:09 +00:00
TYM Tsai
e79aa09f87 Update the documentation for inline suggestion APIs
Update the APIs documentation and add test cases

Bug: 152316540
Test: atest InlinePresentationStyleUtilsTest
Change-Id: Icff5d5b36fecd94ceb7db5446eefa16b4b1aac3b
2020-04-29 17:21:01 +08:00
Kevin Chyn
412bd81933 Move ImeAwareTextEdit from Settings to android.widget
Also use it for AuthCredentialPasswordView

Bug: 154161590

Test: BiometricPromptDemo, authenticate with password
Change-Id: I17601848dd9be3d0580988e3ff613c3793dfed51
2020-04-28 18:06:25 -07:00
Aran Ink
d397b9084d Add dismissImmediate to ListPopupWindow to prevent window leaks in GlobalActionsDialog.
Fixes: 154640131
Test: Manual -- Use 'adb shell dumpsys window windows || grep "PopupWindow"' to confirm number of PopupWindows displayed (should be zero at home screen.)
Open GlobalActions. Tap the power overflow menu and check number of PopupWindows while the overflow dropdown is visible (should be 1).
Put the phone to sleep by pressing the power button. Wake phone and make sure number of PopupWindows is 0.
Repeat with Controls structure switcher dropdown and add controls dropdown.

Change-Id: I4ae2d86e981465e8e6c0adf924a6fc2eabfc88ee
2020-04-24 18:06:14 -04:00
Tony Mak
6f4e063edb Use TextClassicationSession to call smart selection APIs.
We used to use TextClassicationSession to send us logging only (i.e.
onSelectionEvent()). Now we use TCSession to call smart selection APIs
(i.e. suggestSelection and classifyText). This allows the TCS to
obtain the session ID in onSuggestSelection and onClassifyText.

BUG: 149077320

Test: atest TextViewActivityTest
Test: Try a few smart selections and log the sessionID of each TC APIs.

Change-Id: I320249735aa08fb7e8612060955b2aa5496da94b
2020-04-24 12:35:48 +01:00
TYM Tsai
4ddfdaf641 Merge "Filter the content of the Bundles used as extras and styling APIs" into rvc-dev 2020-04-24 08:42:56 +00:00
TreeHugger Robot
b22931a0fb Merge "Process numpad enter key along with enter key." into rvc-dev 2020-04-23 01:12:52 +00:00
TYM Tsai
850c8129e6 Filter the content of the Bundles used as extras and styling APIs
Adds filter to prevent passing binder objects in the extras and styling
APIs for inline suggestions. Avoids these to be used to send over remote
objects for Autofill provider and IME to communicate through private APIs
bypassing the OS.

Bug: 152316540
Test: atest CtsAutoFillServiceTestCases
Test: atest InlineSuggestionsRequestTest
Change-Id: I00940a845ed0e2546cbe09fa36e2439869c2f783
2020-04-22 14:41:07 +08:00
Jeff Sharkey
b67e70aa40 Merge changes from topic "apr19" into rvc-dev
* changes:
  Update some Parcelables to send Strings UTF-8.
  Offer to write Strings through Parcels as UTF-8.
2020-04-21 22:59:40 +00:00
Jeff Sharkey
0223df096c Update some Parcelables to send Strings UTF-8.
An earlier CL with benchmarks has shown that sending strings as UTF-8
is 50% faster for US-ASCII strings, and still 68% faster for complex
strings referencing higher Unicode planes.  (So an improvement in
both cases!)

Since code across the OS still makes heavy assumptions about Parcel
strings typically being UTF-16, we need to carefully migrate
Parcelables by hand, which is what this CLs begins doing.

This is a purely mechanical refactoring with no functional changes.

Bug: 154436100
Test: manual
Exempt-From-Owner-Approval: trivial refactoring
Change-Id: Ia9e581efd7c40269342b7528ca07363deb843c0f
2020-04-21 22:59:26 +00:00
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
Byungsung You
975a5f7aa5 Process numpad enter key along with enter key.
Some views define only KEYCODE_ENTER action not KEYCODE_NUMPAD_ENTER.
because of this, when numpad enter key is pressed expected result is not shown.
We are adding KEYCODE_NUMPAD_ENTER to be processed in the same way as KEYCODE_ENTER.

Test: Check that adb shell input KEYCODE_NUMPAD_ENTER and adb shell input KEYCODE_ENTER

Bug: b/141329038

Change-Id: I87b5159c4fe71eaf8501059249c79b7cfd1752fc
2020-04-15 18:36:11 -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