Expose API to set audio device as non-default playback
Bug: 259094683
Test: atest AudioServiceHostTest AudioHostTest
Change-Id: I3120a7b46675925497187614db8fbeb4d24572a8
diff --git a/media/libaudioclient/AudioSystem.cpp b/media/libaudioclient/AudioSystem.cpp
index ad03711..f7e15fc 100644
--- a/media/libaudioclient/AudioSystem.cpp
+++ b/media/libaudioclient/AudioSystem.cpp
@@ -2223,8 +2223,25 @@
aps->setDevicesRoleForStrategy(strategyAidl, roleAidl, devicesAidl));
}
+status_t AudioSystem::removeDevicesRoleForStrategy(product_strategy_t strategy,
+ device_role_t role,
+ const AudioDeviceTypeAddrVector& devices) {
+ const sp<IAudioPolicyService>& aps = AudioSystem::get_audio_policy_service();
+ if (aps == 0) {
+ return PERMISSION_DENIED;
+ }
+
+ int32_t strategyAidl = VALUE_OR_RETURN_STATUS(legacy2aidl_product_strategy_t_int32_t(strategy));
+ media::DeviceRole roleAidl = VALUE_OR_RETURN_STATUS(legacy2aidl_device_role_t_DeviceRole(role));
+ std::vector<AudioDevice> devicesAidl = VALUE_OR_RETURN_STATUS(
+ convertContainer<std::vector<AudioDevice>>(devices,
+ legacy2aidl_AudioDeviceTypeAddress));
+ return statusTFromBinderStatus(
+ aps->removeDevicesRoleForStrategy(strategyAidl, roleAidl, devicesAidl));
+}
+
status_t
-AudioSystem::removeDevicesRoleForStrategy(product_strategy_t strategy, device_role_t role) {
+AudioSystem::clearDevicesRoleForStrategy(product_strategy_t strategy, device_role_t role) {
const sp<IAudioPolicyService>& aps = AudioSystem::get_audio_policy_service();
if (aps == 0) {
return PERMISSION_DENIED;
@@ -2232,7 +2249,7 @@
int32_t strategyAidl = VALUE_OR_RETURN_STATUS(legacy2aidl_product_strategy_t_int32_t(strategy));
media::DeviceRole roleAidl = VALUE_OR_RETURN_STATUS(legacy2aidl_device_role_t_DeviceRole(role));
return statusTFromBinderStatus(
- aps->removeDevicesRoleForStrategy(strategyAidl, roleAidl));
+ aps->clearDevicesRoleForStrategy(strategyAidl, roleAidl));
}
status_t AudioSystem::getDevicesForRoleAndStrategy(product_strategy_t strategy,