Commit Graph

78 Commits

Author SHA1 Message Date
Adam He
ff2185346e Metrics for content capture.
Bug: 119613670
Test: statsd_testdrive & manual test
Change-Id: Ib2c61d2a3c08a9db779790417eb0177c2420d8fd
Merged-In: If43465ccee7454a7ebf9e15caa23fce7bae33cfe
2019-05-15 11:12:02 -07:00
Felipe Leme
0a3bec5860 Disable existing ContentCapture sessions if service changes their whitelist status.
Test: atest CtsContentCaptureServiceTestCases:CustomViewActivityTest
Test: atest CtsContentCaptureServiceTestCases # sanity check

Fixes: 130802293

Change-Id: Ia94016382192912668c4ac1ce580a0b95c76f35c
2019-05-06 16:09:05 -07:00
TreeHugger Robot
9f590ef1a9 Merge "Propogate disabled state to content capture session after changing user restrictions or on ccm.setContentCaptureEnabled()." into qt-dev 2019-05-01 23:50:58 +00:00
Matt Pape
15769e2ffa Migrate usage of single property lister to multi prop listener.
Test: atest CtsViewTestCases:TextClassificationManagerTest
      atest FrameworksCoreTests:TextClassificationManagerTest
      atest ExtServicesUnitTests:AssistantSettingsTest
      atest SystemUITests:SmartReplyConstantsTest
      atest FrameworksServicesTests:AutofillManagerServiceTest
      atest FrameworksUiServicesTests:NotificationManagerServiceTest
Bug: 128902955
Change-Id: I00e524b615b3bd03b6b40535410ff7eb2ef6f8ee
2019-04-30 16:35:16 +00:00
Adam He
6c0afca46a Propogate disabled state to content capture session after changing user
restrictions or on ccm.setContentCaptureEnabled().

Bug: 124127364
Test: # manual verification
Change-Id: Ic9688f33f8b9153ab967e5842f939a18fe85412e
2019-04-26 15:22:00 -07:00
Felipe Leme
cbf7f26baa Fixed content capture whitelist for specific activities.
Test: manual verification (it cannot be fully verified using the current CTS setup)
Test: atest CtsContentCaptureServiceTestCases:android.contentcaptureservice.cts.WhitelistTest
Test: atest FrameworksCoreTests:android.content.ContentCaptureOptionsTest
Test: atest CtsContentCaptureServiceTestCases # sanity check
Test: m update-api

Fixes: 130573023
Merged-In: I2c76a01bd98c4154c4c59099f1368232d2dba80d
Change-Id: I2c76a01bd98c4154c4c59099f1368232d2dba80d
2019-04-19 20:25:45 -07:00
Felipe Leme
6334116065 Remove ContentCaptureServerSession when app died.
Test: manual verification
Test: atest CtsContentCaptureServiceTestCases:android.contentcaptureservice.cts.AppKilledTest

Fixes: 119524920

Change-Id: I324aa7d83721ba078752dda2f91b32d788ce304f
2019-04-16 16:19:37 -07:00
Felipe Leme
ef1c0b36ab DO NOT MERGE - Removed ContentCapture support from standard SDK toolkit.
Test: atest CtsContentCaptureServiceTestCases
Test: m update-api
Test: make ds-docs

Fixes: 129982633

Change-Id: I5a0fa4231d0222638830c1abd8015d9f2635996a
2019-04-15 09:36:25 -07:00
Robert Berry
835123dba2 Add system captions manager service
This service connects to a remote system captions manager service. This
service is responsible for enabling system captions when the user
requests them. As the system binds to it, this service will be
persistent.

Cherry pick from ag/6761232

Bug: 128925852
Test: Manual. I created an implementation of the service.
Merged-In: Iafde1bb68f4754d8167624f47c6833d43c0ec336
Change-Id: Iafde1bb68f4754d8167624f47c6833d43c0ec336
2019-04-07 15:09:06 +00:00
Felipe Leme
afbba9fb36 Checks package name belongs to called UID on some content capture methods.
Also refactored how the SecurityException is thrown back to the caller app.

