224 Commits

Author SHA1 Message Date
Philip P. Moltmann
f539389ee9 Prune abandoned autofill sessions
Regularly check if the sessions are still valid and clear the ones that
are not.

Test: 1. Started session in dialer
      2. Home button (dialer goes in background)
      3. kill -9 dialer
      4. Wait 30 seconds
      5. Start session is messenger
      6. dialer session stays

      1. Started session in dialer
      2. Home button (dialer goes in background)
      3. kill -9 dialer
      4. Swipe dialer from recents
      5. Wait 30 seconds
      5. Start session is messenger
      6. dialer session is removed
Fixes: 38005472

Change-Id: I8199ce44777b313141ee1eab6c8de5ad5089474a
2017-05-05 15:15:14 -07:00
Felipe Leme
4745fb6b29 Fixed placemente of Autofill UI for virtual views.
The PopupWindow anchoring offset should be based on the bottom of the anchor
view, but we were using top. Hence, the PopupWindow.tryFitVertical() was
failing to place it above the view in some cases, even when there was plenty
of space.

Fixes: 37991460
Test: manual verification with virtual view sample
Test: CtsAutoFillServiceTestCases pass

Change-Id: Iffdfe0d7858e865192338184d63bf5b93ba7108f
2017-05-05 08:31:38 -07:00
Felipe Leme
1f8b07bb8d Improved dump() on Autofill UI.
Bug: 37958210
Bug: 37986800
Test: adb shell dumpsys autofill --ui-only

Change-Id: Ia580eba219c919f7e84cdd39b756d60cd687f275
2017-05-04 11:06:34 -07:00
Felipe Leme
9a2e6058df Always start a manual request, even if view was already autofilled.
Fixes: 36034784
Test: CtsAutoFillServiceTestCases pass
Test: testAutofillManuallyAgainAfterAutomaticallyAutofilledBefore()
Test: testAutofillManuallyAgainAfterManuallyAutofilledBefore()

Change-Id: Ided8c42367b71766772bd364445510848db2adce
2017-05-03 12:08:19 -07:00
Felipe Leme
395f0ec8d2 Send AutofillValue of Views that originated a forced request.
Bug: 36034784
Test: CtsAutoFillServiceTestCases pass
Test: LoginActivityTest.testAutofillManuallyPartialField()

Change-Id: I79970f236f0ae3caaff60acc19ab8a08c3cb2ef4
2017-05-02 13:56:11 -07:00
TreeHugger Robot
c0851e72a5 Merge "Make auth fill UI size sane size" into oc-dev 2017-05-02 01:33:27 +00:00
Svetoslav Ganov
640a135e8a Make auth fill UI size sane size
Now the width and height are capped to 0.9 of the screen
dimensions. The height is also adjusted as needed by the
popup window positioning logic.

Test: manual

bug:36660292
Change-Id: I54d032f4e9b9b8fae6f98846c470a1455babcb68
2017-05-01 16:18:37 -07:00
Felipe Leme
c2430f3c4d Removed deprecated setAuthentication() method that didn't take ids.
Such method would cause the AutofillUi to show on all fields, now it only
shows in the fields the service is interested on.

This doesn't solve FillResponse auth on multiple partition, but that will
come soon...

Bug: 37424539
Test: removed hack from testFillResponseAuthJustOneField()
Test: CtsAutoFillServiceTestCases pass

Change-Id: Id97dddfb9fc1630cd6bac96b9bae9d4a2986dd6d
2017-05-01 11:21:54 -07:00
Philip P. Moltmann
b4ff3bbdb1 Apply proper theme to SaveUi
Bug: 37754078
Test: Started SaveUI on angler and marlin. angler was green, marlin was
      blue
Change-Id: I1b2f07269d3df3949344672f23329ea735c22a94
2017-04-28 14:17:05 -07:00
Felipe Leme
c21f723ca2 Merge "Changed EXTRA_DATA_EXTRAS to EXTRA_CLIENT_STATE." into oc-dev 2017-04-28 20:29:49 +00:00
Felipe Leme
37a440fd8b Changed EXTRA_DATA_EXTRAS to EXTRA_CLIENT_STATE.
Test: CtsAutoFillServiceTestCases pass

Fixes: 37775662

