93 Commits

Author SHA1 Message Date
Felipe Leme
17b3afcb7e Added shadow to RemoteViews used by authentication requests.
Also removed obsolete autofill symbols and dimensions.

Fixes: 36492836
Bug: 36569941

Test: visual verification
Test: CtsAutoFillServiceTestCases pass

Change-Id: Id8169358bf426af5d70a82fa315e92304d06c159
2017-03-23 19:54:59 -07:00
Felipe Leme
24d5893b25 Added a UserManager.DISALLOW_AUTOFILL restriction.
bug: 35710740

Test: cts-tradefed run commandAndExit cts-dev -m CtsAutoFillServiceTestCases -t android.autofillservice.cts.LoginActivityTest#testUserRestriction
Test: cts-tradefed run commandAndExit cts-dev -m CtsDevicePolicyManagerTestCases -t com.android.cts.devicepolicy.MixedDeviceOwnerTest#testDisallowAutofill_allowed
Test: cts-tradefed run commandAndExit cts-dev -m CtsDevicePolicyManagerTestCases -t com.android.cts.devicepolicy.MixedProfileOwnerTest#testDisallowAutofill_allowed
Test: cts-tradefed run commandAndExit cts-dev -m CtsDevicePolicyManagerTestCases -t com.android.cts.devicepolicy.MixedManagedProfileOwnerTest#testDisallowAutofill_allowed

Change-Id: I41b2bf9fe3bc8df627c6650960bd11346c430a7e
2017-03-22 17:20:48 -07:00
TreeHugger Robot
a94c527736 Merge "Autofill a manual request directly when it only has one dataset." 2017-03-22 17:34:05 +00:00
Felipe Leme
f7a7bb6b50 Autofill a manual request directly when it only has one dataset.
Tests:
- renamed testManualAutofill() to testManualAutofillOneDataset()
- added testManualAutofillTwoDatasetsPickFirst()
- added testManualAutofillTwoDatasetsPickSecond()

Bug: 35708229
Test: LoginActivityTest pass
Test: manual verification
Change-Id: I7aa60ab5df60decaf49d617bf3e9fcf3ab0074fa
2017-03-21 10:37:12 -07:00
Felipe Leme
5311206f34 Add custom presentation (RemoteViews) on Dataset values.
New tests on LoginActivityTest:

- testAutofillOneDatasetCustomPresentation()
- testAutofillMultipleDatasetsCustomPresentations()
- testAutofillMultipleDatasetsCustomPresentationSameFields()
- testAutofillMultipleDatasetsCustomPresentationFirstDatasetMissingSecondField()
- testAutofillMultipleDatasetsCustomPresentationSecondDatasetMissingFirstField()

Fixes: 36067706
Test: CtsAutoFillServiceTestCases pass

Change-Id: Iacb660bf5a5cf311dea4bfcbfe1b3722aab34715
2017-03-20 18:20:28 -07:00
Felipe Leme
d66c84fa1a Removed redundant call to session.removeSelf()
Bug: 35721501
Test: CtsAutoFillServiceTestCases pass
Change-Id: I625c08bd8f9f673892387c703082c3eb5b2fd48d
2017-03-17 17:09:56 -07:00
TreeHugger Robot
4bb2ccca8d Merge "Fixed cancel() and commit():" 2017-03-17 08:16:04 +00:00
TreeHugger Robot
b096e58811 Merge "Sets accessibility title for autofill dataset picker." 2017-03-17 06:43:05 +00:00
Felipe Leme
6d0cb1e8eb Fixed cancel() and commit():
- Call removeSelfLocked() on cancelSessionLocked.
- Call removeSelf() after dispatching the PendingSaveRequest.
- Added a finalizer callback to PendingSaveRequest that calls removeSelf().
- Fixed SaveUi SnackBar so its actions are only triggered once.
- Reused removeSelfLocked() when needed.
- Removed unnecessary {} on some lambdas.
- Removed unnecessary mLock on PendingSaveRequest.
- Removed unnecessary mLock usage on PendingFillRequest.

Test: CtsAutoFillServiceTestCases (including new tests) pass
Test: manual verification

Fixes: 35721501
Fixes: 35844249

Change-Id: I9789218777b62a9558a602b8eaed0714d8b77fa0
2017-03-16 19:51:59 -07:00
Felipe Leme
24aae15218 Added a new AutofillCallback.EVENT_INPUT_UNAVAILABLE event.
This event is called when:

