When creating a VirtualDisplay for a VirtualDevice, we need to do some
extra work like setting up for input injection, creating a
DisplayWindowPolicyController, and grabbing a wakelock to keep the
display awake. Some parts of this extra work end up calling back into
the DisplayManagerService from another thread, but since we're already
holding the mSyncRoot lock we sometimes get into situations where
those threads get blocked trying to acquire mSyncRoot, while holding a
lock that another thread ends up needing like the global window
manager one, so we get deadlock.
The fix in this CL is to break up the extra work the
VirtualDeviceManagerService needs to do into two parts: one part that
happens before the VirtualDisplay is created, and one part
after. Neither of these needs mSyncRoot to be held.
Fixes: 230544802
Test: atest CreateVirtualDisplayTest
Change-Id: I6a6e03f816567579510b3f1ef0705375549a3c88
When calling VirtualDeviceManager#createVirtualAudioDevice(), if the
caller pass null AudioConfigurationChangeCallback parameter, it means
the caller doesn't care the audio playback/recording change in virtual
display, and we should not register it with AudioManager for
optimization.
Bug: 218528439
Test: atest CtsVirtualDevicesTestCases
Change-Id: I00120f2506f593100ef8c523a4f6addffe46597b
Instead of separate onLaunchSuccess and onLaunchFailure methods, combine
them into onLaunchComplete(int status), which can either be SUCCESS or
indicate the reason for failure.
Bug: 219985243
Test: atest CtsVirtualDevicesTestCases
Change-Id: I822c189b4bfc49ce936f072ff6e06f504c8eb80d
The topActivity defined in ActivityListener#onTopActivityChanged is @NonNull, so GenericWindowPolicyController should not send the callback when topActivity is null.
Bug: 222771130
Test: manual testing
Change-Id: I227d1d83e0e191975ab45b110909938022bb1d0c
1. Add the new association request failure codes
RESULT_USER_REJECTED, RESULT_DISCOVERY_TIMEOUT
RESULT_INTERNAL_ERROR
2. Add the new association failure reason:
REASON_CANCELED, REASON_DISCOVERY_TIMEOUT,
REASON_USER_REJECTED
The change helps to identify user's action that
the association request explicitly declined by the user
Test: atest CtsCompanionDeviceManagerCoreTestCases
atest CtsCompanionDeviceManagerUiAutomationTestCases
atest CtsOsTestCases:CompanionDeviceManagerTest
Bug: 223706865
Fix: 224559263
Change-Id: I50fe40780a977c5bbe0aac5b67e1925ea75058bb
This changes the API to allow virtual device owners to configure allow
and deny lists of components to navigate to new tasks while being
streamed.
The change is only in VirtualDeviceParams, a recent API addition with
low touch. Base case has the new lists set to an empty set preventing
any change to current behavior.
Bug: 223915401
Test: Tests added in ag/17235857
Change-Id: Icb44163acb23736e562ffb4b08f4eb93c8b01990
Add #close() but keep it and the constructor as package-private because we want caller to call VirtualAudioDevice#close().
Add #getFormat() and the audio format will be owned by
AudioCapture/AudioInjection, not VirtualAudioSession.
Add all #read() and #write() overloads method, so that the caller can
replace the call to AudioRecord/AudioTrack easily.
Bug: 218542209
CTS-Coverage-Bug: 218528439
Test: atest FrameworksCoreTests:android.companion.virtual
Change-Id: Iccfd497e6aaeacc60a57d28ae730fdc0cce46a25
- Removed overload of addActivityListener that doesn't have executor
- Moved executor to be before the listener
Bug: 219985243
Test: atest CtsVirtualDevicesTestCases
Change-Id: I0681aeabeeefde5ce2c3ff4da3f50acc7f22ca07
Instead of using null values to indicate whether to use the allow list
or deny list for activity launching, add an intdef value to specify that
explicitly.
Bug: 219985243
Test: atest CtsVirtualDevicesTestCases
Change-Id: Ie6039262c95270f8886da7146999f30844f69a3c
Limits only one VirtualAudioDevice can be created per VirtualDevice.
When VirtualDevice is closed, the associated VirtualAudioDevice and VirtualAudioController will be closed as well.
Bug: 218751752
Test: atest FrameworksServicesTests:com.android.server.companion.virtual
Change-Id: I6aa8b8af8b526fb52bbb4b23305f28182012803d
Expand javadocs and change return value to NonNull for
VirtualDeviceManager.createVirtualDevice.
Also removed the redundant @TestApi on the virtual display flag.
Bug: 217742182
Test: Existing tests pass
Change-Id: I381039e6ebe4f5f5046a35e9a3e266ff7f46c369
Also changed the Handler parameter to Executor
Bug: 217742182
Test: atest CtsVirtualDevicesTestCases
Change-Id: I3321927b36361168655f4886825955a642fb6c79
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
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
- 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
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
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
Also update the documentation to more accurately represent what the
flag actually does.
Bug: 217273933
Test: existing tests should pass
Change-Id: I28c9798d7974e58cfcd6ab59e7ee50f9a6c43985
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
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
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
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