Change-Id: I85c016c3eb84a439371ac707f78b01d9882b75e9
2017-04-28 11:03:57 -07:00
Felipe Leme
9f9ee25515 Improved Autofill logging.
- Removed ui.Helper.
- Replaced DEBUG and VERBOSE constants by sDebug and sVerbose.
- Added a shell command to dynamically set the constants.
- Removed obsoleted log statements.
- Changed log-level of some log entries.
- Removed unused methods.

Fixes: 36141126

Test: CtsAutoFillServiceTestCases pass
Test: manual verification

Change-Id: Ic08ee9a2adc10e63f49bbcc7ed126455462dc9c1
2017-04-28 06:56:23 -07:00
Felipe Leme
0aa4c5065d Refactored Autofill to move starting flag out of Session.
Otherwise, all onFillRequest() calls in the same partition would use
the same flags.

Fixes: 37675138
Test: existing CtsAutoFillServiceTestCases pass
Test: CtsAssistTestCases pass
Test: PartitionedActivityTest.testAutofill4ParitionsMixManualAndAuto() pass

Change-Id: I03c8a036637bae534904d4f41265e451088cf940
2017-04-27 23:38:14 -07:00
Svetoslav Ganov
70c0221813 Merge "Implement the rest of autofill importance modes" into oc-dev 2017-04-28 06:30:07 +00:00
Svet Ganov
fd31f85d0c Implement the rest of autofill importance modes
Test: CTS tests pass; augmented tests to verify new behavior

bug:36171235

Change-Id: Ieff2b8d7e1c3a3eba456deca7bed70c8e29c415e
2017-04-27 18:16:08 -07:00
Philip P. Moltmann
8abf3cbe1a Fix LoginActivityTest#testIsServiceEnabled
Test: CtsAutoFillServiceTestCases
Change-Id: I584fb1bf72cbb233a4b3280f3bce47d02dee933c
Fixes: 37728979
2017-04-27 14:07:09 -07:00
Philip P. Moltmann
6249eff01d Do not autofill twice
Looks like a merge issue

Bug: 37728979
Test: CtsAutoFillServiceTestCases
Change-Id: I743b1cdc1a5544712e15d81073c9b1449d527b6e
2017-04-27 12:07:23 -07:00
TreeHugger Robot
d915c42150 Merge "Autofill binding permission fixes." into oc-dev 2017-04-27 04:56:44 +00:00
Svet Ganov
48f10a2ab5 Handle package changes in autofill manager service
Autofill manager service was not observing package changes thus
we did not properly handle the cases of the service being updated,
added, and removed. Handling, additions is needed to properly
support restore from a backup. Fixed a few missing locks.

Test: all autofill CTS tests pass and manually tested update, add,
      and remove of autofill services.

bug:36638606
bug:36978445

Change-Id: Idd47891774ba2a4e562a1952cbb5a048211fd4e3
2017-04-26 19:22:05 -07:00
Felipe Leme
decd887f01 Autofill binding permission fixes.
- Removed deprecated BIND_AUTO_FILL
- Renamed BIND_AUTOFILL to BIND_AUTOFILL_SERVICE
- Kept BIND_AUTOFILL as @hide
- Fixed the permission code

The permission check was actually ignored; it was probably broken when we
introduced support to settings.

Fixes: 37723410
Bug: 37563972
Test: manual verification with existing client
Test: CtsAutoFillServiceTestCases pass

Change-Id: If3abdcb0ae850f0a327bfdbb9ca6c44a24823047
2017-04-26 17:57:53 -07:00
Felipe Leme
bb81092a31 Provide support for optimized ACTION_REQUEST_SET_AUTOFILL_SERVICE.
Also removed obsolete 'cmd autofill save'

Bug: 2153814
Test: manual verification

Change-Id: I082e6bb098e9be5d9e26d0941efcf6f28ab01e1d
2017-04-26 12:07:17 -07:00
Svetoslav Ganov
dc6cccb905 Get rid of custom negaitve save button label
Removed the ability for an autofill provider to set
a custom string for the negative button. Also make
the old hidden APIs non-abstract to avoid runime
crashes for unimplemented methods.

Test: CtsAutoFillServiceTestCases pass

bug:37649790

Change-Id: If776d26de48382eeb064bdead5d4d5fdb0ff2e7e
2017-04-26 16:48:20 +00:00
Philip P. Moltmann
121e526476 Return all previous FillContexts onFill
Test: CtsAutoFillServiceTestCases
Fixes: 37673341
Change-Id: I80feb5bd8d6027fb4ec2dd32f5c486dae7c6bc4c
2017-04-25 16:48:31 -07:00
Philip P. Moltmann
c761963214 Report multiple FillContext-s onSave
To make life easier the reponseId is not part of the FillResponse.

