119 Commits

Author SHA1 Message Date
TreeHugger Robot
53b6f00dc5 Merge "Who wants...to live...forever? The "Save for Autofill?" dialog does!" into oc-dev 2017-04-07 03:00:07 +00:00
Felipe Leme
db5f6c00a4 Who wants...to live...forever? The "Save for Autofill?" dialog does!
Fixes: 37083017
Test: manual verification
Test: CtsAutoFillServiceTestCases pass

Change-Id: Id177fb59810956e4b43c1d357de415d64ab9d89a
2017-04-06 18:03:39 -07:00
TreeHugger Robot
6f5db9a2a8 Merge "Don't start a partition when session is pending FillResponse authentication." into oc-dev 2017-04-06 22:42:03 +00:00
TreeHugger Robot
11d1a392f2 Merge "Shows a Toast when manual autofill request cannot be fulfilled." into oc-dev 2017-04-06 21:06:47 +00:00
Felipe Leme
abe54cbf0c Don't start a partition when session is pending FillResponse authentication.
BUG: 35707731
Test: fixed testFillResponseAuthBothFields and testFillResponseAuthJustOneField

Change-Id: Ib74e46dd37feb7e5c03e40cfbe8133ace6db0709
2017-04-06 13:32:42 -07:00
Philip P. Moltmann
336531523a Do not show UI when currentID changed.
Test: autofill cts tests (no new failures)
Fixes: 36992897
Change-Id: I0c97a84c034533d07544eb3845ff52cdab107f2a
2017-04-06 11:11:50 -07:00
Felipe Leme
c7ed8c395b Shows a Toast when manual autofill request cannot be fulfilled.
Bug: 35708229
Test: manual verification
Change-Id: If4fa6556dd94a805727329f0aebc4b37f548b3a1
2017-04-06 10:39:44 -07:00
Felipe Leme
52d5d3dfc7 Pass FillResponse bundle on subsequent onFillRequest() calls.
BUG: 35707731

Test: existing CtsAutoFillServiceTestCases pass
Test: more tests on PartitionedActivityTest

Change-Id: I510aff54d0d9d7e0cce90f9786e3e1f6cab180f9
2017-04-05 19:34:33 -07:00
Felipe Leme
cde040ae95 Improvements on ViewNodes received on partitioned requests:
- Fixed focus
- Added autofillValue for nodes previously autofilled

BUG: 35707731

Test: existing CtsAutoFillServiceTestCases pass
Test: more tests on PartitionedActivityTest

Change-Id: If4390d002d44c82e3de0339a634041f3998e804e
2017-04-05 17:49:13 -07:00
TreeHugger Robot
aaca304a31 Merge "Created SaveInfo types for email and username." into oc-dev 2017-04-06 00:15:30 +00:00
Felipe Leme
98d5c7f6b0 Dump autofill service component from settings.
Bug: 36978445
Test: manual verification

Change-Id: I30992452c94a78c05a5a98e94d5ffc5325151a76
2017-04-05 14:50:36 -07:00
Felipe Leme
24bac61498 Merge "Temporarily hardcoded dimensions of autofill authentication UI." into oc-dev 2017-04-05 04:29:24 +00:00
TreeHugger Robot
045c71f1be Merge "Adds a config for default autofill service." into oc-dev 2017-04-05 01:52:55 +00:00
Felipe Leme
0962262f42 Created SaveInfo types for email and username.
Bug: 35707731
Test: LoginActivityTest#testCustomizedSaveUsername
Test: LoginActivityTest#testCustomizedSaveEmailAddress
Change-Id: I3598c64e4f6bb9ceff544c3994d6cdeebd760a85
2017-04-04 14:09:07 -07:00
Felipe Leme
f43ca7968f Initial implementation of autofill partitioning.
BUG: 35707731
Test: existing CtsAutoFillServiceTestCases pass
Test: PartitionedActivityTest

