970 Commits

Author SHA1 Message Date
lpeter
133fce0171 Move the logic of transferTouchFocusToImeWindow to IMMS.
It would better move logic of transferTouchFocusToImeWindow
from WindowManagerService to InputMethodManagerService.

Bug: 149574510
Test: atest CtsAutoFillServiceTestCases
Test: atest CtsInputMethodTestCases
Change-Id: I268b09781e5eb7c77c4912efdc8fd5d6936ada27
2020-03-20 12:16:44 +08:00
TreeHugger Robot
76b89b6d72 Merge "Remove the InlineActions API" into rvc-dev 2020-03-19 01:10:39 +00:00
Feng Cao
d493c2f9eb Fix potential NPE in autofill Session
Test: atest android.widget.cts.CompoundButtonTest#testPerformClick
Test: atest CtsAutoFillServiceTestCases
Fix: 151814848

Change-Id: I22f70ff47b47b92d6093698719022febf7b076d3
2020-03-18 15:54:54 -07:00
Feng Cao
bc6900480d Remove the InlineActions API
* Use the original authentication instead
* Also support sending intent from augmented autofill, with the
  limitation of not supporting sending back the FillResponse or
  Dataset from the activity result

Test: manual
Test: atest android.autofillservice.cts.inline
Test: atest android.autofillservice.cts.FillResponseTest
Test: atest android.autofillservice.cts.augmented
Test: atest android.autofillservice.cts.LoginActivityTest
Bug: 150499490

Change-Id: I81031ff456adb4c07f530188dda80e97cc84b707
2020-03-17 21:12:47 -07:00
Feng Cao
323255dd28 Fixed deadlock in InlineSuggestionSession.
* by using the same lock from the autofill Session

Test: manual
Test: atest android.autofillservice.cts.inline
Bug: 151580124

Change-Id: Ia34b1d0ea85c24eddf1cf1b89d07c331bb411023
2020-03-16 15:49:11 -07:00
Feng Cao
99852d7d70 Revert "Revert "Do not block autofill on waiting for the IME response""
This reverts commit 949ec8ad6baf5516cbfd27b7e24d0e563c1f42a9.

Reason for revert: will check in the original patch with a fix

Test: manual
Test: atest android.autofillservice.cts.inline
Bug: 151580124
Bug: 150757314

Change-Id: I37d05eb627595c25018dd82e50db3a9b054c90a5
2020-03-16 14:50:56 -07:00
TreeHugger Robot
54248b6a04 Merge "Revert "Do not block autofill on waiting for the IME response"" into rvc-dev 2020-03-16 20:30:11 +00:00
Yohei Yukawa
949ec8ad6b Revert "Do not block autofill on waiting for the IME response"
This reverts commit 69471c8f155327fe55b4bb7f9db9ac2be454ab17.

Reason for revert:
Caused a deadlock between AutofillManagerService#mLock and
InlineSuggestionsRequestCallbackImpl#mLock.

Bug: 150757314
Fix: 151580124
Test: presubmit
Change-Id: Ic021facea34cbc34ad5e113790e739ab7f472c1f
2020-03-16 18:44:03 +00:00
Feng Cao
dfde8e6aa9 Merge "Do not block autofill on waiting for the IME response" into rvc-dev 2020-03-13 19:53:09 +00:00
Adam He
640c3b4f92 Merge "Hide autofill highlight if filling only the focused field." into rvc-dev 2020-03-13 18:52:57 +00:00
Feng Cao
f0e7d48fec Merge "Sends click and long click events from the inline suggestion to host app" into rvc-dev 2020-03-13 18:25:48 +00:00
Feng Cao
69471c8f15 Do not block autofill on waiting for the IME response
Test: manual
Test: atest CtsAutoFillServiceTestCases
Test: atest CtsInputMethodTestCases
Test: atest CtsInputMethodServiceHostTestCases
Bug: 150757314

