Commit Graph

228 Commits

Author SHA1 Message Date
Maurice Lam
6364f5dadb Revert^2 "Add parameter annotations to createVirtualDisplay"
Also changed the Handler parameter to Executor

Bug: 217742182
Test: atest CtsVirtualDevicesTestCases
Change-Id: I0f8f0c6a0f57e773191382da824e53d6ea371f4b
2022-02-11 04:33:58 +00:00
Maurice Lam
a343cdb58e Revert "Add parameter annotations to createVirtualDisplay"
Revert "Update usage of VirtualDevice.createVirtualDisplay"

Revert submission 16788542-vdm-api-review

Reason for revert: Broke build
BUG: 218953698
Reverted Changes:
Iea9be6d6d:Update usage of VirtualDevice.createVirtualDisplay...
I3ff9fe54c:Update usage of VirtualDevice.createVirtualDisplay...
I3321927b3:Add parameter annotations to createVirtualDisplay

Change-Id: I22a345200d0dce57acdced1fc102e4631e659a44
2022-02-11 04:10:16 +00:00
Maurice Lam
1feb56be88 Add parameter annotations to createVirtualDisplay
Also changed the Handler parameter to Executor

Bug: 217742182
Test: atest CtsVirtualDevicesTestCases
Change-Id: I3321927b36361168655f4886825955a642fb6c79
2022-02-10 21:25:22 +00:00
TreeHugger Robot
db33f67f8d Merge "Use property instead of meta-data for primary CDM service" 2022-02-10 19:15:44 +00:00
Christine Franks
cb41738a86 Merge "Address API feedback and CTS on cloud devices" 2022-02-10 10:40:47 +00:00
TreeHugger Robot
f63c1051d7 Merge "[8/8] Use PresenceController and AppController in CdmService" 2022-02-10 09:58:21 +00:00
yuanjiahsu
f45b47964d Audio Injection respect Enterprise Policy
Listens to User Restrictions change of DISALLOW_UNMUTE_MICROPHONE to suspend or resume audio injection.

Bug: 195654431
Test: manual testing by go/testdpc pass
Change-Id: Ifedb89172edb0dc6474e078dea0c96f1c7038c4c
2022-02-10 03:32:03 +00:00
yuanjiahsu
69cf28591c Implement VirtualAudioDevice API
Add createVirtualAudioDevice() API in VirtualDevice to return a VirtualAudioDevice object for the caller to capture audio and inject microphone to applications running on the specified virtual display.

The VirtualAudioController in service side will responsible for listening virtual display running applications change, playback and recording config change, then notify the VirtualAudioSession to update AudioRecord/AudioTrack inside the AudioCapture/AudioInjection class internally.

Bug: 201558304
CTS-Coverage-Bug: 218528439
Test: atest FrameworksCoreTests:android.companion.virtual, atest FrameworksServicesTests:com.android.server.companion.virtual, manual testing with Exo by ag/16575248
Change-Id: I74f3da67b76aaa909943fbfc8418bf22d637ca39
2022-02-10 03:31:50 +00:00
Christine Franks
3b79889dfd Address API feedback and CTS on cloud devices
- Add additional javadoc for vendor and product ids
- Enumerate full allowed key code set for VirtualKeyEvent
- On cloud devices, CTS fails with 'bad address' for VirtualTouchscreen.
  Pass by address rather than by value to solve.

Bug: 216554655
Test: atest CtsHardwareTestCases:android.hardware.input.cts.tests
Change-Id: Ifb233d2b6c4eee1ffdcba218ed17312e67bac6f6
2022-02-09 17:14:52 -08:00
Evan Chen
bb287ae2d7 Use property instead of meta-data for primary CDM service
Meta-data will increase the system server ram consumption.
So we decide to use property instead of meta-data to
indicate the primary cdm service.