Bug: 122959591
Test: manual verification
Test: atest CtsContentCaptureServiceTestCases # sanity check (minus usual flakiness)

Change-Id: I4d2a68e61dc1c801d80734a30f4bbe6fdae8555d
2019-03-28 19:31:52 -07:00
Felipe Leme
a8d33c24f8 Implemented ContentCaptureConditions APIs.
Test: atest ContentCaptureConditionTest \
       CustomViewActivityTest#testContentCaptureConditions \
       CustomViewActivityTest#testContentCaptureConditions_otherPackage
Test: atest CtsContentCaptureServiceTestCases # sanity check (minus usual flakiness)

Fixes: 129266058

Change-Id: I199c3ae99fa6b407da64562a71d8d7581ebf80e6
2019-03-28 18:48:31 -07:00
Felipe Leme
080542019a Refactored ContentCapture sessions to use an int id.
This is an internal change that will save memory:
- ids themselves are smaller (one int vs ~20 chars string)
- can be mapped with SparseArrays
- parcel objects will be smaller

Test: atest CtsContentCaptureServiceTestCases \
  FrameworksCoreTests:android.view.contentcapture.ContentCaptureEventTest \
  FrameworksCoreTests:android.view.contentcapture.ContentCaptureSessionTest

Fixes: 121197119

Change-Id: I4b4367bd7238400ade385c2bcc4b0595ed0b1c7b
2019-03-28 13:50:06 -07:00
Felipe Leme
9bee9440db Fixed ContentCapture and AugmentedAutofill methods that should not hold the main lock...
...otherwise they could ANR the ActivityManagerService and crash the system

Test: manual verification
Test: atest AugmentedLoginActivityTest
Test: atest CtsContentCaptureServiceTestCases # sanity check (minus usual flakiness)

Fixes: 129410913
Bug: 126266412

Change-Id: I4b0b0c389dd2c34928c6fffeec2854518a5e7da1
2019-03-27 17:11:08 -07:00
Adam He
59e96e1464 Reset the whitelist helper for augmented autofill and content capture
when service changes.

Fixes: 128911798
Test: atest CtsContentCaptureServiceTestCases
Test: atest
android.autofillservice.cts.augmented.AugmentedLoginActivityTest

Change-Id: If63b1d1419637764557c87b4e960d6ef32160594
2019-03-26 15:55:39 -07:00
Michal Karpinski
322df0bb74 Modify AbstractRemoteService#mBindInstantServiceAllowed to #mBindingFlags
in order to support multiple binding flags

And supply BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS for RemoteFillService.

Test: atest CtsAutoFillServiceTestCases
Test: atest AutofillManagerServiceTest
Bug: 126267782
Change-Id: Id5262d6a4e0fde0ad874020f783cfbf72fe201f4
2019-03-26 11:07:33 +00:00
TreeHugger Robot
1987dfa035 Merge "Added a "lite" flag on ContentCaptureOptions." 2019-03-23 04:33:21 +00:00
Felipe Leme
6430cbc869 Restricts ContentCapture and AugmentedAutofill when using temporary services.
Test: manual verification
Test: atest CtsContentCaptureServiceTestCases AugmentedLoginActivityTest

Fixes: 120514763

Change-Id: Icb4bfab566ecb041ff77655651b1f6c51551303f
2019-03-22 16:24:36 -07:00
TreeHugger Robot
4f3f18dec3 Merge "Fixed Content Capture workflow when service package is updated." 2019-03-22 23:00:01 +00:00
Felipe Leme
2f28843249 Fixed Content Capture workflow when service package is updated.
The workflow already handles the case where the service dies and the framework re-establishes
the binder connection, but that didn't work when it died because the package was being updated.

This CL fixes this scenario by gracefully pausing the existing sessions before the package is
updated, then resuming them afterwards.

Test: manual verification
Test: atest CtsContentCaptureServiceTestCases # sanity check minus flakiness

Bug: 126266412
Fixes: 129072171