Change-Id: I2e029616267bef73d96d6ae3bbc0398939206157
2020-03-12 18:40:51 -07:00
Feng Cao
deec8f0175 Sends click and long click events from the inline suggestion to host app
Test: manual, atest InlineSuggestionTest
Bug: 151185482

Change-Id: Iafeb4584feca8a1cb1374f81105fa22136eba183
2020-03-12 15:51:22 -07:00
Adam He
5061db8a34 Hide autofill highlight if filling only the focused field.
Fixes: 150953184
Test: atest CtsAutoFillServiceTestCases
Change-Id: Ifc23a70a41022931d6828ff9a14620bb8fc58604
2020-03-12 13:38:34 -07: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
Feng Cao
88fc7ff900 Send inline actions to IME even when inline suggestions are empty
Test: manual
Bug: 150952929

Change-Id: Ia0429936f65cd1fe82c7d33d76c4e885be875103
2020-03-10 13:02:46 -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
Feng Cao
88872971a7 Create InlineAction class to wrap the IntentSender and the presentation
* Before this change, we were putting the action intent in the Slice,
  but we realize that's not the best place as slice is only meant for
  data representation, and intent does not fall into that
* This patch includes the code to actually fire the pending intent when
  action suggestion is clicked. However, it'll only work if the fill
  service have the SYSTEM_ALERT_WINDOW permission for the intent to
  be fired when it is in the background. We will move it to be fired
  from the client foreground app in a separate patch

Test: manual verification
Test: atest android.autofillservice.cts.inline
Bug: 150499490

Change-Id: I411a7ee05e783f7de94a54064c44a6126afe0b12
2020-03-09 17:32:31 -07:00
Feng Cao
1001711551 Merge "Fix augmented autofill to not send multiple request on the same field" into rvc-dev 2020-03-04 00:50:39 +00:00
Adam He
4fbfa530d7 Merge "Fix explicit intent for instant app tests." into rvc-dev 2020-03-03 22:39:40 +00:00
Feng Cao
8aee9bc74a Fix augmented autofill to not send multiple request on the same field
* Don't send multiple request when focused view doesn't change
* The difference is *when to return*. In the old code, we are returning
  only when all four conditions are met, otherwise we will go to the
  next lines requestNewFillResponseOnViewEnteredIfNecessaryLocked()
  which will indeed trigger a new augmented autofill request. In the
  new code, we will return if the three conditions are met, or if the
  other three conditions are met...

Test: manual verification
Test: atest android.autofillservice.cts.inline
Test: atest android.autofillservice.cts.augmented
Bug: 145949573

Change-Id: I9ff3873e3aec8c1366d4aa16c9ef7662cfde45e2
2020-03-03 14:31:29 -08:00
Feng Cao
c9611acb62 Merge "Notify autofill with the IME start/finish input view events" into rvc-dev 2020-03-03 18:36:11 +00:00
Feng Cao
7c85eb79a7 Notify autofill with the IME start/finish input view events
* autofill will cache the inline suggestions response until it receives
  a start input view event from IME
* the data flow from IMS point of view is:
  IMS#startViews and IMS#doStartInput (before calling onStartInputView)
  ->
  [async] InlineSuggestionsRequestCallback#onInputMethodStartInputView()
  --- process boundary ---
  ->
  IMMS.InlineSuggestionsRequestCallbackDecorator
     #onInputMethodStartInputView()
  ->
  InlineSuggestionSession.InlineSuggestionsRequestCallbackImpl
     #onInputMethodStartInputView()
* similar data flow for  IMS#finishViews()
* this CL should not block IME's UI thread because it's only issuing a
  new async IPC from IMS start/finish input view call that's running on
  the UI thread.
* there should not be performance impact on IMEs if autofill inline
  integration is not active

Test: manual verification, atest EditorInfoTest
Test: atest android.autofillservice.cts.inline, with two failing cases:
 InlineAugmentedLoginActivityTest#testAugmentedAutoFill_twoDatasetThenFilledSecond
 and InlineAugmentedLoginActivityTest#testAugmentedAutoFill_oneDatasetThenFilled
 due to the test itself being broken, I'll fix the test in a separate patch
