120 Commits

Author SHA1 Message Date
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
Felipe Leme
cd55f670f3 Initial, unpolished version of DatasetPicker.
Bug: 31001899
Bug: 34637800
Test: manual verification
Change-Id: If0d1c61ffbac0b166de1fbd2184f68ca72b2cd08
2017-01-27 19:26:40 +00:00
Felipe Leme
911cc0fb6c Added dump() to AutoFillUI.
BUG: 31001899
BUG: 34637800
Test: manual verification
Change-Id: Ia7f0a4bf814c4e0e39b0dc09c62c7987a662d238
2017-01-27 09:25:27 -08:00
TreeHugger Robot
e682445698 Merge changes from topic 'session_refactoring'
* changes:
  Adds autofill save ui
  Moar AutoFill Framework refactoring...
2017-01-27 03:46:36 +00:00
Felipe Leme
87af2d8596 Adds autofill save ui
Test: Manual verification of save ui
Test: CtsAutoFillServiceTestCases passes

BUG: 31001899
Change-Id: Ibb154fc6108f20e6a1b889549bd264e8b80f2f0c
2017-01-26 18:07:16 -08:00
Felipe Leme
bd00fef41c Moar AutoFill Framework refactoring...
* Encapsulated application-level auto-fill logic on AutoFillSession.
  Currently, Activity.java directly manages the IAutoFillCallback binder
  object used to auto-fill its views, but this logic need to be
  extended so Views can use it to draw the auto-fill bar.

* Pass auto-fill id and boundaries to requests
  So AutoFillUI can display its affordance in the right places.

