Commit Graph

88 Commits

Author SHA1 Message Date
Adam He
ffa36ff8fa Prevent content capture sessions starting if a non-default service
requests it on an activity not in its own UID.

Fixes: 142284417
Test: manual verification
Change-Id: I9e217e0087e2e7741a2713c25ca26264eae618e7
2019-10-15 12:52:28 -07:00
Felipe Leme
987655d049 Improved AbstractMasterSystemService to handle supported user types.
Also changed AutofillManagerService and ContentCaptureManagerService to take advantage of these methods.

Test: manual verification
Test: atest CtsAutoFillServiceTestCases CtsContentCaptureServiceTestCases # on phone and Automotive

Bug: 133242016

Change-Id: I3e7f9d65a6ef1e8e6ec886a41b35733e463a6389
2019-08-26 10:51:03 -07:00
Adam He
420947c4cc Metrics for content capture.
Bug: 119613670
Test: statsd_testdrive & manual test
Change-Id: If43465ccee7454a7ebf9e15caa23fce7bae33cfe
2019-05-14 11:33:33 -07:00
Felipe Leme
5654efd4cb Merge "Renamed UserDataRemovalRequest to DataRemovalRequest." 2019-05-09 00:17:10 +00:00
Felipe Leme
4439ee663f Renamed UserDataRemovalRequest to DataRemovalRequest.
Test: m update-api
Test: atest CtsContentCaptureServiceTestCases

Bug: 130726495

Change-Id: I691b9de40863421395e910f6e28186d8a91b08f2
2019-05-08 10:36:36 -07:00
Felipe Leme
6916eda7c2 Merge "Disable existing ContentCapture sessions if service changes their whitelist status." into qt-dev am: d97db54da4
am: a182f9c95f

Change-Id: I6463bd892ce0f0e67449988e40e0b2ac40598bea
2019-05-08 10:22:42 -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
Adam He
bfd799ad8a Merge "Propogate disabled state to content capture session after changing user restrictions or on ccm.setContentCaptureEnabled()." into qt-dev am: 9f590ef1a9
am: e82f16f82c

Change-Id: I795acfb113c76eb30cea34138410eaff560cfcf7
2019-05-02 16:00:24 -07:00
Matt Pape
55a51bf8d3 Merge "Migrate usage of single property lister to multi prop listener." into qt-dev am: 8e24abad64
am: 554e191d4b

Change-Id: Ibc55770e1e02ed4fb8a44c6f765ec080395068bf
2019-05-01 20:38:19 -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
41e9eb0aed 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
Change-Id: I2c76a01bd98c4154c4c59099f1368232d2dba80d
2019-04-19 19:47:36 -07:00
Felipe Leme
ab08d1de64 Merge "Remove ContentCaptureServerSession when app died." into qt-dev am: 094b9acb0d
am: 11c6dfd0af

Change-Id: I4963ae27992e59b801c51304a181093d2a1b9735
2019-04-18 14:02:09 -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
Robert Berry
e14120edf2 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.

Bug: 128925852
Test: Manual. I created an implementation of the service.
Change-Id: Iafde1bb68f4754d8167624f47c6833d43c0ec336
2019-04-03 20:41:03 -04: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