summaryrefslogtreecommitdiff
path: root/core/java/android/companion
Commit message (Collapse)AuthorAgeFilesLines
* Limits the display name to 1024 charactersEvan Chen2025-10-071-0/+5
| | | | | | | | | Bug: 418773283 Test: cts Flag: EXEMPT bugfix (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:cdb53aa29b4b0fcebbdabb183d4909009f93140e) Merged-In: I29e050c498e813e291af213ce4ddc590559c8b7d Change-Id: I29e050c498e813e291af213ce4ddc590559c8b7d
* Delay role revoke when the app is not visible to the userEvan Chen2022-06-231-2/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This cl fixes the problem that CDM calls RoleManager.removeRoleHolderAsUser() will kill the application's process that lead to the poor user experience. In order to fix the problem: 1. Introduce a new OnUidImportanceListener which watches the importance of the packages. In this class, we only interested in the importance of the running process is greater than IMPORTANCE_VISIBLE. 2. Introduce a new field in AssociationInfo class: 'mRevoked' to indicate the associaiton has been reovked and pending for role holder removal. So that the revoked association can store in the same place as the active associaiton -> easy maintenance. 3. Finally remove the role holder for the packages are not visible to the users. Bug: 189250370 Test: atest CtsCompanionDeviceManagerCoreTestCases atest CtsCompanionDeviceManagerUiAutomationTestCases atest CtsOsTestCases:CompanionDeviceManagerTest Change-Id: Ib7fb08b0d800c62a9ee708ddd52cd174de1829d9 Merged-In: Ib7fb08b0d800c62a9ee708ddd52cd174de1829d9
* Prevent deadlocks during VirtualDisplay creationAntony Sargent2022-05-292-13/+36
| | | | | | | | | | | | | | | | | | | | | 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
* Add OWNER to Virtual Device Manageryuanjiahsu2022-05-061-0/+1
| | | | | Test: presubmit Change-Id: I4a8a2b45835b7838ab41ae6867dc230471eb5952
* Merge "Add launch complete status to launchPendingIntent" into tm-devTreeHugger Robot2022-03-301-28/+45
|\
| * Add launch complete status to launchPendingIntentMaurice Lam2022-03-281-28/+45
| | | | | | | | | | | | | | | | | | | | 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
* | Don't register playback/recording change if caller doesn't care ityuanjiahsu2022-03-305-33/+83
| | | | | | | | | | | | | | | | | | | | | | | | 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
* | Don't send callback with null topActivityyuanjiahsu2022-03-241-0/+4
| | | | | | | | | | | | | | | | 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
* | Merge "Add CrossTaskNavigations API to restrict navigation from current ↵Shaun Corkran2022-03-231-3/+158
|\ \ | |/ |/| | | task" into tm-dev
| * Add CrossTaskNavigations API to restrict navigation from current taskShaun Corkran2022-03-211-3/+158
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 a new association request failure codeEvan Chen2022-03-211-0/+50
|/ | | | | | | | | | | | | | | | | | | | | 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
* Merge "Enforce @NonNull within VirtualDeviceParams." into tm-devTaylor Bessette2022-03-091-15/+15
|\
| * Enforce @NonNull within VirtualDeviceParams.Taylor Bessette2022-03-081-15/+15
| | | | | | | | | | Test: unit tests Change-Id: I8768fd5264297e4a1938563ffc6b3bad67e13269
* | Merge "Add more methods for capture and injection" into tm-devYuanjia Hsu2022-03-033-30/+204
|\ \
| * | Add more methods for capture and injectionyuanjiahsu2022-03-023-30/+204
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | Merge "Update VirtualDeviceManager.ActivityCallback API" into tm-devTreeHugger Robot2022-03-032-13/+3
|\ \ \ | |/ / |/| |
| * | Update VirtualDeviceManager.ActivityCallback APIMaurice Lam2022-03-012-13/+3
| |/ | | | | | | | | | | | | | | | | - Removed overload of addActivityListener that doesn't have executor - Moved executor to be before the listener Bug: 219985243 Test: atest CtsVirtualDevicesTestCases Change-Id: I0681aeabeeefde5ce2c3ff4da3f50acc7f22ca07
* / Update remote input device doc and add IntDefChristine Franks2022-03-011-6/+6
|/ | | | | | | | This IntDef specifies the supported key codes. Bug: 216554655 Test: builds Change-Id: Idde1ab17148294bd7348fdf72eb3b1fa65f777c1
* Merge "Specify default activity policy" into tm-devTreeHugger Robot2022-02-251-47/+85
|\
| * Specify default activity policyMaurice Lam2022-02-221-47/+85
| | | | | | | | | | | | | | | | | | | | 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
* | Make executor @Nullable in createVirtualDisplayMaurice Lam2022-02-221-4/+4
|/ | | | | | Fixes: 218717272 Test: Existing tests pass Change-Id: I0e4b73d8e9c3bf80e7d7d33213fd1c43d8ed207d
* Clean up audio resources when VirtualDevice is closedyuanjiahsu2022-02-174-10/+30
| | | | | | | | | | 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
* Address API review commentsMaurice Lam2022-02-111-2/+9
| | | | | | | | | | 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
* Add parameter annotations to createVirtualDisplayMaurice Lam2022-02-101-12/+12
| | | | | | | | Also changed the Handler parameter to Executor Bug: 217742182 Test: atest CtsVirtualDevicesTestCases Change-Id: I3321927b36361168655f4886825955a642fb6c79
* Merge "Use property instead of meta-data for primary CDM service"TreeHugger Robot2022-02-102-6/+7
|\
| * Use property instead of meta-data for primary CDM serviceEvan Chen2022-02-092-6/+7
| | | | | | | | | | | | | | | | | | | | 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
* | Merge "Address API feedback and CTS on cloud devices"Christine Franks2022-02-101-6/+6
|\ \
| * | Address API feedback and CTS on cloud devicesChristine Franks2022-02-091-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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
* | | Merge "[8/8] Use PresenceController and AppController in CdmService"TreeHugger Robot2022-02-101-0/+12
|\ \ \ | | |/ | |/|
| * | [8/8] Use PresenceController and AppController in CdmServiceSergey Nikolaienkov2022-02-091-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use CompanionDevicePresenceMonitor and CompanionApplicationController in CompanionDeviceManagerService. Remove CompanionDevicePresenceController. Bug: 211398735 Test: atest CtsCompanionDeviceManagerCoreTestCases Test: atest CtsCompanionDeviceManagerUiAutomationTestCases Test: atest CtsOsTestCases:CompanionDeviceManagerTest Change-Id: I542c6d8157b51fc9c0a2e55055792b6951f292d9
* | | Audio Injection respect Enterprise Policyyuanjiahsu2022-02-103-5/+122
| | | | | | | | | | | | | | | | | | | | | | | | 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
* | | Implement VirtualAudioDevice APIyuanjiahsu2022-02-107-0/+800
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | Merge "Rename LOCK_STATE_ALWAYS_LOCKED to LOCK_STATE_DEFAULT"Antony Sargent2022-02-091-6/+7
|\ \ \
| * | | Rename LOCK_STATE_ALWAYS_LOCKED to LOCK_STATE_DEFAULTAntony Sargent2022-02-081-6/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Also update the documentation to more accurately represent what the flag actually does. Bug: 217273933 Test: existing tests should pass Change-Id: I28c9798d7974e58cfcd6ab59e7ee50f9a6c43985
* | | | Merge "Update javadoc for set/isForceConfirmation() in CDM"Sergey Nikolaienkov2022-02-091-6/+6
|\ \ \ \ | |_|_|/ |/| | |
| * | | Update javadoc for set/isForceConfirmation() in CDMSergey Nikolaienkov2022-02-091-6/+6
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | Guard VirtualDevice#close by permissionChristine Franks2022-02-081-0/+1
| |/ |/| | | | | | | | | | | | | | | | | | | | | 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
* | Add API to hide cursor for virtual miceChristine Franks2022-02-042-0/+19
|/ | | | | | | Bug: 216244627 Test: atest FrameworksServicesTests:com.android.server.companion.virtual CTS-Coverage-Bug: 208247880 Change-Id: Ie1a2bc526a705f2f9788898afbff87f5a9448f85
* Merge "Add CDM CTS test modules to Test-Mapping Presubmit"Sergey Nikolaienkov2022-02-031-7/+2
|\
| * Add CDM CTS test modules to Test-Mapping PresubmitSergey Nikolaienkov2022-01-171-7/+2
| | | | | | | | | | | | | | | | | | | | | | | | 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
* | Unhide VDM API to allow / block specific activitiesMaurice Lam2022-01-271-7/+15
| | | | | | | | | | | | | | Bug: 194949534 Test: ag/15781910 CTS-Coverage-Bug: 204606917 Change-Id: I77b68bc04a7e5fd3b6d2ca3f84e5d772d6e680b2
* | Merge "Introduce COMPANION_COMPUTER profile for Phone Hub"Evan Chen2022-01-272-19/+24
|\ \
| * | Introduce COMPANION_COMPUTER profile for Phone HubEvan Chen2022-01-262-19/+24
| | | | | | | | | | | | | | | | | | Bug: 216213933 Test: atest CtsCompanionDeviceManagerCoreTestCases:DeviceProfilesTest Change-Id: I2cd6cfc5e2b9df3708fae3e4db8164e36fc9717a
* | | Merge "[CDM perm sync] Hide data transfer APIs"Guojing Yuan2022-01-271-7/+6
|\ \ \
| * | | [CDM perm sync] Hide data transfer APIsGuojing Yuan2022-01-261-7/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | | Merge "Allow VDM virtual displays to get FLAG_OWN_DISPLAY_GROUP"Maurice Lam2022-01-261-3/+1
|\ \ \ \
| * | | | Allow VDM virtual displays to get FLAG_OWN_DISPLAY_GROUPMaurice Lam2022-01-251-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | | | Merge "Unhide VDM activity APIs"TreeHugger Robot2022-01-261-14/+0
|\ \ \ \ \
| * | | | | Unhide VDM activity APIsMaurice Lam2022-01-251-14/+0
| |/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Unhiding VDM activity listener and launchPendingIntent APIs. Bug: 194949534 Test: ag/15781910 CTS-Coverage-Bug: 204606917 Change-Id: I7c8b80cf8ed99d1c2931084840b5cd4428c5b285
* / / / / Add oneway to IVirtualDeviceActivityListenerMaurice Lam2022-01-251-1/+1
|/ / / / | | | | | | | | | | | | | | | | | | | | Bug: 216200887 Test: Error logs no longer show on logcat Change-Id: I4c945ef78be9277b2c2570538138f9b8b955d7c1