- After notifyViewEntered() when autofill is disabled.
- After service returns an "empty" FillResponse to FillCallback.onSuccess().

BUG: 36056207

Test: LoginActivityTest.testAutofillCallbackDisabled
Test: LoginActivityTest.testAutofillCallbackNoDatasets
Test: VirtualContainerActivityTest.testAutofillCallbackDisabled
Test: VirtualContainerActivityTest.testAutofillCallbackNoDatasets

Change-Id: I7b8636473f738bf600aa96b28c77827b2cc78815
2017-03-16 19:40:22 -07:00
Felipe Leme
b4f868deca Sets accessibility title for autofill dataset picker.
Bug: 34219631
Test: CtsAutoFillServiceTestCases (with new tests) pass

Change-Id: I9bda820a41ef82e008f2a1ffd32c286b91841c10
2017-03-16 18:06:22 -07:00
Philip P. Moltmann
7b77116802 TRON log important auto-fill events
Example log from
android.autofillservice.cts.LoginActivityTest#testAutoFill#testAutoFillOneDatasetAndSave
(translated from numbers of human readable string):

AUTOFILL_SESSION_STARTED
   package=android.autofillservice.cts
AUTOFILL_REQUEST
   type=TYPE_SUCCESS
   package=android.autofillservice.cts
   FIELD_AUTOFILL_SERVICE=android.autofillservice.cts
   FIELD_AUTOFILL_NUM_DATASETS=1
AUTOFILL_FILL_UI
   type=TYPE_ACTION
   package=android.autofillservice.cts
   FIELD_AUTOFILL_NUM_DATASETS=1
   FIELD_AUTOFILL_FILTERTEXT_LEN=0
AUTOFILL_DATASET_APPLIED
   package=android.autofillservice.cts
   FIELD_AUTOFILL_NUM_VALUES=2
   FIELD_AUTOFILL_NUM_VIEWS_FILLED=2
AUTOFILL_SAVE_UI
   package=android.autofillservice.cts
   FIELD_AUTOFILL_NUM_IDS=2
AUTOFILL_DATA_SAVE_REQUEST
   type=TYPE_SUCCESS
   package=android.autofillservice.cts
   FIELD_AUTOFILL_SERVICE=android.autofillservice.cts
AUTOFILL_SESSION_FINISHED
   package=android.autofillservice.cts

Test: Ran auto-fill tests and looked at event log.
Change-Id: I58aaa58e4435e7d04c8cd91878411943d3eb13de
2017-03-16 15:41:33 -07:00
TreeHugger Robot
5bf03b7640 Merge "Allow users to manually request Autofill." 2017-03-16 01:33:46 +00:00
Felipe Leme
2ac463e3f5 Allow users to manually request Autofill.
- Added a requestAutofill(view,flags) method, that when passed with
  FLAG_MANUAL_AUTOFILL triggers a manual request.
- Added same method for virtual views
- Overloaded existing AutofillService request methods to take a flag.
- Added an AUTOFILL context menu option on TextViews.
- Added a canRequestAutofill() that is used to enable the context menu.

BUG: 35708229
Test: manual verification
Test: existing CtsAutoFillServiceTestCases pass
Test: android.autofillservice.cts.LoginActivityTest#testManualAutofill pass

Change-Id: I1a64d40da3373774451d178b1cabf20f11120e9d
2017-03-15 09:37:10 -07:00
Philip P. Moltmann
0ab7ad5839 Merge "Do not filter non text values." 2017-03-15 16:10:05 +00:00
Philip P. Moltmann
2aedac13b7 Do not filter non text values.
Test: Ran CTS autofill tests
Bug: 36123241
Change-Id: I747b516c3ec924487523756f075989ff94d97ab4
2017-03-14 17:22:56 -07:00
Felipe Leme
82e3793c15 Decouple Dataset ids from SaveInfo.
The FillResponse was automatically adding the AutofillId of all Datasets to
the SaveInfo object, but that would cause problems when the AutofillService
is not able to save some data (for example, if it comes from a read-only
backend).