Bug: 149522488
Bug: 149442582
Change-Id: I2faa3577b9f95a122f26a6d7fa7822a769a51e34
2020-03-02 21:18:16 -08:00
Adam He
1e2d693a94 Fix explicit intent for instant app tests.
Add null checks to ensure RemoteInlineSuggestionRenderService is not
being called if service component cannot be found.

Fixes: 150315090
Fixes: 150318779
Fixes: 150319014
Fixes: 150039791
Fixes: 150304313
Test: atest CtsAutoFillServiceTestCases --instant
Test: atest CtsInputMethodServiceHostTestCases --instant
Change-Id: Ie8c84b12a0dc8e7415d94e4edb919de27827b799
2020-03-02 16:39:46 -08:00
TYM Tsai
b1f42dd78a Uses SurfacePackage instead of SurfaceControl on inline suggestion
The InlineContentView uses the SurfacePackage instead of the SurfaceControl
for accessibility and UiAutomation supporting.

Bug: 149194105
Test: manual
Change-Id: Ib10f37a58dde7dc09d0ea16d1a121088dab4738e
2020-03-02 20:51:46 +08:00
Feng Cao
ec496000ec Several improvements and bug fixes to the inline autofill flow
* Pipe the augmented autofill's inline actions through to the
  InlineSuggestionsResponse
* Do not send the inline action if the number of inline suggestions is
  zero
* Refactor autofill inline suggstion session so that all the calls to
  the IME has happens within the class
* Send an empty response to IME to hide the inline suggestion UI  when
  view exits and the previous response wasn't empty

Test: manual verification, atest InlineLoginActivityTest
Bug: 149522488
Bug: 150312201

Change-Id: I7a0dbf44e9fad6e7da857448c0f2b186e1681d17
2020-02-28 17:25:30 -08:00
TreeHugger Robot
28a5ed1cfb Merge "Allow disojoint datasets for inline suggestions." into rvc-dev 2020-02-27 10:15:08 +00:00
Adam He
2106506181 Allow disojoint datasets for inline suggestions.
Autofill providers are allowed to pass back datasets that do not always
contain data for all views present. Inline response will ignore datasets
not relevant to currently focused AutofillId or those without an
InlinePresentation.

Fixes: 150312101
Test: atest InlineLoginActivityTest
Change-Id: Ie4d48eec571d4ccbfcbff8aa3ad4a75f7716072c
2020-02-26 17:58:28 -08:00
Feng Cao
4b0ef392c2 A few inline autofill API tweaks.
* add isPinned() to InlineSuggestionInfo so IME can choose to pin the suggestion
* allow augmented autofill service to set inline actions in the response
* non-api change: pull the autofill hints from the Slice in the InlinePresentation

Test: m -j; atest InlinePresentationTest, atest CtsInputMethodTestCases:InlineSuggestionInfoTest CtsInputMethodTestCases:InlineSuggestionTest
Bug: 137800469

Change-Id: I63b6b843ef056df18c317299e617b8fe21907374
2020-02-26 13:49:54 -08:00
Joanne Chung
599d349712 Merge "Fix wrong parameter fieldIndex caused IndexOutOfBoundsException" into rvc-dev 2020-02-25 02:20:57 +00:00
Feng Cao
85cbe43d48 Merge "Use context for correct display in the renderer service" into rvc-dev 2020-02-24 22:10:06 +00:00
Felipe Leme
339b7149af Improved user callbacks on SystemService:
* Renamed:

  onStartUser() -> onUserStarting()
  onStopUser() -> onUserStopping()
  onSwitchUser() -> onUserSwitching()
  onUnlockUser() -> onUserUnlocking()
  onCleanupUser() -> onUserStopped()
  isSupportedUser() -> isUserSupported()

* Added:

  onUserUnlocked()

Tested on automotive, which uses the callbacks to dump user metrics:

$ adb shell dumpsys car_service --user-metrics
adb shell dumpsys car_service --user-metrics
* User Metrics *
  no users starting
  no users stopping