Test: atest CtsCompanionDeviceManagerCoreTestCases:SelfPresenceReportingTest
Fix: 217953124
Change-Id: I91ebe374bba392d14d693d3c6a36433b5af7cf2a
2022-02-09 19:35:22 +00:00
Antony Sargent
615b6c4e5d Merge "Rename LOCK_STATE_ALWAYS_LOCKED to LOCK_STATE_DEFAULT" 2022-02-09 17:08:28 +00:00
Sergey Nikolaienkov
880e3858ea Merge "Update javadoc for set/isForceConfirmation() in CDM" 2022-02-09 16:51:34 +00:00
Sergey Nikolaienkov
1aaf191972 Update javadoc for set/isForceConfirmation() in CDM
Replace "would prefer" with stronger language - "requires" - in the
javadoc to AssociationRequest.Builder.setForceConfirmation(boolean) and
AssociationRequest.isForceConfirmation().

Bug: 217366132
Test: m
Change-Id: I7d94598d71a39fc022927634975706ccffeac406
2022-02-09 14:17:24 +01:00
Sergey Nikolaienkov
aa15e1cc90 [8/8] Use PresenceController and AppController in CdmService
Use CompanionDevicePresenceMonitor and CompanionApplicationController in
CompanionDeviceManagerService.

Remove CompanionDevicePresenceController.

Bug: 211398735
Test: atest CtsCompanionDeviceManagerCoreTestCases
Test: atest CtsCompanionDeviceManagerUiAutomationTestCases
Test: atest CtsOsTestCases:CompanionDeviceManagerTest
Change-Id: I542c6d8157b51fc9c0a2e55055792b6951f292d9
2022-02-09 10:21:07 +01:00
Antony Sargent
e1db351bfb Rename LOCK_STATE_ALWAYS_LOCKED to LOCK_STATE_DEFAULT
Also update the documentation to more accurately represent what the
flag actually does.

Bug: 217273933
Test: existing tests should pass
Change-Id: I28c9798d7974e58cfcd6ab59e7ee50f9a6c43985
2022-02-08 22:36:51 -08:00
Christine Franks
2a017cdc08 Guard VirtualDevice#close by permission
If the permission is not already held by the caller through other means,
this causes unregistration failures, since the unique id disassociation
requires a signature permission. Clear the binding identity if the
permission is found, allowing use of the permisson. This is especially
important for CTS tests, and for access by non-signature apps.

Bug: 217275682
Test: atest CtsHardwareTestCases:android.hardware.input.cts.tests
Change-Id: Ide5232e5b5b5b1b3ca96e5cbfb997e4a1001a583
2022-02-08 00:25:33 -08:00
Christine Franks
27a354bf40 Add API to hide cursor for virtual mice
Bug: 216244627
Test: atest FrameworksServicesTests:com.android.server.companion.virtual
CTS-Coverage-Bug: 208247880
Change-Id: Ie1a2bc526a705f2f9788898afbff87f5a9448f85
2022-02-04 12:15:18 -08:00
Sergey Nikolaienkov
214667438f Merge "Add CDM CTS test modules to Test-Mapping Presubmit" 2022-02-03 09:52:38 +00:00
Maurice Lam
a072e9fd46 Unhide VDM API to allow / block specific activities
Bug: 194949534
Test: ag/15781910
CTS-Coverage-Bug: 204606917
Change-Id: I77b68bc04a7e5fd3b6d2ca3f84e5d772d6e680b2
2022-01-27 18:22:02 +00:00
Evan Chen
52b04dcfd3 Merge "Introduce COMPANION_COMPUTER profile for Phone Hub" 2022-01-27 06:57:35 +00:00
Guojing Yuan
08af136e37 Merge "[CDM perm sync] Hide data transfer APIs" 2022-01-27 05:09:17 +00:00
Evan Chen
79122d967e Introduce COMPANION_COMPUTER profile for Phone Hub
Bug: 216213933
Test: atest CtsCompanionDeviceManagerCoreTestCases:DeviceProfilesTest
Change-Id: I2cd6cfc5e2b9df3708fae3e4db8164e36fc9717a
2022-01-26 23:43:05 +00:00
Guojing Yuan
cad8812676 [CDM perm sync] Hide data transfer APIs
Due to permission sync feature has been punted to U, the data transfer
APIs need to be hidden.

