11 Commits

Author SHA1 Message Date
Perumaal S
addabbaf82 Implement getServiceComponentName API for Content Capture
Tests are in ag/5989968

Fixes: 121047489
Test: atest CtsContentCaptureServiceTestCases # to make sure nothing broke
Test: atest
CtsContentCaptureServiceTestCases:android.contentcaptureservice.cts.BlankActivityTest#testTargetServiceName_enabled
Test: google3 test with test app
Change-Id: I4f11a324beb938a28cd150c35bb3d83c77e59e0b
2019-01-10 12:32:12 -08:00
Felipe Leme
e127c9a47e Fixed how session created / removed events are generated.
Long-story short, they must be flushed right away...

Test: atest CtsContentCaptureServiceTestCases
Bug: 121033016

Change-Id: I1b3132ad49674d43bf63717f79848b6e4b23b605
2019-01-04 17:54:52 -08:00
Felipe Leme
bb98ed6521 New APIs for ContentCaptureService: onConnected() and onDisconnected()
Bug: 117944706
Test: atest CtsContentCaptureServiceTestCases:android.contentcaptureservice.cts.BlankActivityTest#testDisconnected
Test: atest CtsContentCaptureServiceTestCases

Change-Id: Iba3c1ae774221946a550fad95539d3a9771ae3d7
2018-12-21 15:11:49 -08:00
Felipe Leme
50b33dce59 Refactored ContentCaptureService (and infra) to have just one RemoteService.
The initial implementation of AbstractPerUserService assumed the
AbstractRemoteService instances would be created in demand, because that was
the aproach used by Autofill (to minimize the time system service is bound to
the autofill service process).

But for other systems like ContentCapture, it makes more sense to keep a
permanent connection to the remote service, which is running all the time, so
this change changes the infra to allow such permanent connection (which includes
defining an idle timeout value that never unbinds).

Bug: 117779333
Test: atest CtsContentCaptureServiceTestCases CtsAutoFillServiceTestCases

Change-Id: I43386a3fddc56f1dfd6e4e55f243eaa297921123
2018-12-21 13:25:07 -08:00
Felipe Leme
c28711c5f0 Refactored ServiceNameResolver to take userId.
This object is used to bind to the AbstractRemoteInstance and was initially used by
AbstractPerUserSystemService, as the concrete implementations (for Autofill and ContentCapture)
were binding when sessions were created.

But we also need to support binding when the service is created, which was not possible using this
approach; instead, we need to make this object to take the userId on each call, and move it to the
AbstractMasterSystemService.

This change also removed the shared lock from FrameworkResourcesServiceNameResolver.

Bug: 117779333
Test: atest CtsContentCaptureServiceTestCases CtsAutoFillServiceTestCases

Change-Id: I097c226c9b00ddf7827e4f2f99d0adba978f29a2
2018-12-21 13:25:07 -08:00
Felipe Leme
87a9dc9a97 Moved createContentCaptureSession() to ContentCaptureSession.
Such move will allow nested sessions. For example, WebView could create a
new session for the main page, then child sessions for IFRAMEs contained on it.

This CL changes the API and provides an initial implementation, although it's
not quite ready yet - it only allows 1 level of children (from the activity
session), but the full implementation is coming soom to a movie theather near
you...

Bug: 121033016
Bug: 117944706

Test: atest CtsContentCaptureServiceTestCases

Change-Id: I86156bb3b8a2c08cb00b9518599eb6d67fbf77c2
2018-12-20 08:59:48 -08:00
Philip P. Moltmann
29ee0a4827 Make AbstractRemoteService available outside of system server
The handler of the services now runs on Looper.getMainLooper()

Test: Built
Bug: 117779333
Change-Id: Ie2fee4ce19d6e6181537d8adc196a4ceab7eb0f8
2018-12-19 13:39:13 -08:00
Felipe Leme
b9687849bb Optimizes the Content Capture workflow by calling the service directly.
Initially, the ContentCaptureManager (in the app) was calling the
IContentCaptureManager (on system server) for everything, even to pass the
list of captured events, which caused 2 IPCs for each batch of events (i.e.,
from app to system_server, then from system_service to service).

This CL optimizes the workflow by getting rid of the "middle man" and sending
the events from the app to the service directly, which the system_server only
calling the service to notify when the view starts and finishes (and passing
the UID in the former so the servier can validate the sendEvents() calls).

Bug: 119220549
Test: atest CtsContentCaptureServiceTestCases

Change-Id: I6c08dccf755605320ac37cbc9424132e5455a594
2018-12-18 10:03:37 -08:00
Felipe Leme
aa5088ede6 Another round of changes on Content Capture.
- Get rid of activity-level events.
- Renamed InteractionSessionId and InteractionContext to
  ContentCaptureSessionId and ContentCaptureContext (and made them public)
- Create the explicit concept of ContentCaptureSesssion (and moved notification
  APIs to it).
- Added APIs to let apps create new sessions (not implemented yet).
- Added APIs to remove user data based on some context properties (like URI).

The reasoning behind this change is to let app developers explicitly associate
the captured content with some app-level domain (and also let the app ask the
service to clear such data at user's request). For example, a browser app
(and WebView) can use these APIs to associate the content capture events with
the URL being rendered.

Bug: 117944706
Fixes: 121034139

Test: atest CtsContentCaptureServiceTestCases
Test: m update-api && m

Change-Id: I7841da303b6a39c825651b03a07e3081fbd0bdf5
2018-12-14 18:02:24 -08:00
Felipe Leme
afb55b6813 Simplified how AbstractRemoteService subclasses run an async request.
In these cases the request never times out, so it can be simplified by using
a lambda to represent the request.

Bug: 117779333
Test: atest CtsContentCaptureServiceTestCases CtsAutoFillServiceTestCases

Change-Id: Iba52aad1315ae7d3982671a0fdeabe87a6d6ee04
2018-12-06 20:31:24 -08:00
Felipe Leme
749b889889 Yet another (major) refactoring on Content Capture and Augmented Autofill.
Bunch of changes:

- Split public SmartSuggestionsService info ContentCaptureService and
  AugmentedAutofillService
- Renamed 'intelligence' packages to either 'contentcapture' or
  'autofil.augmented'
- Renamed internal packages and classes.
- Changed permissions, resource names, etc...
- Moved Augmented Autofill logic from IntelligeceManagerService (R.I.P.) to
  Autofill.
- Optimized IPCs by passing a String instead of the InteractionSessionId
  (that also solves the view -> service dependency).

Test: atest CtsContentCaptureServiceTestCases \
            CtsAutoFillServiceTestCases \
            FrameworksCoreTests:SettingsBackupTest
Test: manual verification with Augmented Autofill Service

Bug: 119638877
Bug: 117944706

Change-Id: I787fc2a0dbd9ad53e4d5edb0d2a9242346e4652d
2018-12-06 16:56:39 -08:00