Last 10 started users
  2020-02-21T19:44:47.101 - user=0 start=2020-02-21 19:44:45.357 unlocking=+885ms unlocked=+1s122ms
  2020-02-21T19:44:56.376 - user=10 start=2020-02-21 19:44:47.380 switch=+209ms unlocking=+8s262ms unlocked=+8s994ms
  2020-02-21T20:00:08.792 - user=11 start=2020-02-21 20:00:04.634 switch(from 10)=+351ms unlocking=+4s44ms unlocked=+4s156ms
Last 10 stopped users
  2020-02-21T20:00:48.323 - user=10 stop=2020-02-21 20:00:16.741 shutdown=+31s581ms

Test: m update-api
Test: atest BackupManagerServiceTest
Test: manual verification (see above)
Fixes: 150001654

Exempt-From-Owner-Approval: approved on master right before rvc split

Merged-In: I8774c57620030b9aa8e7ec039a6a758ad56db368
Change-Id: I8774c57620030b9aa8e7ec039a6a758ad56db368
(cherry picked from commit 58e7458ac7204992c5408eb2d6420d767afc4eb8)
2020-02-24 16:44:52 +00:00
Joanne Chung
b0b721bbe0 Fix wrong parameter fieldIndex caused IndexOutOfBoundsException
The inline authentication change ag/10235929 changes the parameter of
createInlineSuggestion from fieldIndex to datasetIndex. However, the
passed parameter forget to change to datasetIndex. It is possible to
trigger IndexOutOfBoundsException when we have multiple fields but
only one dataset.

Bug: 149891961
Test: atest android.autofillservice.cts.inline.InlineAuthenticationTest
Test: Manual test by local sample
Change-Id: Iec074b14f2aa3fdb7de918ad684192921b9c5d65
2020-02-24 15:58:05 +00:00
Svet Ganov
02fdd34057 Use context for correct display in the renderer service
bug:149958394

Test: atest android.autofillservice.cts.inline.InlineLoginActivityTest

Change-Id: I4bcdca8188b9b97076c4146f0f9eddffe3e1b3b1
(cherry picked from commit 2aa4f109961966c49e9cb1be4b3e96605a996c54)
2020-02-22 19:54:59 +00:00
TreeHugger Robot
53f8aeaa8d Merge "Fixed NPE in the InlineSuggestionFactory for augmented autofill request" 2020-02-21 03:50:54 +00:00
Feng Cao
d4e2c49d6a Fixed NPE in the InlineSuggestionFactory for augmented autofill request
Test: manual verification
Bug: 149940463

Change-Id: I5fa48ca463654e5f86c834f71ab6d625e8992c5e
2020-02-20 18:30:36 -08:00
Adam He
b909557790 Merge "Hide suggestions with hideFillUi" 2020-02-21 01:26:05 +00:00
Adam He
217649d3ed Hide suggestions with hideFillUi
Fix: 149945531
Test: atest InlineLoginActivityTest
Change-Id: Ibd6d19165c69f51fbe92addbf114c9d123147362
2020-02-20 14:27:11 -08:00
Charles Chen
c56ce6fd08 Merge "Exempt-From-Owner-Approval: Report non-visual Context misuse" 2020-02-20 12:30:06 +00:00
Andrii Kulian
5877c7d6c0 Exempt-From-Owner-Approval: Report non-visual Context misuse
Make obtaining a visual service from non-visual Context instance
report a strict mode violation and print the stacktrace.

Make calling getDisplay() throw an exception if called on an instance
that is not associated with a display. For existing usages introduce
a new internal method that does not perform the verification until
the usages are properly fixed.