Change-Id: If9df5fe63249f0b9e9da058d1c9327dfd3c09cf3
2017-04-04 10:30:54 -07:00
Felipe Leme
a759c03606 Temporarily hardcoded dimensions of autofill authentication UI.
Bug: 36660292
Test: manual verification
Change-Id: I2d354868a656a2b405a0e7aefb551e380e5fa7e0
2017-04-04 08:54:20 -07:00
Felipe Leme
ff35509ee9 Adds a config for default autofill service.
Change-Id: I4d2d8637617439c5df3f62426e9bc45a78edc2e3
Fixes: 35708268
Bug: 36790693
Test: manual verification
2017-04-03 17:51:26 -07:00
Felipe Leme
7c6e8e6c00 Fixed NPE when FillService replies with a null FillResponse.
This problem was not detected by CTS tests because the exception is
"harmless" (it's just ignored), but it can be verified at logcat:

W Binder  : Caught a RuntimeException from the binder stub implementation.
W Binder  : java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.IntentSender android.service.autofill.FillResponse.getAuthentication()' on a null object reference
W Binder  : 	at com.android.server.autofill.ViewState.maybeCallOnFillReady(ViewState.java:159)

Bug: 35707731
Test: CtsAutoFillServiceTestCases pass
Test: manual verification
Change-Id: I58330a7e91b2c186bf97897b7d39640010ca630b
2017-04-03 15:03:17 -07:00
Jeff Sharkey
fe9a53bc45 Consistent dump() permission checking.
This change introduces new methods on DumpUtils that can check if the
caller has DUMP and/or PACKAGE_USAGE_STATS access.  It then moves all
existing dump() methods to use these checks so that we emit
consistent error messages.

Test: cts-tradefed run commandAndExit cts-dev -m CtsSecurityTestCases -t android.security.cts.ServicePermissionsTest
Bug: 32806790
Change-Id: Iaff6b9506818ee082b1e169c89ebe1001b3bfeca
2017-04-02 22:29:07 -06:00
Felipe Leme
78696bfeb7 Moar pre-partitioning refactoring.
On ViewState: split value into mCurrentValue and mAutofilledValue.
On Session: replacing mAutofilledDataset by mDatasetWaitingAuth and
            ViewState.getAutofilledValue() (mAutofilledDataset is still needed,
	    but will be removed in the first partitioning CL).

Also fixed a missed 'return' on TimePicker.autofill()

Bug: 35707731
Test: CtsAutoFillServiceTestCases pass

Change-Id: Icc32701ae3e499a77d99e6ae1daa7d070a3df631
2017-03-31 10:24:39 -07:00
Felipe Leme
0f9464e172 Refactored ViewState.
- Added an int state.
- Removed mValueChanged and use state.
- Removed unused mAuth
- Set its Fillresponse in the proper places.
- Encapsulated private attributes.
- ...except mId (which is now id).
- Stored only id of current view state on Session.

This refactoring didn't modidy any behavior - in fact, the CTS tests didn't
change - but it will make it much easier to implement partitioning.

BUG: 35707731
Test: CtsAutoFillServiceTestCases pass

Change-Id: Ib07929a4089201a0e5bb66004af91f6cba362ba4
2017-03-30 18:17:08 -07:00
Felipe Leme
7320ca9f99 Adds FillResponse extra to passed to authentication intent.
Test: CtsAutoFillServiceTestCases (with new test) pass
Fixes: 36603378

Change-Id: I3d04a656e50b2b3665405f6c1891ad0379a54ea6
2017-03-29 15:20:29 -07:00
Felipe Leme
6fa8a07143 Moved Session and ViewState to its own classes.
Such separation will make it easier to maintain them...

Bug: 35707731
Test: CtsAutoFillServiceTestCases pass
Change-Id: I7164598e1ce54dca8cdb8286f65ec4baa926f98d
2017-03-27 12:34:12 -07:00
Felipe Leme
4753bb0c34 Make auto-fill UI robust
Now the autofill UI tracks the movement of the anchor view,
both real and virtual and while still preventing the filled
app from accessing the chooser UI. This was achieved by using
a popup window in the app process to determine the window
location and adding a window presenter interface to popup
window that controls the actual window addition, removal, and
update which is implemented by the system server.

Test: all autofill CTS tests pass

bug: 36392498
bug: 35708258
bug: 34943932
fixes: 36039182
fixes: 36493078

Change-Id: I0321913b2e2e759f4b17003bf85cb873e63a467c
2017-03-24 15:16:28 -07:00
TreeHugger Robot
81b034d4f8 Merge "Added shadow to RemoteViews used by authentication requests." 2017-03-24 07:26:05 +00:00
Felipe Leme
6078588008 Temporarily ignore RuntimeException when displaying the UI.
Change-Id: Ia01f9204736418a8f1e5027aef755d0855feab04
Fixes: 36392498
Test: manual verification by forcing an exception
2017-03-24 04:09:37 +00:00
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