* Uses a new auto-fill id on View (instead of reusing accessibility's).
  That allows moving the logic on whether a new request should be made or
  the existing UI moved to the service side.

* Split service methods in 2, for shell cmd and app
  And applied the right permission check on both.

* Removed CancelationSignal from onSaveRequest()
  Since it's not really needed.

* Etc...
  ¯\_(ツ)_/¯

BUG: 34637800
BUG: 31001899
Test: CtsAutoFillServiceTestCases passes
Test: manual verification

Change-Id: Ibd0cb2cfff6d0f6bb6b697a423ed5e89df687b82
2017-01-26 15:39:59 -08:00
Jason Long
d1144eb85e Add basic AnchoredWindow.
Bug: 34637800
Test: Manual
Change-Id: I82c9ec44296c3423e3f8d3b55832e344a5094cfd
2017-01-26 14:09:28 -08:00
Felipe Leme
436ab6a91d Added support to authentication.
AutoFillService can now require user authentication, both at
FillResponse and Dataset levels;
- FillResponse authentication is typically used when the user data
  need to be unlocked before the first use.
- Dataset authentication is typically used to unlock sensitive data
  such as credit card info.

The authentication can be handled by the service itself (for example,
when it uses the credit card CVV to unlock it) or by the Android
system (when the service asks for fingerprint authentication).

Bug: 31001899

Test: manual verification
Test: CtsAutoFillServiceTestCases passes

Change-Id: If62f42f697ab5ef0d14d991ff1077d1c38808e61
2017-01-25 13:03:32 -08:00
Felipe Leme
3461d3c069 Initial IME integration.
- Created an AutoFillManager class, which provides methods to show
  the auto-fill bar for views and virtual nodes.
- Automatically launches an auto-fill request when the IME is shown
(and an AutoFillService is set for the given user) on TextViews.
- Updated VirtualNodeListener to use this new API.

BUG: 31001899
BUG: 34171325
Test: CtsAutoFillServiceTestCases passes
Test: manual verification

Change-Id: Id72ce97da70217081b5823cfc7b138412634fcf3
2017-01-24 17:57:16 -08:00
Jason Long
4b93f46130 Add <autofill-service> that declares AutoFillService metadata.
The initial version of <autofill-service> may contain a settingsActivity
attribute.

Test: Manual verification
Change-Id: I63a67aa4b7110fbf21d0b01ee53add712bfb0364
2017-01-18 19:35:47 -08:00
Felipe Leme
6d553874be YAMAFFR - Yet Another Major AutoFill Framework Refactoring
- Explicitly split View methods into Assist and AutoFill methods, rather
  than use an overloaded method that takes flags.
- Simarly, renamed ASSIST_FLAG_SANITIZED_TEXT and
  ASSIST_FLAG_NON_SANITIZED_TEXT flags to
  AUTO_FILL_FLAG_TYPE_FILL and AUTO_FILL_FLAG_TYPE_SAVE respectively.
- Created a AutoFillUI class to host the auto-fill bar and other UI
  affordances.
- Moved the temporary notifications to AutoFillUI (eventually that
  class will host the real UI).
- Moved FillData to android.app.view.autofill package.
- Split IAutoFillCallback in 2 (IAutoFillAppCallback and
  IAutoFillServerCallback, residing at the app and system_server
  respectively), so service cannot fill the app directly (which lets
  the framework control the UI).
- Moved assist's IResultReceiver to AutoFillServiceImpl so
  system_server can act as a mediator between the AutoFillService
  implementation and the app being auto-filled.
- Replaced FillData and FillableInputFields by a bunch of new objects:
  - FillResponse contains a group of Datasets, each representing
  different values
    that can be used to auto-fill an activity (for example, different
    user accounts), optional id of fields the service is interested
    to save, and an optional bundle for service-side extras.
  - Dataset contains a name, Fields, and an optional bundle for
    service-side extras.
  - Fields contain an AutoFillId (parcelable) and a value (Bundle)
- Changed the temporary notifications to emulate the new workflow:
  - Initial notification requests the auto-fill data but do not
    auto-fill.
  - Once service calls back, a new notification is shown with the
    results.
  - Then if the user selects a dataset, the activity is auto-filled
    with it.
  - It also shows a notification to emulate what can be saved.
- Created an VirtualViewDelegate for views that uses a virtual
  hierarchy for assist data.
- Added new methods on ViewStructure to add children with virtual ids.
- Added 2 methods on View to support auto-fill:
  - autoFill(Bundle) to auto-fill the view.
  - getAutoFillType() to return how the view can be auto-filled.
- AutoFillType defines the input fields that support auto-fill:
  - Text fields (like EditText)
  - Toggle fields (like CheckBox)
  - Lists (like RadioGroup)
- AutoFillType can also have a sub-type representing its semantic (for
  now only text fields have it, and it's the same as getInputType()).
- etc :-)

Bug: 31001899
Test: manual verification
Change-Id: I2dd2fdedcb3ecd1e4403f9c32fa644cb914e186f
2017-01-10 12:50:47 -08:00
Felipe Leme
1ca634a544 AutoFill Framework refactoring.
The AutoFill Framework uses the same AssitStructure provided by the Assist API
and so far it was using the same methods as well, both internally and externally
(public API).

Sharing that internal code internally is fine, but the public APIs must distinguish between the 2 cases so they can fill the assist structures accordingly (although the initial implementation still shares the same logic).

This CL also splits the original 'auto-fill' request in 2 types of requests,
which are set by View flags:

- ASSIST_FLAG_SANITIZED_TEXT
- ASSIST_FLAG_NON_SANITIZED_TEXT

It also added new methods and callbacks to handle save requests.

Bug: 31001899
Test: manual verification

Change-Id:  I4eb09099dc19a43cb7e053e64d939aed3704b410
2016-12-12 18:22:45 -08:00
Felipe Leme
fed51fcedb Uses a notification to request auto-fill.
This is a temporary approach until UX decide the final one.

BUG: 31001899
Test: manually built and ran it

Change-Id: I234ffc9bfffcccae5e5c310f9669c4a2a8e9d65c
2016-11-14 11:02:05 -08:00
Felipe Leme
dfa7fbc870 Bind AutoFillService on demand.
BUG: 31001899
Test: manually built and ran it

Change-Id: Ied7028e41c273f5e30f88fc92f919249046877eb
2016-11-11 16:13:09 -08:00
Felipe Leme
29a5b0d0f1 Added a callback for AutoFillService.
So far AutoFillService only received the assist data from framework; in
this CL, it also offers a method where the auto-fill provider can send
the auto-fill data back to framework.

The workflow is:

- AFMSI calls a new AM method (requestAutoFillData(), instead
  of requestAssistContextExtras()).
- The assist receiver is located in the app, not on system service.
- AM uses a new request type (ASSIST_CONTEXT_AUTOFILL) to request the
  assist data to the activity.
- ViewStructure has a new setAutoFillId() method which is used to set an
  unique id for the view.
- View uses the accessibility id to implement the auto-fill id.
- When the activity fullfills the request, it creates an IAutoFillCallback
  remote object - that will be used to set the auto-fill fields - and
  returns it in the assist bundle (using the
  VoiceInteractionSession.KEY_AUTO_FILL_CALLBACK key).
- The app-visible AutoFillService class offers an onFillRequest() method,
  which contains the assist data and a FillCallback used to handle it.

BUG: 31001899
Test: manually built and ran it

Change-Id: I3d208c14e81022dc96dd03f38bbe25a778b24a67
2016-11-11 16:02:55 -08:00
Felipe Leme
5381aa4b58 Initial implementation of the Auto-Fill Framework classes.
This CL provides the initial, skeleton implementation of the Auto-Fill
Framework classes:

- Defines the system service and app-based
  AIDL (IAutoFillManagerService.aidl and IAutoFillService.aidl respectively).
- Defines the 'adb shell cmd' interface.
- Defines the permission required to access the service.
- Registers the service on SystemServer.
- Adds the code to bind the app-specified service to system_server.
- Defines the service class (AutoFillService) required by providers.
- Implements the initial startSession() method.

This is still a very early, "work-in-progress" change:
- It has many TODOs.
- It does not have unit or CTS tests yet.
- It does not provide a callback method to auto-fill the fields.
- In fact, it has a lot of TODOs.

Despite these adversities, it can be tested by following the steps
below:

1.Create an app with a service extending AutoFillService

2.Implement the onNewSession() method

3.In the manifest:
 - Listen to android.service.autofill.AutoFillService intents.
 - Require the android.permission.BIND_AUTO_FILL permission.

4.Explicitly set the app as an autofill-service by running:
  adb shell settings put secure auto_fill_service MY_APP/.MY_SERVICE

5.Start a session against the top activity:
  adb shell cmd autofill start session

BUG: 31001899
Test: manually built and ran it

Change-Id: I00f4822159b31ddddba8f513e57c4474bc74eb89
2016-11-08 14:40:56 -08:00