Change-Id: Ibc6b723c7bc08b4f920436f365d6006bc8fac7b6
2019-03-21 18:15:05 -07:00
Felipe Leme
5001b3bb44 Added a "lite" flag on ContentCaptureOptions.
It will be used to let activities from the ContentCapture service package to use
the ContentCaptureManager APIs (such as isContentCaptureFeatureEnabled()), without
triggering content capture per se.

Bug: 122958583
Test: manual verification
Test: atest CtsContentCaptureServiceTestCases # sanity check

Change-Id: I0305fa9f3adb68e6faff80afcb965ae4643f2992
2019-03-21 10:13:49 -07:00
Felipe Leme
f8b8778468 New method ContentCaptureManager.getServiceSettingsComponentName()
Test: manual verification

Test: atest CtsContentCaptureServiceTestCases # sanity check

Bug: 119264902

Change-Id: I3f387386652dad7b187ae04b29f16512ff444ca1
2019-03-20 14:58:53 -07:00
TreeHugger Robot
d766168cda Merge "New autofill cmds to enable / disable / check default augmented service." 2019-03-20 20:42:06 +00:00
Felipe Leme
a5d5e2db8f Added manifest metadata to define the content capture settings activity.
Test: m update-api
Test: mmm frameworks/base/:doc-comment-check-docs
Test: adb shell dumpsys content_capture
Test: CtsContentCaptureServiceTestCases

Bug: 119264902

Change-Id: I656c50d9a45f68312898c8857572d5fe3f55c193
2019-03-20 08:36:24 -07:00
Felipe Leme
a70dd8c952 New autofill cmds to enable / disable / check default augmented service.
Also fixed FrameworkResourcesServiceNameResolver so setDefaultServiceEnabled(true) doesn't thrown
and exception when it's already true. Example:

adb shell cmd content_capture set default-service-enabled 0 true

Exception occurred while executing:
java.lang.ArrayIndexOutOfBoundsException: src.length=11 srcPos=1 dst.length=11 dstPos=0 length=-1
	at java.lang.System.arraycopy(Native Method)
	at android.util.SparseBooleanArray.removeAt(SparseBooleanArray.java:127)
	at com.android.server.infra.FrameworkResourcesServiceNameResolver.setDefaultServiceEnabled(FrameworkResourcesServiceNameResolver.java:180)

Test: adb shell cmd autofill set default-augmented-service-enabled 0 false
Test: adb shell cmd autofill get default-augmented-service-enabled 0
Test: atest CtsAutoFillServiceTestCases

Bug: 123952975
Bug: 126266412

Change-Id: If24c69f4451a82c803a7f067956454f93b722f8f
2019-03-19 11:18:13 -07:00
TreeHugger Robot
5d318372f9 Merge "Destroy remote service when CCService dies." 2019-03-14 20:50:05 +00:00
Felipe Leme
73e65ba47e Keep ContentCapturePerUserService alive while the package is being updated.
Test: manual verification (cannot be tested using CTS because it would kill the test process)
Test: atest CtsContentCaptureServiceTestCases

Bug: 126266412
Fixes: 128466656

Change-Id: I73e89f41b58615070c38103fa2f1fa04ac015dca
2019-03-13 22:00:14 -07:00
Felipe Leme
518fb624c0 Changed ContentCapture session lifecycle so session is kept alive when service died.
This is useful for long-lived activities (like a browser), so child session can still be reported
after the service is restarted after dying.

Test: manual verification (cannot be tested using CTS because it would kill the test process)
Test: atest FrameworksCoreTests:android.view.contentcapture.ContentCaptureEventTest
Test: m update-api

Bug: 128466656

Change-Id: I9310263e897e929189d323d31853592a374dc6e0
2019-03-13 16:10:05 -07:00
Adam He
d2954720a4 Destroy remote service when CCService dies.
Remote services were still reconnecting back to the CCService when it is
restarted. This prevents multiple CCPerUserService/RemoteService staying
alive and clogging resources.