Test: CtsAutofillServiceTestCases (added test for multiple Contexts)
Change-Id: If09e00b7267d293e4234a7a9837ad88d73af1b24
Fixes: 36481649
2017-04-25 15:22:08 -07:00
TreeHugger Robot
fc513f98d7 Merge "Added APIs that let AutofillService implementations set themselves as such." into oc-dev 2017-04-25 08:56:03 +00:00
Felipe Leme
db041188bc Added APIs that let AutofillService implementations set themselves as such.
Bug: 37576671
Test: manual verification
Test: CtsAutoFillServiceTestCases (with new tests) pass

Change-Id: I6fd61f8a2826dbf6b6fce831f3deadf6df025386
2017-04-24 18:44:09 -07:00
Philip P. Moltmann
2f517c26d2 Take new autofill structure for each partition
Bug: 36481649
Test: CtsAutofillServiceTestCases (now with a test that has an autofill
      session over two full screen fragments)
Change-Id: I55f2f6203f3bd5a7082b4ce90500d2c16a260c7d
2017-04-24 16:50:14 -07:00
Felipe Leme
85d1c2d290 Minor fixes on Autofill Framework:
- Removed default implementation of onProvideAutofillVirtualStructure() that
  was using accessibility API (it's useless because without the View calling
  AutofillManager.notifyViewEntered(), it would never be triggered).
- Fixed obsolete TODOs.
- Removed obsolete service class name constant.
- Removed unused debug constant.

Fixes: 37078783
Fixes: 33197203
Bug: 33802548
Bug: 35956626

Test: CtsAutoFillServiceTestCases pass
Merged-In: I834d34b8af8bf0d781dc7e0ffcd6e600bfa2d183
Change-Id: I834d34b8af8bf0d781dc7e0ffcd6e600bfa2d183
2017-04-24 16:01:12 -07:00
TreeHugger Robot
05204cb775 Merge "Added accessibility type on Autofill save dialog." into oc-dev 2017-04-22 02:53:12 +00:00
TreeHugger Robot
ede054a73e Merge "Fine tune the Autofill Save UI" into oc-dev 2017-04-21 18:53:21 +00:00
Felipe Leme
56d86dd775 Added accessibility type on Autofill save dialog.
Fixes: 34219631
Test: CtsAutoFillServiceTestCases pass

Change-Id: I19087c57268c05004df91e4262a17db3743947e6
2017-04-21 09:08:33 -07:00
TreeHugger Robot
ab8238e233 Merge "Don't trigger new partition on fields from SaveInfo" into oc-dev 2017-04-21 06:06:53 +00:00
TreeHugger Robot
bb21986b33 Merge "Implemented FillResponse.setIgnoredIds()." into oc-dev 2017-04-21 02:54:13 +00:00
Felipe Leme
6d24c30d8d Don't trigger new partition on fields from SaveInfo
Fixes: 37551943

Test: existing CtsAutoFillServiceTestCases pass
Test: modified LoginActivityTest.testSaveOnly
Test: new LoginActivityTest.testSaveOnlyOptionalField

Change-Id: I2ae11c4f0aebe63fd02f81fbc37466435e3a2820
2017-04-20 18:36:45 -07:00
Felipe Leme
01ded104a1 Implemented FillResponse.setIgnoredIds().
Fixes: 37424141

Test: existing CtsAutoFillServiceTestCases pass
Test: PartitionedActivityTest.testIgnoredFieldsDontTriggerAutofill

Change-Id: I09bd95230c45d2970080514e25cb53320de49b56
2017-04-20 17:38:27 -07:00
Felipe Leme
49e96960d4 Fixed NPE on dump() and other minor fixes...
Bug: 36871500
Test: manual verification
Change-Id: I1c3a8406344280da37b728eae56f26447c48e0b2
2017-04-20 15:53:06 -07:00
Philip P. Moltmann
c530c9dae4 Fine tune the Autofill Save UI
Test: Looked at UI, CtsAutofillTestCases
Fixes: 37417692
Change-Id: Iee2cc5ceb99dd71cc43f55af7299d488b35234e6
2017-04-20 11:06:38 -07:00
TreeHugger Robot
42775f2a89 Merge "Add a way to read the last AutofillSelection." into oc-dev 2017-04-19 02:43:08 +00:00
TreeHugger Robot
fad9b07e31 Merge "Clone autofill service settings on managed profile." into oc-dev 2017-04-19 00:20:09 +00:00
Philip P. Moltmann
cc684ed41f Add a way to read the last AutofillSelection.
- Check UID to make sure one service cannot read FillSelections of other
  services