Bug: 36076444
Test: OptionalSaveActivityTest pass
Test: m update-api
Change-Id: I1d5faaddf29e1be0f357438c8485e07caf975293
2017-03-14 15:56:58 -07:00
Philip P. Moltmann
9b31b4eac8 Merge "Make it clear which type of AutoFillValue is set" 2017-03-14 21:59:39 +00:00
Philip P. Moltmann
9668903731 Make it clear which type of AutoFillValue is set
throw and handle errors if the wrong value is set for a view

Test: android.autofillservice.cts.AutofillValueTest
Change-Id: Ida80da7913a210bede6c47d6b7a6f215a012a84c
2017-03-14 09:11:47 -07:00
Felipe Leme
104b932b7b Fixed obsolete TODOs.
Test: not needed
Bug: 35395043
Bug: 26742218

Change-Id: I0e5adb574610374055a6546b66529a7aed7cc413
2017-03-14 08:41:49 -07:00
Svet Ganov
2f8fb1f62f Fix a few auto fill ussues
1. Ensure clicking on a focused view brings up autofill if needed

2. Notify the autofill manager in a couple of cases we missed

3. Renamed the AutofillManager app facing APIs to better reflect what
    they do and added a API for the app to cancel the autofill interaction

4. Fix view structure dispatch where the ordering of children for autofill
    was mixed with ordering of direct view children - the autofill children
    may be indirect as views can be marked not important for autofill

5. Show scrollbars only if there are more fill options than want is shown

6. Show only three fill options and the rest can be accessed with a scroll

7. Remove the list divider to allow fill items to control all fill window content

8. Renamed the autofill manager internal service classes to xxAutofillxx

9. Fixed a comment that was not addressed in a previous CL

10. Showing max three fill options - rest needs a scroll

11. Make sure fill UI shown when filter with no matches is changed
      to filter with some matches

12. Make sure the fill window has a shadow

Test: Autofill CTS tests pass and manual

bug:36038929
bug:36040101
bug:36149166
bug:36034681
bug:36126001
bug:36035654

Change-Id: Ic8726146fc3c0a19d3e536becdd63fb65622136e
2017-03-13 21:57:10 -07:00
Philip P. Moltmann
55223b48f0 Fix java-doc reference
Test: Built
Change-Id: I5171d23145bfddc1e36b8e579c208f73472a0da4
2017-03-13 16:36:32 -07:00
Felipe Leme
640f30a776 Replaced auto-fill by autofill to keep it consistent with API style.
This change will affects 2 types of apps: autofill service implementations
and apps that use autofill APIs.

Since just the former is known to be used at the moment, we're not trying
to keep backward compatibility with the latter.

Bug: 35956626
Test: CtsAutoFillServiceTestCases pass
Test: android.provider.SettingsBackupTest pass

Change-Id: Ia720083508716deae9e887f9faa7ae7c5a82f471
2017-03-09 08:14:49 -08:00
Felipe Leme
16539f3378 Two fixes on autofill save.
1.Fixed race condition on save request - if the service was unbound, it would
  mark the RemoteFillService as completed and the retry would be dropped.
2.Removed session when save request is canceled.

Change-Id: Ib71514cdcfecc38c07dd7656174d0db68ed758d1
Fixes: 36001206
Test: CtsAutoFillServiceTestCases pass
2017-03-08 21:21:00 -08:00
TreeHugger Robot
7f61163340 Merge "Provided an AutofillCallback API." 2017-03-09 01:13:14 +00:00
Felipe Leme
e6010f2fb4 Provided an AutofillCallback API.
Some custom views - like WebView - might have their own auto-complete mechanism,
so we need to provide a way for them to know when the auto-fill UI is shown or
hidden.

Fixes: 35948429
Test: CtsAutoFillServiceTestCases (with new tests) pass
Test: m update-api
Test: manual verification

Change-Id: I5682a3b9645d5d077a4a2446e79256d6f77b4b5a
2017-03-07 20:52:48 -08:00
Felipe Leme
6ee1ed48b5 Removed deprecated setSavableids().
Bug: 35727295
Test: LoginActivityTest#testAutoFillOneDatasetAndSave passes