Fixes: 127662995
Test: atest CtsContentCaptureServiceTestCases
Test: manual verification
Change-Id: Idc5835594ebeb3ed245685189da11cff9799e62e
2019-03-13 15:47:50 -07:00
TreeHugger Robot
d1bd765392 Merge "Add RoleControllerManager for role controller service." 2019-03-08 21:32:00 +00:00
Stanislav Zholnin
0b69c75a7c Merge "Use updated DeviceConfig API's new getters to simplify invocations." 2019-03-08 10:19:06 +00:00
Hai Zhang
a4959e569d Add RoleControllerManager for role controller service.
This allows us to expose both system-only and app available APIs for
role in RoleControllerService.

Bug: 127691087
Test: manual
Change-Id: I86fe3736fc28516aae25d48efe3ba599ffdf45d5
2019-03-07 21:33:12 -08:00
Felipe Leme
0879ad0bd4 Merge "Don't destroy service when the bind connection died." 2019-03-08 03:44:51 +00:00
TreeHugger Robot
06ff48f856 Merge "New API: ContentCaptureService.onActivityEvent()" 2019-03-07 23:35:34 +00:00
Felipe Leme
817b5e12f9 Don't destroy service when the bind connection died.
Otherwise it won't reconnect...

Bug: 126807984
Test: manual verification

Change-Id: I54c7fc244672d38f387f786ea13a7ffb54aca44b
2019-03-07 14:46:59 -08:00
Felipe Leme
141864d610 New API: ContentCaptureService.onActivityEvent()
This API is needed for high-level events that happened on activities that are
not whitelisted for Content Capture.

Test: atest CtsContentCaptureServiceTestCases:android.contentcaptureservice.cts.LoginActivityTest#testSimpleLifecycle_defaultSession
Test: atest CtsContentCaptureServiceTestCases # sanity check
Test: m update-api

Bug: 126262658

Change-Id: Id2d4ccfb04d56eba561200d6875374a932c526ae
2019-03-07 13:06:21 -08:00
TreeHugger Robot
69ea91828c Merge "Improved how content capture is disabled by settings." 2019-03-07 18:44:31 +00:00
Stanislav Zholnin
a534368e75 Use updated DeviceConfig API's new getters to simplify invocations.
Test: manual verification
Change-Id: I213f25c9b16d7988617bcf127461a9097a8e16b3
2019-03-07 16:49:37 +00:00
Felipe Leme
8db0036c21 Improved how content capture is disabled by settings.
- Use 1/0 instead of true/false for the settings value.
- Improved logging / internal logic by splitting disabled by settings and device config.
- Other minor fixes.

Test: atest CtsContentCaptureServiceTestCases

Bug: 119264902

Change-Id: I51b99588f823c4e1eaf496841efd45757e4258be
2019-03-06 17:59:02 -08:00
Felipe Leme
0f0b1d383d Fixed Content Capture and Augmented Autofill whitelist.
Bug: 125348180
Test: atest CtsContentCaptureServiceTestCases AugmentedLoginActivityTest

Change-Id: Ia7a9b1ebbd14c0011a4806bcf5ba87f438510129
2019-03-06 12:08:39 -08:00
Adam He
70ebc5a508 Check for empty arguments in setWhitelist().
Bug: 125348180
Test: atest CtsContentCaptureServiceTestCases
Test: atest FrameworksCoreTests:com.android.internal.infra.WhitelistHelperTest
Change-Id: I9c2296ebe2762e97f03350b365b148429b15ab60
2019-03-05 14:51:30 -08:00
Adam He
6240eab185 Implemented a WhitelistHelper for whitelisting packages/activities for Augmented Autofill and Content Capture.
Fixes: 125348180
Test: atest android.contentcaptureservice.cts.LoginActivityTest
Test: atest android.autofillservice.cts.augmented.AugmentedLoginActivityTest
Test: atest FrameworksCoreTests:com.android.internal.infra.WhitelistHelperTest
Change-Id: I59c32d5a05c9c1ee813395545507fc8eaee47745
2019-03-04 16:15:32 -08:00
Felipe Leme
a820910468 Added DeviceConfig properties for Augmented Autofill service timeouts.
Test: manual verification
Bug: 123100811