- Add id to Dataset to allow to tag the datasets. This id is then found
  in the FillSelection.Event
- Add clientState to FillSelection to allow service to store more data

Fixes: 36871500
Test: CtsAutoFillServiceTestCases
Change-Id: Ice894245508227265294a1c59ea97842175e5aec
2017-04-18 16:59:40 -07:00
Philip P. Moltmann
7fa4198ab1 Merge "Change saveOnAllViewsInsible from boolean to flags" into oc-dev 2017-04-18 22:28:20 +00:00
TreeHugger Robot
461fd10d6a Merge "Fixed WTF that happens on race condition." into oc-dev 2017-04-18 22:15:17 +00:00
Felipe Leme
aa00896b8d Clone autofill service settings on managed profile.
Test: manual verification
Change-Id: I9d13e4230265b18444bfd30fd403c5fb98b88159
Fixes: 37351722
2017-04-18 15:14:43 -07:00
Philip P. Moltmann
9023d14fb3 Change saveOnAllViewsInsible from boolean to flags
Change-Id: Ibd6f283479bad841eb7b20bb8d006562c4398e9f
Fixes: 35708237
Test: CtsAutoFillServiceTestCases
2017-04-18 10:24:48 -07:00
Felipe Leme
0ed99bc6df Fixed WTF that happens on race condition.
Test: it's a log change, and it compiles :-)
Change-Id: Ie6409b92a5b7ad21ade5aecc0b7e78602aa3f605
Fixes: 37216544
2017-04-17 19:17:20 -07:00
Philip P. Moltmann
494c3f5da2 Allow to finish session when all views are gone
An service can option to finish the session once all views that it
declared as important. Views that are important are all autofillable
views of any partition and the saveable fields of the last partition.

Test: CtsAutoFillServiceTestCases
Fixes: 35708237
Change-Id: I0ccade8ebb427e5d8928697ef0007c75d3f83df0
2017-04-16 21:36:25 -07:00
Svetoslav Ganov
41200eac71 Merge "Add support for multiple fill contexts" into oc-dev 2017-04-15 03:29:13 +00:00
Svet Ganov
013efe173e Add support for multiple fill contexts
When saving data filled by the user the platform provides to
an autofill provider the state of the UI allowing the provider
to interpret this state and store relevant information.

A limitation of the current design is that the fill provider
needs to interpret the screen content twice, once handling a
fill request and once handling a save request. To address this
we are introducing a id for each fill request allowing the
autofill provider to associate arbitrary state with each fill
request and store it in the client data bundle later passed
to save.

Another limitation of the current design is that if the screen
changes dynamically while the user interacts with the app the
UI state passed on save represents a static snapshot, therefore
it is not possible to the autofill provider to determine the
context in which the data in the UI was filled. We could
keep the views and have deltas for views being removed/added
/moved/changed but this is not enough as the fill provider
needs to know not only what changed but what changed for every
fill request and in one session there could be multiple fill
requests. To address this we provide a list of fill contexts
on save each of which has the id of the corresponding fill
request. This allows the fill provider to know the exact context
in which the data was popuplated and also use its custom client
state for this fill request if desired.

This change deprecates the old APIs and the new ones delegate
to the old ones. Once the clients migrate to the new APIs we
will remove the old ones.

Test: all autofill CTS tests pass

Change-Id: Idcebcc671aa3c078a305d8c358e225274fccc588
2017-04-14 17:37:31 -07:00
Philip P. Moltmann
e048a65639 Fix some racines in AutofillManager
- The session might be gone by the time the handler is called, hence check
  the sessionID
- Access getClientLocked() and mSession only under mLock.

Test: cts-tradefed run cts-dev AutoFillServiceTestsCases
Change-Id: I445a24557589afadb1f5372b63ef9db88021b609
2017-04-14 12:50:03 -07:00
Svet Ganov
833c68e9fd Fix NPE in autofill
Test: manual

bug:37330744

Change-Id: I110ece0b9283adb9998f8df795e2107da772482e
2017-04-14 17:29:51 +00:00