Bug: 199427116
Fix: 203822629

Test: m and flash
Change-Id: Ibb642827cd9f1708a557af7a8a996826ceec3eb9
2022-01-26 22:50:17 +00:00
Maurice Lam
d7d54f31a9 Merge "Allow VDM virtual displays to get FLAG_OWN_DISPLAY_GROUP" 2022-01-26 05:06:24 +00:00
TreeHugger Robot
9e17f25d21 Merge "Unhide VDM activity APIs" 2022-01-26 03:45:15 +00:00
Maurice Lam
0f830d9944 Allow VDM virtual displays to get FLAG_OWN_DISPLAY_GROUP
For virtual displays that are created through VDM, allow
FLAG_OWN_DISPLAY_GROUP to be added. This applies to every display
created through VDM, because VDM adds this flag on behalf of the caller
by default.

Bug: 194949534
Test: atest DisplayManagerServiceTest.java
Change-Id: I1826dbd0cb7f4c4a76abbf25741b9862c5ff7355
2022-01-25 23:51:44 +00:00
Maurice Lam
f9e52140f2 Unhide VDM activity APIs
Unhiding VDM activity listener and launchPendingIntent APIs.

Bug: 194949534
Test: ag/15781910
CTS-Coverage-Bug: 204606917
Change-Id: I7c8b80cf8ed99d1c2931084840b5cd4428c5b285
2022-01-25 22:17:32 +00:00
Maurice Lam
4cf3f9b827 Add oneway to IVirtualDeviceActivityListener
Bug: 216200887
Test: Error logs no longer show on logcat
Change-Id: I4c945ef78be9277b2c2570538138f9b8b955d7c1
2022-01-25 18:25:50 +00:00
Maurice Lam
7f512ebc8a Add ActivityListener to VirtualDeviceManager
The API allows virtual device owners to listen to when the top activity
of a virtual device's display changes, and when a display becomes empty.
The former is used to display a notification to the user that can say
"Syncing <app name> to your Chromebook". The latter is used so that the
streamed window on ChromeOS side can be closed when the display becomes
empty.

Bug: 194949534
Test: To be added in ag/15781910
Change-Id: I5172e55a3a79b5fadc1719e99160b7675612e97b
2022-01-21 15:16:06 -08:00
Christine Franks
1bc94f4f47 Merge "Add mouse handling APIs" 2022-01-21 20:34:27 +00:00
Christine Franks
488d915feb Add mouse handling APIs
Bug: 202273865
Test: atest FrameworksCoreTests:android.hardware.input
CTS-Coverage-Bug: 208247880
Change-Id: Ic70f5f9e914492cb512095abb5687727b3bb3f09
2022-01-20 21:43:50 -08:00
Maurice Lam
55cf7b0932 Unhide VDM APIs
Bug: 194949534
Test: ag/15781910
Change-Id: Ied73d2efaf4f3cf3f713fe80025d862a904d70d2
CTS-Coverage-Bug: 204606917
2022-01-20 20:40:12 -08:00
Maurice Lam
305dfdf152 Merge "Add setAllowedActivities/setBlockActivities implementation" 2022-01-21 00:48:52 +00:00
Maurice Lam
9ed5fe201c Add setAllowedActivities/setBlockActivities implementation
These APIs allow Virtual Device owners to configure allow and deny lists of
components which are allowed to be streamed.

Bug: 201559291
Test: To be added in ag/15781910
Change-Id: I5e9297b9fdbe987690e164b7215352e741806fd5
2022-01-19 15:48:35 -08:00
Bernardo Rufino
1a5cb387d6 Revert "Revert "Migrate unsafe parcel APIs in framework-minus-apex""
This reverts commit 331be9a643.