Change-Id: I82749b4cea5fe90998efa0798fb6b032a8470086
2019-02-25 16:20:18 -08:00
TreeHugger Robot
5daa6d5c67 Merge "Added a DeviceConfig property for Content Capture idle timeout to unbind from system server." 2019-02-25 21:10:50 +00:00
Felipe Leme
e764fa2892 Added a DeviceConfig property for Content Capture idle timeout to unbind from system server.
Test: manual verification
Bug: 111276913

Change-Id: I3c8f0ffc5fbadfc033ef6574cab7e0ec1419b38e
2019-02-25 09:42:14 -08:00
Felipe Leme
81299d0d96 Made AbstractRemoteService.getRemoteRequestMillis() optional.
Also split some logic from PendingRequest into BasePendingRequest, so they're
not leaked into the async requests.

Test: atest CtsContentCaptureServiceTestCases CtsAutoFillServiceTestCases
Bug: 117779333
Change-Id: Ife9a3ab3a817944408caf9eae69dd75f48ab90c6
2019-02-21 16:11:26 -08:00
Felipe Leme
326f15a392 Optimized Content Capture workflow by caching some state at the application level.
Content Capture for an activity and/or package is only available when the Content Capture service
explicitly whitelists it. As the whitelist is kept at system-server level, it's better to fetch that
info when the application is started and cache it locally, so we can optimize the
ContentCaptureManager APIs to return quickly when it's disabled.

This CL also caches other values such as the buffer parameters.

Test: atest CtsContentCaptureServiceTestCases

Bug: 120494182
Bug: 121202151

Change-Id: I9d5211bca496ffa85ba9efc2a7bb32411834b787
2019-02-20 18:44:05 -08:00
Felipe Leme
72e83d8c3d Changed ContentCaptureManager API so service can only disable itself.
To re-enable, it will need to launch a Settings intent
(Settings.ACTION_REQUEST_ENABLE_CONTENT_CAPTURE).

Bug: 123286662
Test: atest CtsContentCaptureServiceTestCases

Change-Id: I0dd03013aba645c188af4034e530492d8294180e
2019-02-19 09:29:14 -08:00
Felipe Leme
e8eae9d420 Initial implementation of ContentCaptureService.setContentCaptureWhitelist()
For now it only whitelists packages, not activities.

Test: atest CtsContentCaptureServiceTestCases

Bug: 122595322

Change-Id: I5beb9b027eb704510e68f3af15e84e14bda07eb2
2019-02-15 20:00:49 -08:00
Felipe Leme
d32d8f6f3c Added DeviceConfig properties to fine tune ContentCapture:
- DEVICE_CONFIG_PROPERTY_MAX_BUFFER_SIZE
- DEVICE_CONFIG_PROPERTY_IDLE_FLUSH_FREQUENCY
- DEVICE_CONFIG_PROPERTY_TEXT_CHANGE_FLUSH_FREQUENCY
- DEVICE_CONFIG_PROPERTY_LOG_HISTORY_SIZE
- DEVICE_CONFIG_PROPERTY_LOGGING_LEVEL

Test: manual verification
Test: atest CtsContentCaptureServiceTestCases

Bug: 123096662
Fixes: 121044064
Fixes: 121044306

Change-Id: I08623516bb7ebbe9c900987be853f4f395250016
2019-02-15 17:32:04 -08:00
Felipe Leme
4eecbe6e3c Add new ContentCapture APIs to let apps change the ContentCaptureContext.
Test: atest CtsContentCaptureServiceTestCases:android.contentcaptureservice.cts.LoginActivityTest#testSimpleLifecycle_changeContextOnCreate \
   CtsContentCaptureServiceTestCases:android.contentcaptureservice.cts.LoginActivityTest#testSimpleLifecycle_changeContextAfterCreate
Test: atest FrameworksCoreTests:android.view.contentcapture.ContentCaptureEventTest

Bug: 124266664

Change-Id: I0348e81e1b2bac01363cf615d2ab32e5bab8aee1
2019-02-12 11:31:06 -08:00