65 Commits

Author SHA1 Message Date
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
TreeHugger Robot
daad456172 Merge "Make datasets one line and ellipsized." 2017-02-09 05:43:26 +00:00
Felipe Leme
0223ffb473 Improved some toString() methods.
- Never display AutoFillValue.text, because it could be sensitive.
- Simplified AutoFilllId.

Fixes: 35171960

Test: manual verification
Test: CtsAutoFillServiceTestCases passes

Change-Id: I0853cabb695b842c947b0ae007e344f5d8385395
2017-02-08 18:54:29 -08:00
Jason Long
348fd2eb07 Make datasets one line and ellipsized.
Test: Manual
Test: CtsAutoFillServiceTestCases
Change-Id: I2f58ef5e566ba0551431fcbe43efb179c3efc8e8
2017-02-08 13:22:21 -08:00
TreeHugger Robot
359136303d Merge "Fix NPE when session is finished before service replies." 2017-02-08 21:17:17 +00:00
Felipe Leme
8d918a7149 Fix NPE when session is finished before service replies.
Fixes: 35114623
Test: manual verificaiton
Test: CtsAutoFillServiceTestCases passes
Change-Id: Id38babd038c79dc3e7070483437adec1b415a072
2017-02-08 09:11:21 -08:00
TreeHugger Robot
8bc078d734 Merge "Improve AnchoredWindow with smart positioning logic." 2017-02-08 13:01:57 +00:00
Felipe Leme
f894be41d6 Re-added sanitization.
This code was accidentaly removed when rebasing the auth changes..

BUG: 33269702
BUG: 31001899

Test: manual verification
Test: CtsAutoFillServiceTestCases passes
Change-Id: I0dabad9b76ee6c523a546c494f147796a50531e7
2017-02-07 15:12:59 -08:00
Jason Long
1e92f02387 Improve AnchoredWindow with smart positioning logic.
* Add appToken.
* Add mWindowSizeListenerView for getting the displayable window size
  (screen - system windows - soft input).
* Add mContentView when we have all the necesssary info.
* Change mContentView only if something changes (height, bounds,
  displayBounds).

Bug: 34637800
Test: CTS
Change-Id: Icef5eb8d8e0b54376c84cbcaa5719aee0520e345
2017-02-07 13:58:12 -08:00
Felipe Leme
bab851c7c9 Refined session management so Save can be automatically called.
This is yet another big refactoring:

- AutoFillManager keeps track of its current AutoFillSession.
- Views call AFM.startSession(View) when they can trigger autofill.
  (virtual views can call it as well). At this point, the manager
  sets an AutoFillSession, gets the activity token, and passes it to
  the service.
- Subsequent calls to AFM.start() will be ignored since the session
  is set.
- When the Activity is gone, it calls AFM.finishSession().
- Simlilarly, virtual views could call it as well.
- Added getAutoFillValue() to View.
- Removed AFM.updateAutoFillInput(childId): virtual views should now
  call startSession(childId) to start a session, and use the
  VirtualViewListener callbacks for updates.
- Change AutoFillValue to use String (which is immutable) instead of
  CharSequence for text values.
- Check if view is enabled before auto-filling.
- Removed 'cmd autofill fill' since it would require the appCallback
- Automatically dismiss the snack bar after 30s
- Moved the "don't change autofill value when autofilling" Inception
  logic into the service side.
- Etc...

BUG: 34819567
BUG: 33269702
BUG: 31001899

Test: manual verification
Test: CtsAutoFillServiceTestCases passes

Change-Id: I5fad928d4d666701302049d142026a1efa7291cd
2017-02-06 18:22:03 -08:00
Svet Ganov
0f4928f1f7 Refactoring of auto fill - lifecycle, auth, improvements
1. Move management of the remote fill service in a dedicated
   class that abstracts away the async and ephemeral nature
   of the binding.

2. Update auth to move fingerprint out of the platform and
   allow response and dataset auth.

3. Cleaned up the fill and save callback classes.

4. The UI is now shared among all sessions and cleaned up.

5. Reshuffled the remote callbacks to have cleaner separation.

6. Cleaned up and tightened the reponse and dataset classes.

7. Added API to support communicationn with intent based auth.

Test: CTS + manually

bug:31001899

Change-Id: Idc924a01d1aea82807e0397ff7293d2b8470d4d6
2017-02-06 04:02:35 +00:00
Svetoslav Ganov
21c8595d76 Merge "Revert "Improve AnchoredWindow with smart positioning logic."" 2017-02-06 04:01:59 +00:00
Svetoslav Ganov
c71593e3de Merge "Revert "Pass token to AutoFillUI."" 2017-02-06 04:01:13 +00:00
Svetoslav Ganov
7b25218f5a Revert "Improve AnchoredWindow with smart positioning logic."
This reverts commit eb3c9344399831542edc59b7c43c84a0496d7a12.

Change-Id: I6af63525bf72dc9d0dd5a215421fb513e7e635be
2017-02-06 04:00:34 +00:00
Svetoslav Ganov
21e67a1272 Revert "Pass token to AutoFillUI."
This reverts commit 8f60ea6360dace22e98eb9dfeead8118170fa401.