Reintroducing ag/16366278 since it seems unrelated to b/214053959 (more details on b/214053959#comment55).

Original commit message:

Migrate unsafe parcel APIs in framework-minus-apex

Migrate the following unsafe parcel APIs in framework-minus-apex:
* Parcel.readSerializable()
* Parcel.readArrayList()
* Parcel.readList()
* Parcel.readParcelable()
* Parcel.readParcelableList()
* Parcel.readSparseArray()

This CL was generated by applying lint fixes that infer the expected
type from the caller code and provide that as the type parameter
(ag/16365240).

A few observations:
* In some classes we couldn't migrate because the class also belonged to
another build module whose min SDK wasn't current (as is the case for
framework-minus-apex), hence I suppressed the lint check
(since I'll eventually submit the lint check to the tree).
* In some cases, I needed to do the cast in
https://stackoverflow.com/a/1080525/5765705 to make the compiler happy
since there isn't another way of providing a class of type
Class<MyClassWithGenerics<T>>.
* In the readSerializable() case, the new API also requires the class
loader, that was inferred to by InferredClass.class.getClassLoader().
* Note that automatic formatting and import rely on running hooked up
to the IDE, which wasn't the case here.

Bug: 195622897
Change-Id: I272432e6e082a973f7a50492ec35d79c2b577c93
Test: TH passes
2022-01-19 11:13:18 +00:00
Sergey Nikolaienkov
f5a32ba38b Prefix CDM's "primary" tag with "android.companion"
Prefix CDM's "primary" tag with "android.companion" to bring it in line
with other similar tags used in Android Applications Framework:
- android.service.notification.default_filter_types
- android.view.merge
- android.media.tv.input
etc.

Expand Javadoc for android.companion.CompanionDeviceService

Bug: 198539218
Test: atest CtsCompanionDeviceManagerCoreTestCases
Test: atest CtsCompanionDeviceManagerUiAutomationTestCases
Change-Id: I10fd70c24b6a653dd03e1b74dc682194d867df93
2022-01-18 14:07:23 +01:00
Sergey Nikolaienkov
6fbb4bc864 Add CDM CTS test modules to Test-Mapping Presubmit
Add CtsCompanionDeviceManagerCoreTestCases and
CtsCompanionDeviceManagerUiAutomationTestCases to the "presubmit"
TEST_MAPPING group.

Bug: 208213276
Bug: 212535524
Test: atest --test-mapping frameworks/base/core/java/android/companion:presubmit
Test: atest --test-mapping frameworks/base/services/companion:presubmit
Change-Id: I50fd495f3fc455932fd915461a7c3b8559ef0e6e
2022-01-17 11:54:41 +00:00
Maurice Lam
f487abc917 Merge "Add VirtualDevice.launchPendingIntent" 2022-01-15 01:34:54 +00:00
TreeHugger Robot
67f2cca87e Merge "Make AssociationInfo immutable" 2022-01-14 20:50:40 +00:00
Maurice Lam
f03d832c43 Add VirtualDevice.launchPendingIntent
Add launchPendingIntent method on VirtualDevice, which allows specifying
a display ID to launch the pending intent on. For activity intents, this
is equivalent to adding the ActivityOptions with setLaunchDisplayId on
the pending intent. For service and broadcast pending intents,
VirtualDeviceManager will try to catch any trampolines activities
launched by the pending intent creator and start those on the virtual
display instead.

Bug: 194949534
Test: Manual, CTS to be added in ag/15781910
Change-Id: Ia5d6c92167f0ee6c9f246fd4335daa824aceaef9
2022-01-14 12:16:31 -08:00
Nikolas Havrikov
173116efb4 Make AssociationInfo immutable
This CL turns AssociationInfo into an immutable data class and
introduces a typesafe builder pattern for producing modified copies.

Note that this change now also invalidates the user cache entry when
making updates to associations.

Test: atest CtsCompanionDeviceManagerCoreTestCases
Test: atest CtsCompanionDeviceManagerUiAutomationTestCases
Change-Id: Ifd62d2ecce57790b6e462eb23033ca6c9a0cfe1b
2022-01-14 17:46:17 +01:00
Sergey Nikolaienkov
265aab1329 Merge "Make IOnAssociationsChangedListener.onAssociationsChanged() blocking" 2022-01-14 13:34:09 +00:00
Sergey Nikolaienkov
11ec828ecd Make IOnAssociationsChangedListener.onAssociationsChanged() blocking
Make IOnAssociationsChangedListener.onAssociationsChanged() blocking
(not "oneway") to make sure that the clients of the
addOnAssociationsChangedListener() API (@SystemAPI guarded by a
"signature" permission) are able to prevent race conditions that may
arise if their own clients (applications) effectively get notified
about the changes before system services do.

This is safe for 2 reasons:
1. The addOnAssociationsChangedListener() API is only available to the
   system components (guarded by a "signature" permission).
   See android.permission.MANAGE_COMPANION_DEVICES.
2. On the Java side addOnAssociationsChangedListener() in CDM takes an
   Executor, and the proxy implementation of onAssociationsChanged()
   simply "posts" a job to it.
   See CompanionDeviceManager.OnAssociationsChangedListenerProxy class.

Bug: 214016641
Test: atest --iterations 10 CtsCompanionDeviceManagerCoreTestCases:AssociationsChangedListenerTest
Test: atest CtsCompanionDeviceManagerCoreTestCases
Test: atest CtsCompanionDeviceManagerUiAutomationTestCases
Test: atest CtsOsTestCases:CompanionDeviceManagerTest
Change-Id: I7c664e9b9c848f8f0291ff46a56ff47bae7db346
2022-01-14 09:13:45 +00:00
TreeHugger Robot
f1e7be07c0 Merge changes from topic "virtualdevice-params"
* changes:
  Implement VirtualDevice's device policy enforcement
  Add params object to createVirtualDevice
2022-01-13 21:07:43 +00:00
TreeHugger Robot
4963d74405 Merge "[CDM perm sync] Add SystemDataTransferRequest" 2022-01-13 03:08:18 +00:00
Ashwini Oruganti
776b439703 Merge "Revert "Migrate unsafe parcel APIs in framework-minus-apex"" 2022-01-12 23:07:08 +00:00
Guojing Yuan
24e02301b0 [CDM perm sync] Add SystemDataTransferRequest
Bug: 213338076
Test: TBD once UI is built.
Change-Id: I97da96f9fc39cce0b7905940ff6eedce503a2c2f
2022-01-12 19:51:14 +00:00
Bernardo Rufino
331be9a643 Revert "Migrate unsafe parcel APIs in framework-minus-apex"
This reverts commit 90bb3709dc.

Reason for revert: b/214053959

Change-Id: Ic271bab1d3eaf677a5989dda9deb944ee2ad6850
2022-01-12 17:44:44 +00:00
Sergey Nikolaienkov
b50ab15126 Merge "postAtFrontOfQueue() in ICompanionDeviceService.Stub" 2022-01-10 20:47:02 +00:00
Sergey Nikolaienkov
a4d4186ffb postAtFrontOfQueue() in ICompanionDeviceService.Stub
postAtFrontOfQueue() instead of post()-ing at the back of the queue
in ICompanionDeviceService.Stub to prevent "posted" methods are invoked
*before* onUnbind()/onDestroy().

Add missing @Override annotation to onDispatchMessage method.

Clean up dispatchMessage() which is not a part of
ICompanionDeviceService interface.

Make the Stub implementation class private.

Bug: 198485833
Bug: 200940347
Test: atest CtsCompanionDeviceManagerCoreTestCases
Test: atest CtsCompanionDeviceManagerUiAutomationTestCases
Test: atest CtsOsTestCases:CompanionDeviceManagerTest
Change-Id: Ic44e7968b1cef42355631151aa6958fe1ec7dd6e
2022-01-10 09:36:09 +01:00