Change-Id: I33a33bf438fe258685025118a3dfa8a59bd456da
2017-03-07 19:09:16 -08:00
Felipe Leme
de4d4c2083 Minor changes on AutoFill Save UI.
- Fixed subtitle layout.
- Added a Shell command to change snackbar lifetime (so CTS tests can verify
  it's dismissed).

BUG: 35727295
Test: CtsAutoFillServiceTestCases (with new tests) pass
Test: manual verification

Change-Id: Ie6d42c94599ad59a319ca6f6a1ab02882f8d5f81
2017-03-03 14:09:29 -08:00
TreeHugger Robot
5048c1cbb1 Merge "Fill-provider can control the negative button label and listener" 2017-03-03 04:45:38 +00:00
Svet Ganov
33d06fcac5 Fill-provider can control the negative button label and listener
Test: New CTS tests added and all autp-fill tests pass

bug:35869744

Change-Id: I55e5938038e612d728498658a763208f7022f85a
2017-03-03 02:58:18 +00:00
Svet Ganov
7ad1128137 Allow auto-fill services to disable themselves
1. Added a new API for a connected auto-fill service to
   disable itself

2. Added a new shell command to destroy all pending sessions
   which is used in CTS tests

3. Fixed a bug where the unbind timeout was in minutes
   instead of seconds

Test: wrote CTS tests, all auto-fill tests pass

bug:35848030

Change-Id: I681605aa0b8c004a0f14e30b57117c291d89a894
2017-03-03 02:56:32 +00:00
Felipe Leme
b72f012cb4 Added customization to SaveInfo.
Bug: 35727295
Test: CtsAutoFillServiceTestCases pass
Test: m update-api

Change-Id: I7eba36b6ab8181ae1cdbd10b0879927b9f9cf086
2017-02-27 10:14:41 -08:00
Felipe Leme
f69761ffbe Refactored savableIds() into a SaveInfo class.
For now it's a "1-to-1" refactoring that keeps the same
functionalities, but soon SaveInfo will be expanded to
allow the AutoFillService to customize it.

Bug: 35727295
Test: CtsAutoFillServiceTestCases pass
Test: m update-api

Change-Id: I5aaa705be2b32590048f70ed0142437e05df94b7
2017-02-24 12:03:06 -08:00
TreeHugger Robot
1b0f1568d9 Merge "Auto-fill logging improvements:" 2017-02-23 23:01:33 +00:00
Svet Ganov
28a2c7e057 Update fill UI
1. Abstracted the fill/save view and window management
   in dedicated classs

2. Avoided the need of a second window to detect outside
   touches

3. Simplified the fill-ui window management

4. Moved the UI in its own package to ease mmigration to
   sys UI.

5. Removed hard-coded colors from the layout

6. Make sure the save UI cannot grow as wide as the screen
   as this would not look good on tablets

7. Update the save UI to look closer to mocks

Test: CTS tests pass
Bug: 35708258

Change-Id: Ia74a5aad6f16bba0047a9e8e61958c77af0d358d
2017-02-23 10:13:03 -08:00
Felipe Leme
0ab53dcb31 Auto-fill logging improvements:
- Shorten history line by removing less relevant items.
- Decrease number of history items (from 100 to 20).
- Removed redundant logs from service (and kept them on manager)
- Use {} on all log statements.
- Remove DEBUG guard on some important messages.
- Remove DEBUG guard from service-side toString() implementations.
- Don't log FLAG_FOCUS_LOST actions.

BUG: 33197203
Test: manual verification
Change-Id: I30466ab3c0d12cfa2ad68b2b2a107d5890256845
2017-02-23 17:30:42 +00:00
Felipe Leme
0257c8a5d2 Fixed missing auto-fill save callbacks on TextView.
It was accidentally broken during a previous commit where the CTS test
failure was ignored by a known issue being fixed in another change -
this change fixes both problems.

Bug: 33550221
Bug: 3380254
Test: CtsAutoFillServiceTestCases pass (for real now :-)
Change-Id: I5b2aa6060995ca255e51d85aa6ec93a886fa522f
2017-02-22 11:57:53 -08:00
Felipe Leme
5882c4f5d2 Added auto-fill listeners for RadioGroup and CompoundButton.
Bug: 33550221
Bug: 3380254
Test: CtsAutoFillServiceTestCases pass

Change-Id: Ia9293d16b6fe092552e19563328697c298451f8a
2017-02-21 16:53:00 -08:00
Felipe Leme
fe35e69d96 Use ArrayList instead of ArraySet for FillResponse.getDatasets()...
...otherwise it might not preserve the order.

Test: manual verification
BUG: 35348724

Change-Id: Ib19d364253ea4f0cbbeca8a73b08800482e74820
2017-02-21 14:32:14 -08:00
Svet Ganov
00c771dc7d Add support for remote views backed auto-fill UI
Test: CTS and manual

Change-Id: Ia09f0208d78439491052e4886a0e71c387b73370
2017-02-20 00:37:33 -08:00
TreeHugger Robot
db908541c4 Merge "Added missing calls to onConnected() and onDisconnected()." 2017-02-16 21:14:49 +00:00
Felipe Leme
d473ec1137 Added missing calls to onConnected() and onDisconnected().
They got lost in a previous refactoring....

Bug: 35395043
Test: CtsAutoFillServiceTestCases pass
Test: manual verification
Change-Id: I4e70f84185d6708ea0ebfa831c160e859fcf9e5c
2017-02-16 09:36:12 -08:00
Felipe Leme
5b2ca0e0ad Pass FillResponse extra back to onSaveRequest(...).
BUG: 33197203
Test: CtsAutoFillServiceTestCases passes
Change-Id: Ibb57b07c7287527acc4c92607de044e789f09dcc
2017-02-15 18:21:10 -08:00
Felipe Leme
8eab775d2c R.I.P. temporary, zombie auto-fill notifications.
They died already, but came back to life due to a last-minute API change.

BUG: 33197203
Test: manual verification
Test: CtsAutoFillServiceTestCases passes
Change-Id: I4c248fd30ff087475116326d01e7c5a1c507cd74
2017-02-14 12:22:05 -08:00
Svet Ganov
782043caf8 Refactor auto-fill
* Fix a layering issue where auto-fill manager which is in view
  depended on activity which is in app

* Moved auto-fill classes to view or service based on their
  purpose and removed dependecy on the classes in view to the
  classes in service

* Push state to local auto-fill manager whether auto-fill is
  enabled to avoid making IPC for every focus transition if
  the user did not enable the feature

* Remove unnecessary offload to messages when handling calls
  to auto-fill manager service as these are made over a oneway
  interface and in general they do almost no work and typically
  we do these on the binder thread

* Removed id from data set and fill response as the provider
  can embed everything it needs to id them in the auth pending
  intent

* Enforce the auth UI to be only an activity as this will work
  with multi-window, recents, and back and also does not require
  draw on top of other app special permission

* Authentication also no longer requires passing a remotable
  callback to the auth activity but the activity handles the
  request as if called for a result

* Handling stopping of a user to clean up in-memory state as
  well as handling when a user gets unlocked as a provider may
  be non-direct boot aware

* User the correct context when creating an auto-fill manager

* Move the receiver that listens for requests to hide system
  windows to the manager service as the UI is a singleton and
  no need every per-user state to register its own

* Removed extras from dataset as the only case a provider needs
  to associate state with a dataset is for auth and the provider
  can embed this data in the auth pending intent

Test: manual and CTS

Change-Id: I4bc54c13cf779d7f6fdb3ab894637f9fac73f603
2017-02-13 21:31:37 -08:00
Felipe Leme
69a1cae411 Add Shell commands to list and reset auto-fill sessions.
These commands are useful during development and CTS tests (for
example, the test can assert there is no dangling session after it's
finished).

BUG: 33802548

Test: manual verification
Change-Id: I61f96e30d07642fa2165df9b982c6bf32a4e8716
2017-02-10 13:06:05 -08:00
Svet Ganov
ef0c1885cb Move auto-fill shell command off IPC
Auto-fill has a shell command that is useful for development
which is currently exposed as a remote method allowing any app
to call it reflectively. Since only case this method is called
is when handling a shell command there is no need to expose it
to IPC over binder.

Test: manual

Change-Id: Iac20b4a39c7065e254f8aa277d1f2fd1c38b24a8
2017-02-10 15:14:49 +00:00
Felipe Leme
660ea8c6d7 Merge "Guarded access to mCallback and check for null before using it." 2017-02-09 18:17:54 +00:00
Felipe Leme
3702b4760c Merge "Improved some toString() methods." 2017-02-09 17:47:23 +00:00
Felipe Leme
4997c505c9 Guarded access to mCallback and check for null before using it.
Fixes: 35143142

Test: manual verification
Test: CtsAutoFillServiceTestCases passes
Change-Id: I465538b896b617c518949611f963e350ee498f7b
2017-02-09 08:25:12 -08:00