Eric Laurent | 2d388ec | 2014-03-07 13:25:54 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2009 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
Eric Laurent | dce54a1 | 2014-03-10 12:19:46 -0700 | [diff] [blame] | 17 | #define LOG_TAG "AudioPolicyClientImpl" |
Eric Laurent | 2d388ec | 2014-03-07 13:25:54 -0800 | [diff] [blame] | 18 | //#define LOG_NDEBUG 0 |
| 19 | |
Eric Laurent | 2d388ec | 2014-03-07 13:25:54 -0800 | [diff] [blame] | 20 | #include "AudioPolicyService.h" |
Eric Laurent | 2d388ec | 2014-03-07 13:25:54 -0800 | [diff] [blame] | 21 | |
Ytai Ben-Tsvi | 74cd6b0 | 2019-10-25 10:06:40 -0700 | [diff] [blame] | 22 | #include <utils/Log.h> |
| 23 | |
| 24 | #include "BinderProxy.h" |
| 25 | |
Eric Laurent | 2d388ec | 2014-03-07 13:25:54 -0800 | [diff] [blame] | 26 | namespace android { |
| 27 | |
Eric Laurent | dce54a1 | 2014-03-10 12:19:46 -0700 | [diff] [blame] | 28 | /* implementation of the client interface from the policy manager */ |
Eric Laurent | 2d388ec | 2014-03-07 13:25:54 -0800 | [diff] [blame] | 29 | |
Eric Laurent | dce54a1 | 2014-03-10 12:19:46 -0700 | [diff] [blame] | 30 | audio_module_handle_t AudioPolicyService::AudioPolicyClient::loadHwModule(const char *name) |
Eric Laurent | 2d388ec | 2014-03-07 13:25:54 -0800 | [diff] [blame] | 31 | { |
| 32 | sp<IAudioFlinger> af = AudioSystem::get_audio_flinger(); |
| 33 | if (af == 0) { |
| 34 | ALOGW("%s: could not get AudioFlinger", __func__); |
Glenn Kasten | a13cde9 | 2016-03-28 15:26:02 -0700 | [diff] [blame] | 35 | return AUDIO_MODULE_HANDLE_NONE; |
Eric Laurent | 2d388ec | 2014-03-07 13:25:54 -0800 | [diff] [blame] | 36 | } |
| 37 | |
| 38 | return af->loadHwModule(name); |
| 39 | } |
| 40 | |
Eric Laurent | cf2c021 | 2014-07-25 16:20:43 -0700 | [diff] [blame] | 41 | status_t AudioPolicyService::AudioPolicyClient::openOutput(audio_module_handle_t module, |
| 42 | audio_io_handle_t *output, |
Eric Laurent | f1f22e7 | 2021-07-13 14:04:14 +0200 | [diff] [blame] | 43 | audio_config_t *halConfig, |
| 44 | audio_config_base_t *mixerConfig, |
jiabin | 4381040 | 2019-10-24 14:58:31 -0700 | [diff] [blame] | 45 | const sp<DeviceDescriptorBase>& device, |
Eric Laurent | cf2c021 | 2014-07-25 16:20:43 -0700 | [diff] [blame] | 46 | uint32_t *latencyMs, |
| 47 | audio_output_flags_t flags) |
Eric Laurent | 2d388ec | 2014-03-07 13:25:54 -0800 | [diff] [blame] | 48 | { |
| 49 | sp<IAudioFlinger> af = AudioSystem::get_audio_flinger(); |
| 50 | if (af == 0) { |
| 51 | ALOGW("%s: could not get AudioFlinger", __func__); |
Eric Laurent | cf2c021 | 2014-07-25 16:20:43 -0700 | [diff] [blame] | 52 | return PERMISSION_DENIED; |
Eric Laurent | 2d388ec | 2014-03-07 13:25:54 -0800 | [diff] [blame] | 53 | } |
Ytai Ben-Tsvi | 50e016a | 2020-11-12 14:26:12 -0800 | [diff] [blame] | 54 | |
| 55 | media::OpenOutputRequest request; |
| 56 | media::OpenOutputResponse response; |
| 57 | |
| 58 | request.module = VALUE_OR_RETURN_STATUS(legacy2aidl_audio_module_handle_t_int32_t(module)); |
Mikhail Naganov | de3fa18 | 2021-07-30 15:06:42 -0700 | [diff] [blame] | 59 | request.halConfig = VALUE_OR_RETURN_STATUS( |
| 60 | legacy2aidl_audio_config_t_AudioConfig(*halConfig, false /*isInput*/)); |
| 61 | request.mixerConfig = VALUE_OR_RETURN_STATUS( |
| 62 | legacy2aidl_audio_config_base_t_AudioConfigBase(*mixerConfig, false /*isInput*/)); |
Ytai Ben-Tsvi | 50e016a | 2020-11-12 14:26:12 -0800 | [diff] [blame] | 63 | request.device = VALUE_OR_RETURN_STATUS(legacy2aidl_DeviceDescriptorBase(device)); |
Andy Hung | 973638a | 2020-12-08 20:47:45 -0800 | [diff] [blame] | 64 | request.flags = VALUE_OR_RETURN_STATUS(legacy2aidl_audio_output_flags_t_int32_t_mask(flags)); |
Ytai Ben-Tsvi | 50e016a | 2020-11-12 14:26:12 -0800 | [diff] [blame] | 65 | |
| 66 | status_t status = af->openOutput(request, &response); |
| 67 | if (status == OK) { |
| 68 | *output = VALUE_OR_RETURN_STATUS(aidl2legacy_int32_t_audio_io_handle_t(response.output)); |
Mikhail Naganov | de3fa18 | 2021-07-30 15:06:42 -0700 | [diff] [blame] | 69 | *halConfig = VALUE_OR_RETURN_STATUS( |
| 70 | aidl2legacy_AudioConfig_audio_config_t(response.config, false /*isInput*/)); |
Ytai Ben-Tsvi | 50e016a | 2020-11-12 14:26:12 -0800 | [diff] [blame] | 71 | *latencyMs = VALUE_OR_RETURN_STATUS(convertIntegral<uint32_t>(response.latencyMs)); |
| 72 | } |
| 73 | return status; |
Eric Laurent | 2d388ec | 2014-03-07 13:25:54 -0800 | [diff] [blame] | 74 | } |
| 75 | |
Eric Laurent | dce54a1 | 2014-03-10 12:19:46 -0700 | [diff] [blame] | 76 | audio_io_handle_t AudioPolicyService::AudioPolicyClient::openDuplicateOutput( |
| 77 | audio_io_handle_t output1, |
| 78 | audio_io_handle_t output2) |
Eric Laurent | 2d388ec | 2014-03-07 13:25:54 -0800 | [diff] [blame] | 79 | { |
| 80 | sp<IAudioFlinger> af = AudioSystem::get_audio_flinger(); |
| 81 | if (af == 0) { |
| 82 | ALOGW("%s: could not get AudioFlinger", __func__); |
| 83 | return 0; |
| 84 | } |
| 85 | return af->openDuplicateOutput(output1, output2); |
| 86 | } |
| 87 | |
Eric Laurent | dce54a1 | 2014-03-10 12:19:46 -0700 | [diff] [blame] | 88 | status_t AudioPolicyService::AudioPolicyClient::closeOutput(audio_io_handle_t output) |
Eric Laurent | 2d388ec | 2014-03-07 13:25:54 -0800 | [diff] [blame] | 89 | { |
| 90 | sp<IAudioFlinger> af = AudioSystem::get_audio_flinger(); |
| 91 | if (af == 0) { |
| 92 | return PERMISSION_DENIED; |
| 93 | } |
| 94 | |
| 95 | return af->closeOutput(output); |
| 96 | } |
| 97 | |
Eric Laurent | dce54a1 | 2014-03-10 12:19:46 -0700 | [diff] [blame] | 98 | status_t AudioPolicyService::AudioPolicyClient::suspendOutput(audio_io_handle_t output) |
Eric Laurent | 2d388ec | 2014-03-07 13:25:54 -0800 | [diff] [blame] | 99 | { |
| 100 | sp<IAudioFlinger> af = AudioSystem::get_audio_flinger(); |
| 101 | if (af == 0) { |
| 102 | ALOGW("%s: could not get AudioFlinger", __func__); |
| 103 | return PERMISSION_DENIED; |
| 104 | } |
| 105 | |
| 106 | return af->suspendOutput(output); |
| 107 | } |
| 108 | |
Eric Laurent | dce54a1 | 2014-03-10 12:19:46 -0700 | [diff] [blame] | 109 | status_t AudioPolicyService::AudioPolicyClient::restoreOutput(audio_io_handle_t output) |
Eric Laurent | 2d388ec | 2014-03-07 13:25:54 -0800 | [diff] [blame] | 110 | { |
| 111 | sp<IAudioFlinger> af = AudioSystem::get_audio_flinger(); |
| 112 | if (af == 0) { |
| 113 | ALOGW("%s: could not get AudioFlinger", __func__); |
| 114 | return PERMISSION_DENIED; |
| 115 | } |
| 116 | |
| 117 | return af->restoreOutput(output); |
| 118 | } |
| 119 | |
Eric Laurent | cf2c021 | 2014-07-25 16:20:43 -0700 | [diff] [blame] | 120 | status_t AudioPolicyService::AudioPolicyClient::openInput(audio_module_handle_t module, |
| 121 | audio_io_handle_t *input, |
| 122 | audio_config_t *config, |
| 123 | audio_devices_t *device, |
| 124 | const String8& address, |
| 125 | audio_source_t source, |
| 126 | audio_input_flags_t flags) |
Eric Laurent | 2d388ec | 2014-03-07 13:25:54 -0800 | [diff] [blame] | 127 | { |
| 128 | sp<IAudioFlinger> af = AudioSystem::get_audio_flinger(); |
| 129 | if (af == 0) { |
| 130 | ALOGW("%s: could not get AudioFlinger", __func__); |
Eric Laurent | cf2c021 | 2014-07-25 16:20:43 -0700 | [diff] [blame] | 131 | return PERMISSION_DENIED; |
Eric Laurent | 2d388ec | 2014-03-07 13:25:54 -0800 | [diff] [blame] | 132 | } |
| 133 | |
Ytai Ben-Tsvi | 12a0b84 | 2020-11-05 13:47:32 -0800 | [diff] [blame] | 134 | AudioDeviceTypeAddr deviceTypeAddr(*device, address.c_str()); |
| 135 | |
| 136 | media::OpenInputRequest request; |
| 137 | request.module = VALUE_OR_RETURN_STATUS(legacy2aidl_audio_module_handle_t_int32_t(module)); |
| 138 | request.input = VALUE_OR_RETURN_STATUS(legacy2aidl_audio_io_handle_t_int32_t(*input)); |
Mikhail Naganov | de3fa18 | 2021-07-30 15:06:42 -0700 | [diff] [blame] | 139 | request.config = VALUE_OR_RETURN_STATUS( |
| 140 | legacy2aidl_audio_config_t_AudioConfig(*config, true /*isInput*/)); |
Ytai Ben-Tsvi | 12a0b84 | 2020-11-05 13:47:32 -0800 | [diff] [blame] | 141 | request.device = VALUE_OR_RETURN_STATUS(legacy2aidl_AudioDeviceTypeAddress(deviceTypeAddr)); |
Mikhail Naganov | ddceecc | 2021-09-03 13:58:56 -0700 | [diff] [blame] | 142 | request.source = VALUE_OR_RETURN_STATUS(legacy2aidl_audio_source_t_AudioSource(source)); |
Andy Hung | 973638a | 2020-12-08 20:47:45 -0800 | [diff] [blame] | 143 | request.flags = VALUE_OR_RETURN_STATUS(legacy2aidl_audio_input_flags_t_int32_t_mask(flags)); |
Ytai Ben-Tsvi | 12a0b84 | 2020-11-05 13:47:32 -0800 | [diff] [blame] | 144 | |
| 145 | media::OpenInputResponse response; |
| 146 | status_t status = af->openInput(request, &response); |
| 147 | if (status == OK) { |
| 148 | *input = VALUE_OR_RETURN_STATUS(aidl2legacy_int32_t_audio_module_handle_t(response.input)); |
| 149 | } |
| 150 | return status; |
Eric Laurent | 2d388ec | 2014-03-07 13:25:54 -0800 | [diff] [blame] | 151 | } |
| 152 | |
Eric Laurent | dce54a1 | 2014-03-10 12:19:46 -0700 | [diff] [blame] | 153 | status_t AudioPolicyService::AudioPolicyClient::closeInput(audio_io_handle_t input) |
Eric Laurent | 2d388ec | 2014-03-07 13:25:54 -0800 | [diff] [blame] | 154 | { |
| 155 | sp<IAudioFlinger> af = AudioSystem::get_audio_flinger(); |
| 156 | if (af == 0) { |
| 157 | return PERMISSION_DENIED; |
| 158 | } |
| 159 | |
| 160 | return af->closeInput(input); |
| 161 | } |
| 162 | |
Eric Laurent | dce54a1 | 2014-03-10 12:19:46 -0700 | [diff] [blame] | 163 | status_t AudioPolicyService::AudioPolicyClient::setStreamVolume(audio_stream_type_t stream, |
| 164 | float volume, audio_io_handle_t output, |
| 165 | int delay_ms) |
| 166 | { |
| 167 | return mAudioPolicyService->setStreamVolume(stream, volume, output, |
| 168 | delay_ms); |
| 169 | } |
| 170 | |
| 171 | status_t AudioPolicyService::AudioPolicyClient::invalidateStream(audio_stream_type_t stream) |
Eric Laurent | 2d388ec | 2014-03-07 13:25:54 -0800 | [diff] [blame] | 172 | { |
| 173 | sp<IAudioFlinger> af = AudioSystem::get_audio_flinger(); |
| 174 | if (af == 0) { |
| 175 | return PERMISSION_DENIED; |
| 176 | } |
| 177 | |
| 178 | return af->invalidateStream(stream); |
| 179 | } |
| 180 | |
Eric Laurent | dce54a1 | 2014-03-10 12:19:46 -0700 | [diff] [blame] | 181 | void AudioPolicyService::AudioPolicyClient::setParameters(audio_io_handle_t io_handle, |
| 182 | const String8& keyValuePairs, |
| 183 | int delay_ms) |
| 184 | { |
| 185 | mAudioPolicyService->setParameters(io_handle, keyValuePairs.string(), delay_ms); |
| 186 | } |
| 187 | |
| 188 | String8 AudioPolicyService::AudioPolicyClient::getParameters(audio_io_handle_t io_handle, |
| 189 | const String8& keys) |
| 190 | { |
| 191 | String8 result = AudioSystem::getParameters(io_handle, keys); |
| 192 | return result; |
| 193 | } |
| 194 | |
Eric Laurent | dce54a1 | 2014-03-10 12:19:46 -0700 | [diff] [blame] | 195 | status_t AudioPolicyService::AudioPolicyClient::setVoiceVolume(float volume, int delay_ms) |
| 196 | { |
| 197 | return mAudioPolicyService->setVoiceVolume(volume, delay_ms); |
| 198 | } |
| 199 | |
Glenn Kasten | d848eb4 | 2016-03-08 13:42:11 -0800 | [diff] [blame] | 200 | status_t AudioPolicyService::AudioPolicyClient::moveEffects(audio_session_t session, |
Eric Laurent | dce54a1 | 2014-03-10 12:19:46 -0700 | [diff] [blame] | 201 | audio_io_handle_t src_output, |
| 202 | audio_io_handle_t dst_output) |
Eric Laurent | 2d388ec | 2014-03-07 13:25:54 -0800 | [diff] [blame] | 203 | { |
| 204 | sp<IAudioFlinger> af = AudioSystem::get_audio_flinger(); |
| 205 | if (af == 0) { |
| 206 | return PERMISSION_DENIED; |
| 207 | } |
| 208 | |
| 209 | return af->moveEffects(session, src_output, dst_output); |
| 210 | } |
| 211 | |
Eric Laurent | b20cf7d | 2019-04-05 19:37:34 -0700 | [diff] [blame] | 212 | void AudioPolicyService::AudioPolicyClient::setEffectSuspended(int effectId, |
| 213 | audio_session_t sessionId, |
| 214 | bool suspended) |
| 215 | { |
| 216 | mAudioPolicyService->setEffectSuspended(effectId, sessionId, suspended); |
| 217 | } |
| 218 | |
Eric Laurent | 951f455 | 2014-05-20 10:48:17 -0700 | [diff] [blame] | 219 | status_t AudioPolicyService::AudioPolicyClient::createAudioPatch(const struct audio_patch *patch, |
| 220 | audio_patch_handle_t *handle, |
| 221 | int delayMs) |
| 222 | { |
| 223 | return mAudioPolicyService->clientCreateAudioPatch(patch, handle, delayMs); |
| 224 | } |
Eric Laurent | 2d388ec | 2014-03-07 13:25:54 -0800 | [diff] [blame] | 225 | |
Eric Laurent | 951f455 | 2014-05-20 10:48:17 -0700 | [diff] [blame] | 226 | status_t AudioPolicyService::AudioPolicyClient::releaseAudioPatch(audio_patch_handle_t handle, |
| 227 | int delayMs) |
| 228 | { |
| 229 | return mAudioPolicyService->clientReleaseAudioPatch(handle, delayMs); |
| 230 | } |
Eric Laurent | 2d388ec | 2014-03-07 13:25:54 -0800 | [diff] [blame] | 231 | |
Eric Laurent | e1715a4 | 2014-05-20 11:30:42 -0700 | [diff] [blame] | 232 | status_t AudioPolicyService::AudioPolicyClient::setAudioPortConfig( |
| 233 | const struct audio_port_config *config, |
| 234 | int delayMs) |
| 235 | { |
| 236 | return mAudioPolicyService->clientSetAudioPortConfig(config, delayMs); |
| 237 | } |
| 238 | |
Eric Laurent | b52c152 | 2014-05-20 11:27:36 -0700 | [diff] [blame] | 239 | void AudioPolicyService::AudioPolicyClient::onAudioPortListUpdate() |
| 240 | { |
| 241 | mAudioPolicyService->onAudioPortListUpdate(); |
| 242 | } |
| 243 | |
| 244 | void AudioPolicyService::AudioPolicyClient::onAudioPatchListUpdate() |
| 245 | { |
| 246 | mAudioPolicyService->onAudioPatchListUpdate(); |
| 247 | } |
| 248 | |
Jean-Michel Trivi | de80105 | 2015-04-14 19:10:14 -0700 | [diff] [blame] | 249 | void AudioPolicyService::AudioPolicyClient::onDynamicPolicyMixStateUpdate( |
| 250 | String8 regId, int32_t state) |
| 251 | { |
| 252 | mAudioPolicyService->onDynamicPolicyMixStateUpdate(regId, state); |
| 253 | } |
| 254 | |
Jean-Michel Trivi | 2f4fe9f | 2015-12-04 16:20:59 -0800 | [diff] [blame] | 255 | void AudioPolicyService::AudioPolicyClient::onRecordingConfigurationUpdate( |
Eric Laurent | a9f8665 | 2018-11-28 17:23:11 -0800 | [diff] [blame] | 256 | int event, |
| 257 | const record_client_info_t *clientInfo, |
| 258 | const audio_config_base_t *clientConfig, |
| 259 | std::vector<effect_descriptor_t> clientEffects, |
| 260 | const audio_config_base_t *deviceConfig, |
| 261 | std::vector<effect_descriptor_t> effects, |
| 262 | audio_patch_handle_t patchHandle, |
| 263 | audio_source_t source) |
Jean-Michel Trivi | 2f4fe9f | 2015-12-04 16:20:59 -0800 | [diff] [blame] | 264 | { |
Jean-Michel Trivi | ac4e429 | 2016-12-22 11:39:31 -0800 | [diff] [blame] | 265 | mAudioPolicyService->onRecordingConfigurationUpdate(event, clientInfo, |
Eric Laurent | a9f8665 | 2018-11-28 17:23:11 -0800 | [diff] [blame] | 266 | clientConfig, clientEffects, deviceConfig, effects, patchHandle, source); |
Jean-Michel Trivi | 2f4fe9f | 2015-12-04 16:20:59 -0800 | [diff] [blame] | 267 | } |
| 268 | |
François Gaffie | cfe1732 | 2018-11-07 13:41:29 +0100 | [diff] [blame] | 269 | void AudioPolicyService::AudioPolicyClient::onAudioVolumeGroupChanged(volume_group_t group, |
| 270 | int flags) |
| 271 | { |
| 272 | mAudioPolicyService->onAudioVolumeGroupChanged(group, flags); |
| 273 | } |
| 274 | |
Jean-Michel Trivi | 9a6b9ad | 2020-10-22 16:46:43 -0700 | [diff] [blame] | 275 | void AudioPolicyService::AudioPolicyClient::onRoutingUpdated() |
| 276 | { |
| 277 | mAudioPolicyService->onRoutingUpdated(); |
| 278 | } |
| 279 | |
Jean-Michel Trivi | 78f2b30 | 2022-04-15 18:18:41 +0000 | [diff] [blame] | 280 | void AudioPolicyService::AudioPolicyClient::onVolumeRangeInitRequest() |
| 281 | { |
| 282 | mAudioPolicyService->onVolumeRangeInitRequest(); |
| 283 | } |
| 284 | |
Glenn Kasten | eeecb98 | 2016-02-26 10:44:04 -0800 | [diff] [blame] | 285 | audio_unique_id_t AudioPolicyService::AudioPolicyClient::newAudioUniqueId(audio_unique_id_use_t use) |
Eric Laurent | de3f839 | 2014-07-27 18:38:22 -0700 | [diff] [blame] | 286 | { |
Glenn Kasten | eeecb98 | 2016-02-26 10:44:04 -0800 | [diff] [blame] | 287 | return AudioSystem::newAudioUniqueId(use); |
Eric Laurent | de3f839 | 2014-07-27 18:38:22 -0700 | [diff] [blame] | 288 | } |
| 289 | |
Ytai Ben-Tsvi | 1ef846b | 2020-03-26 09:41:15 -0700 | [diff] [blame] | 290 | void AudioPolicyService::AudioPolicyClient::setSoundTriggerCaptureState(bool active) |
| 291 | { |
| 292 | mAudioPolicyService->mCaptureStateNotifier.setCaptureState(active); |
Ytai Ben-Tsvi | 74cd6b0 | 2019-10-25 10:06:40 -0700 | [diff] [blame] | 293 | } |
| 294 | |
jiabin | b4fed19 | 2020-09-22 14:45:40 -0700 | [diff] [blame] | 295 | status_t AudioPolicyService::AudioPolicyClient::getAudioPort(struct audio_port_v7 *port) |
| 296 | { |
| 297 | sp<IAudioFlinger> af = AudioSystem::get_audio_flinger(); |
| 298 | if (af == 0) { |
| 299 | ALOGW("%s: could not get AudioFlinger", __func__); |
| 300 | return PERMISSION_DENIED; |
| 301 | } |
| 302 | return af->getAudioPort(port); |
| 303 | } |
| 304 | |
jiabin | f042b9b | 2021-05-07 23:46:28 +0000 | [diff] [blame] | 305 | status_t AudioPolicyService::AudioPolicyClient::updateSecondaryOutputs( |
| 306 | const TrackSecondaryOutputsMap& trackSecondaryOutputs) { |
| 307 | sp<IAudioFlinger> af = AudioSystem::get_audio_flinger(); |
| 308 | if (af == nullptr) { |
| 309 | ALOGW("%s: could not get AudioFlinger", __func__); |
| 310 | return PERMISSION_DENIED; |
| 311 | } |
| 312 | return af->updateSecondaryOutputs(trackSecondaryOutputs); |
| 313 | } |
| 314 | |
Mikhail Naganov | 516d398 | 2022-02-01 23:53:59 +0000 | [diff] [blame] | 315 | status_t AudioPolicyService::AudioPolicyClient::setDeviceConnectedState( |
jiabin | 872de70 | 2023-04-27 22:04:31 +0000 | [diff] [blame] | 316 | const struct audio_port_v7 *port, media::DeviceConnectedState state) { |
Mikhail Naganov | 516d398 | 2022-02-01 23:53:59 +0000 | [diff] [blame] | 317 | sp<IAudioFlinger> af = AudioSystem::get_audio_flinger(); |
| 318 | if (af == nullptr) { |
| 319 | ALOGW("%s: could not get AudioFlinger", __func__); |
| 320 | return PERMISSION_DENIED; |
| 321 | } |
jiabin | 872de70 | 2023-04-27 22:04:31 +0000 | [diff] [blame] | 322 | return af->setDeviceConnectedState(port, state); |
Mikhail Naganov | 516d398 | 2022-02-01 23:53:59 +0000 | [diff] [blame] | 323 | } |
| 324 | |
Mikhail Naganov | 1b2a794 | 2017-12-08 10:18:09 -0800 | [diff] [blame] | 325 | } // namespace android |