Bug: 128338354
Test: StrictModeTest#testIncorrectContextUse_GetSystemService
Test: StrictModeTest#testIncorrectContextUse_GetDisplay
Change-Id: Id25d590eca6e10066e55d7ed6436d3bc9e433beb
2020-02-20 01:29:25 +00:00
Feng Cao
6c821f6ea1 Merge "Introduces the Bundle to inline suggestions APIs to encode custom UI styling information." 2020-02-19 22:35:42 +00:00
Feng Cao
36960ee20e Introduces the Bundle to inline suggestions APIs to encode custom UI styling information.
* The bundle will be generated/consumed by the support library.
* More API documentation and example usage will be added later once we have the support library impl ready.
* The old style resource name approach doesn't work due to the potential mismatch in the support library version across the host IME and the platform renderer service, and the non-static nature of the public attribute int id in the support lib.
* The Bundle added to the onCreateInlineSuggestionsRequest() is intended for the platform/ExtServices to communicate the UI versions it supports.
* The Bundle added to the InlinePresentationSpec is intended for the IME to communicate the custom styles for the chosen UI versions.

Test: manual verification, and also atest CtsInputMethodTestCases:InlineSuggestionInfoTest CtsInputMethodTestCases:InlineSuggestionTest CtsInputMethodTestCases:InlineSuggestionsRequestTest CtsInputMethodTestCases:InlineSuggestionsResponseTest
Bug: 146454892

Change-Id: Id7fea32a7550fb924fec811b376790474a7b92eb
2020-02-19 09:42:22 -08:00
TYM Tsai
a36a8ba363 Fix FillEventHistoryTest failed on CtsAutoFillServiceTestCases
Timeout for waiting the event history

Fixes: 149720333
Test: atest CtsAutoFillServiceTestCases:FillEventHistoryTest
Change-Id: I9056508c12f7a4d946fbdb7cde053e5ca81104cf
2020-02-18 20:15:22 +08:00
Adam He
5be0f15801 Response and Dataset authentication via inline autofill.
Bug: 148815880
Test: manual verification
Change-Id: Ic72f6d828521737db5ce890c0e79cd6f8d16a6c6
2020-02-14 16:25:52 -08:00
Adam He
4011625638 Move rendering logic for inline suggestions to ExtServices.
Added a render service in ExtServices to connect to the renderer in
androidx.autofill for inline suggestion slices.

Cleaned up old UI rendering code that lived in system_server.

Bug: 146453086
Test: atest ExtServicesUnitTests
Change-Id: I25a7ea438afe524683671c850625ae80dacccfaa
2020-02-14 11:15:43 -08:00
Ahaan Ugale
00aa0ae7bf Implement filtering for Inline Autofill.
Does not include filtering for Augmented Autofill.

The InlineSuggestionsResponse callback is called on every input change
as a mitigation for an IME attempting to glean potentially sensitive
content of the suggestions.

CLs will follow for disabling filtering in certain situations (to
prevent the Keyboard from gleaning the suggestions) and for caching the
inflates).

Test: manual
Test: atest CtsAutoFillServiceTestCases CtsInputMethodTestCases
Bug: 146452916
Change-Id: I396c2cb279f1eb552bbae8c3509cb29c95e86609
2020-02-11 19:37:06 +01:00
Ahaan Ugale
cd50731b92 Some cleanup for autofill.Session.updateLocked()
Cleanup for the VIEW_CHANGED case:
* method decomposition
* clarify comment wording and placement
* remove now unnecessary comments

Test: atest CtsAutoFillServiceTestCases CtsInputMethodTestCases

Change-Id: If04eb5ab9a0a83c5c80d3378923dee54493bb629
2020-02-11 19:35:58 +01:00
TreeHugger Robot
1ff2f07455 Merge "Make suggestion chip non-focusable to remove the background shadow" 2020-02-08 20:48:19 +00:00
TreeHugger Robot
79ca0c84db Merge "Show augmented autofill suggestion inline iff both augmented autofill service and ime support inline." 2020-02-08 02:01:40 +00:00
Feng Cao
e93d586c0f Make suggestion chip non-focusable to remove the background shadow
Test: manual
Bug: 146535667

Change-Id: I9d3289014d9ae542f4ebd46309530c6b80801892
2020-02-07 17:44:57 -08:00