Change-Id: I16e78ab87d2f570462b24c0d61a5c7e161184c70
2017-02-06 03:59:53 +00:00
Jason Long
e4fcdbc170 Hide DatasetPicker if all items are filtered.
Bug: 34633695
Test: CTS
Change-Id: I0e808083d32db9e280c9ddd028239540bac01cfc
2017-02-03 14:50:15 -08:00
Jason Long
eb3c934439 Improve AnchoredWindow with smart positioning logic.
* Add appToken.
* Add mWindowSizeListenerView for getting the displayable window size
  (screen - system windows - soft input).
* Add mContentView when we have all the necesssary info.
* Change mContentView only if something changes (height, bounds,
  displayBounds).

Bug: 34637800
Test: CTS
Change-Id: Iade6179f6303a6d4777e99fa6c600ba6352ee863
2017-02-03 14:50:05 -08:00
Jason Long
8f60ea6360 Pass token to AutoFillUI.
Bug: 31001899, 34637800
Test: CTS
Change-Id: If0d0a283aebd48db2694c3dcef5d3e077a9fa1f8
2017-02-02 17:29:29 -08:00
TreeHugger Robot
0a6d2b6dac Merge "Fix AutoFill Save window layout params." 2017-02-02 03:58:47 +00:00
Jason Long
2288eff965 Fix AutoFill Save window layout params.
Change-Id: I54ae23e9ab1b12ab868b37fd8e87e89dad7ae8fc
Test: CTS
2017-02-01 15:16:53 -08:00
Felipe Leme
0200d9ea15 Improved AutoFill Save workflow.
Currently, the onProvideAutoFillStructure() methods can be called
twice: to auto-fill an activity and to save the activity's data
in the service.

The problem with this approach is that when the save workflow is
called, the activity might have been gone. Hence, a proper approach
is to keep the initial AssistStructure data in the system_service
memory, watch for view changes, and then passed the new structure
back to the AutoFillService.

A side effect of this change is that we need another way to determine
if the view is sanitized or not. For "standard" views, that will be
defined based on whether the view content come from a resource or not,
but that logic is not implemented yet (for now, all views will be
considered sanitized, except for TextView passwords). For "custom"
views (such as WebView), this logic is responsibility of the view
implementation, through the newChild() method, which now takes a
flag (whose value could be AUTO_FILL_FLAG_SANITIZED for sanitized
views).

The SaveCallback.onSuccess() method was simplified: it does
not need a list of saved ids anymore the auto-fill UI will not use it
anymore.

Another side effect is that the Save notification is gone - until
it's attached again, it can be test by using:

    adb shell cmd autofill save

Finally, hook AutoFillUI on ACTION_CLOSE_SYSTEM_DIALOGS events.

BUG: 33269702
BUG: 31001899
Test: manual verification
Test: CtsAutoFillServiceTestCases passes
Change-Id: I907a7e21d1b3cd1ab6dec3a08d144a52655da46f
2017-02-01 11:00:15 -08:00
TreeHugger Robot
db88bfaa31 Merge "Ignore auto-fill requests from system." 2017-01-31 23:51:26 +00:00
Felipe Leme
4eff26b423 Ignore auto-fill requests from system.
Change-Id: I3c318aeb96c1ba7a751feba2a0d9042015eaaffb
Fixes: 34819567
Bug: 34171325
Test: could not reproduce
2017-01-31 14:11:21 -08:00
Jason Long
226309c555 Refactor AutoFill server code.
With this change, data flows strictly like so:

AFManagerService -> AFManagerServiceImpl -> Session -> ViewSession

A ViewSession is introduced to 1) know when we can show the fill UI,
and 2) know when we need to create or update the current fill UI.

Each class has its own responsibilities:

* AFManagerService - interface to app process
* AFManagerServiceImpl - per user id
* Session - per activity
** AutoFillUI - per activity (can consider moving to ViewSession)
* ViewSession - per view

Bug: 34633695
Change-Id: Ia197a5c40219379ab6a95d0cf5c39ac4f5470d0e
Test: CTS, Manual with GMS Core
2017-01-31 00:02:31 -08:00
Jason Long
3922e6a8aa Add user picker for anchored window.
Test: CtsAutoFillServiceTestCases

Bug: 34633695
Change-Id: I274264846358941983183a32f07cade3b26c8c05
2017-01-30 17:17:35 -08:00
TreeHugger Robot
b41e016fb9 Merge "Moves layout code from java files to layout xml" 2017-01-28 02:16:30 +00:00
Udam Saini
3742ccf8b5 Moves layout code from java files to layout xml
Test: manual ui verification
Change-Id: I7d15dc1a25845741c3d165f3f1d33cee2c2d4514
2017-01-27 16:32:40 -08:00
TreeHugger Robot
9363c69542 Merge "Added dump() to AutoFillUI." 2017-01-27 23:32:13 +00:00
TreeHugger Robot
9dd20d23e0 Merge "Initial, unpolished version of DatasetPicker." 2017-01-27 21:34:32 +00:00