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)); |
Eric Laurent | 0d13fea | 2022-11-04 17:12:08 +0100 | [diff] [blame] | 72 | |
| 73 | audio_config_base_t config = {.sample_rate = halConfig->sample_rate, |
| 74 | .channel_mask = halConfig->channel_mask, |
| 75 | .format = halConfig->format, |
| 76 | }; |
| 77 | mAudioPolicyService->registerOutput(*output, config, flags); |
Ytai Ben-Tsvi | 50e016a | 2020-11-12 14:26:12 -0800 | [diff] [blame] | 78 | } |
| 79 | return status; |
Eric Laurent | 2d388ec | 2014-03-07 13:25:54 -0800 | [diff] [blame] | 80 | } |
| 81 | |
Eric Laurent | dce54a1 | 2014-03-10 12:19:46 -0700 | [diff] [blame] | 82 | audio_io_handle_t AudioPolicyService::AudioPolicyClient::openDuplicateOutput( |
| 83 | audio_io_handle_t output1, |
| 84 | audio_io_handle_t output2) |
Eric Laurent | 2d388ec | 2014-03-07 13:25:54 -0800 | [diff] [blame] | 85 | { |
| 86 | sp<IAudioFlinger> af = AudioSystem::get_audio_flinger(); |
| 87 | if (af == 0) { |
| 88 | ALOGW("%s: could not get AudioFlinger", __func__); |
| 89 | return 0; |
| 90 | } |
| 91 | return af->openDuplicateOutput(output1, output2); |
| 92 | } |
| 93 | |
Eric Laurent | dce54a1 | 2014-03-10 12:19:46 -0700 | [diff] [blame] | 94 | status_t AudioPolicyService::AudioPolicyClient::closeOutput(audio_io_handle_t output) |
Eric Laurent | 2d388ec | 2014-03-07 13:25:54 -0800 | [diff] [blame] | 95 | { |
| 96 | sp<IAudioFlinger> af = AudioSystem::get_audio_flinger(); |
| 97 | if (af == 0) { |
| 98 | return PERMISSION_DENIED; |
| 99 | } |
Eric Laurent | 0d13fea | 2022-11-04 17:12:08 +0100 | [diff] [blame] | 100 | mAudioPolicyService->unregisterOutput(output); |
Eric Laurent | 2d388ec | 2014-03-07 13:25:54 -0800 | [diff] [blame] | 101 | return af->closeOutput(output); |
| 102 | } |
| 103 | |
Eric Laurent | dce54a1 | 2014-03-10 12:19:46 -0700 | [diff] [blame] | 104 | status_t AudioPolicyService::AudioPolicyClient::suspendOutput(audio_io_handle_t output) |
Eric Laurent | 2d388ec | 2014-03-07 13:25:54 -0800 | [diff] [blame] | 105 | { |
| 106 | sp<IAudioFlinger> af = AudioSystem::get_audio_flinger(); |
| 107 | if (af == 0) { |
| 108 | ALOGW("%s: could not get AudioFlinger", __func__); |
| 109 | return PERMISSION_DENIED; |
| 110 | } |
| 111 | |
| 112 | return af->suspendOutput(output); |
| 113 | } |
| 114 | |
Eric Laurent | dce54a1 | 2014-03-10 12:19:46 -0700 | [diff] [blame] | 115 | status_t AudioPolicyService::AudioPolicyClient::restoreOutput(audio_io_handle_t output) |
Eric Laurent | 2d388ec | 2014-03-07 13:25:54 -0800 | [diff] [blame] | 116 | { |
| 117 | sp<IAudioFlinger> af = AudioSystem::get_audio_flinger(); |
| 118 | if (af == 0) { |
| 119 | ALOGW("%s: could not get AudioFlinger", __func__); |
| 120 | return PERMISSION_DENIED; |
| 121 | } |
| 122 | |
| 123 | return af->restoreOutput(output); |
| 124 | } |
| 125 | |
Eric Laurent | cf2c021 | 2014-07-25 16:20:43 -0700 | [diff] [blame] | 126 | status_t AudioPolicyService::AudioPolicyClient::openInput(audio_module_handle_t module, |
| 127 | audio_io_handle_t *input, |
| 128 | audio_config_t *config, |
| 129 | audio_devices_t *device, |
| 130 | const String8& address, |
| 131 | audio_source_t source, |
| 132 | audio_input_flags_t flags) |
Eric Laurent | 2d388ec | 2014-03-07 13:25:54 -0800 | [diff] [blame] | 133 | { |
| 134 | sp<IAudioFlinger> af = AudioSystem::get_audio_flinger(); |
| 135 | if (af == 0) { |
| 136 | ALOGW("%s: could not get AudioFlinger", __func__); |
Eric Laurent | cf2c021 | 2014-07-25 16:20:43 -0700 | [diff] [blame] | 137 | return PERMISSION_DENIED; |
Eric Laurent | 2d388ec | 2014-03-07 13:25:54 -0800 | [diff] [blame] | 138 | } |
| 139 | |
Ytai Ben-Tsvi | 12a0b84 | 2020-11-05 13:47:32 -0800 | [diff] [blame] | 140 | AudioDeviceTypeAddr deviceTypeAddr(*device, address.c_str()); |
| 141 | |
| 142 | media::OpenInputRequest request; |
| 143 | request.module = VALUE_OR_RETURN_STATUS(legacy2aidl_audio_module_handle_t_int32_t(module)); |
| 144 | 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] | 145 | request.config = VALUE_OR_RETURN_STATUS( |
| 146 | legacy2aidl_audio_config_t_AudioConfig(*config, true /*isInput*/)); |
Ytai Ben-Tsvi | 12a0b84 | 2020-11-05 13:47:32 -0800 | [diff] [blame] | 147 | request.device = VALUE_OR_RETURN_STATUS(legacy2aidl_AudioDeviceTypeAddress(deviceTypeAddr)); |
Mikhail Naganov | ddceecc | 2021-09-03 13:58:56 -0700 | [diff] [blame] | 148 | request.source = VALUE_OR_RETURN_STATUS(legacy2aidl_audio_source_t_AudioSource(source)); |
Andy Hung | 973638a | 2020-12-08 20:47:45 -0800 | [diff] [blame] | 149 | 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] | 150 | |
| 151 | media::OpenInputResponse response; |
| 152 | status_t status = af->openInput(request, &response); |
| 153 | if (status == OK) { |
| 154 | *input = VALUE_OR_RETURN_STATUS(aidl2legacy_int32_t_audio_module_handle_t(response.input)); |
| 155 | } |
| 156 | return status; |
Eric Laurent | 2d388ec | 2014-03-07 13:25:54 -0800 | [diff] [blame] | 157 | } |
| 158 | |
Eric Laurent | dce54a1 | 2014-03-10 12:19:46 -0700 | [diff] [blame] | 159 | status_t AudioPolicyService::AudioPolicyClient::closeInput(audio_io_handle_t input) |
Eric Laurent | 2d388ec | 2014-03-07 13:25:54 -0800 | [diff] [blame] | 160 | { |
| 161 | sp<IAudioFlinger> af = AudioSystem::get_audio_flinger(); |
| 162 | if (af == 0) { |
| 163 | return PERMISSION_DENIED; |
| 164 | } |
| 165 | |
| 166 | return af->closeInput(input); |
| 167 | } |
| 168 | |
Eric Laurent | dce54a1 | 2014-03-10 12:19:46 -0700 | [diff] [blame] | 169 | status_t AudioPolicyService::AudioPolicyClient::setStreamVolume(audio_stream_type_t stream, |
| 170 | float volume, audio_io_handle_t output, |
| 171 | int delay_ms) |
| 172 | { |
| 173 | return mAudioPolicyService->setStreamVolume(stream, volume, output, |
| 174 | delay_ms); |
| 175 | } |
| 176 | |
Eric Laurent | dce54a1 | 2014-03-10 12:19:46 -0700 | [diff] [blame] | 177 | void AudioPolicyService::AudioPolicyClient::setParameters(audio_io_handle_t io_handle, |
| 178 | const String8& keyValuePairs, |
| 179 | int delay_ms) |
| 180 | { |
| 181 | mAudioPolicyService->setParameters(io_handle, keyValuePairs.string(), delay_ms); |
| 182 | } |
| 183 | |
| 184 | String8 AudioPolicyService::AudioPolicyClient::getParameters(audio_io_handle_t io_handle, |
| 185 | const String8& keys) |
| 186 | { |
| 187 | String8 result = AudioSystem::getParameters(io_handle, keys); |
| 188 | return result; |
| 189 | } |
| 190 | |
Eric Laurent | dce54a1 | 2014-03-10 12:19:46 -0700 | [diff] [blame] | 191 | status_t AudioPolicyService::AudioPolicyClient::setVoiceVolume(float volume, int delay_ms) |
| 192 | { |
| 193 | return mAudioPolicyService->setVoiceVolume(volume, delay_ms); |
| 194 | } |
| 195 | |
Glenn Kasten | d848eb4 | 2016-03-08 13:42:11 -0800 | [diff] [blame] | 196 | status_t AudioPolicyService::AudioPolicyClient::moveEffects(audio_session_t session, |
Eric Laurent | dce54a1 | 2014-03-10 12:19:46 -0700 | [diff] [blame] | 197 | audio_io_handle_t src_output, |
| 198 | audio_io_handle_t dst_output) |
Eric Laurent | 2d388ec | 2014-03-07 13:25:54 -0800 | [diff] [blame] | 199 | { |
| 200 | sp<IAudioFlinger> af = AudioSystem::get_audio_flinger(); |
| 201 | if (af == 0) { |
| 202 | return PERMISSION_DENIED; |
| 203 | } |
| 204 | |
| 205 | return af->moveEffects(session, src_output, dst_output); |
| 206 | } |
| 207 | |
Eric Laurent | b20cf7d | 2019-04-05 19:37:34 -0700 | [diff] [blame] | 208 | void AudioPolicyService::AudioPolicyClient::setEffectSuspended(int effectId, |
| 209 | audio_session_t sessionId, |
| 210 | bool suspended) |
| 211 | { |
| 212 | mAudioPolicyService->setEffectSuspended(effectId, sessionId, suspended); |
| 213 | } |
| 214 | |
Eric Laurent | 951f455 | 2014-05-20 10:48:17 -0700 | [diff] [blame] | 215 | status_t AudioPolicyService::AudioPolicyClient::createAudioPatch(const struct audio_patch *patch, |
| 216 | audio_patch_handle_t *handle, |
| 217 | int delayMs) |
| 218 | { |
| 219 | return mAudioPolicyService->clientCreateAudioPatch(patch, handle, delayMs); |
| 220 | } |
Eric Laurent | 2d388ec | 2014-03-07 13:25:54 -0800 | [diff] [blame] | 221 | |
Eric Laurent | 951f455 | 2014-05-20 10:48:17 -0700 | [diff] [blame] | 222 | status_t AudioPolicyService::AudioPolicyClient::releaseAudioPatch(audio_patch_handle_t handle, |
| 223 | int delayMs) |
| 224 | { |
| 225 | return mAudioPolicyService->clientReleaseAudioPatch(handle, delayMs); |
| 226 | } |
Eric Laurent | 2d388ec | 2014-03-07 13:25:54 -0800 | [diff] [blame] | 227 | |
Eric Laurent | e1715a4 | 2014-05-20 11:30:42 -0700 | [diff] [blame] | 228 | status_t AudioPolicyService::AudioPolicyClient::setAudioPortConfig( |
| 229 | const struct audio_port_config *config, |
| 230 | int delayMs) |
| 231 | { |
| 232 | return mAudioPolicyService->clientSetAudioPortConfig(config, delayMs); |
| 233 | } |
| 234 | |
Eric Laurent | b52c152 | 2014-05-20 11:27:36 -0700 | [diff] [blame] | 235 | void AudioPolicyService::AudioPolicyClient::onAudioPortListUpdate() |
| 236 | { |
| 237 | mAudioPolicyService->onAudioPortListUpdate(); |
| 238 | } |
| 239 | |
| 240 | void AudioPolicyService::AudioPolicyClient::onAudioPatchListUpdate() |
| 241 | { |
| 242 | mAudioPolicyService->onAudioPatchListUpdate(); |
| 243 | } |
| 244 | |
Jean-Michel Trivi | de80105 | 2015-04-14 19:10:14 -0700 | [diff] [blame] | 245 | void AudioPolicyService::AudioPolicyClient::onDynamicPolicyMixStateUpdate( |
| 246 | String8 regId, int32_t state) |
| 247 | { |
| 248 | mAudioPolicyService->onDynamicPolicyMixStateUpdate(regId, state); |
| 249 | } |
| 250 | |
Jean-Michel Trivi | 2f4fe9f | 2015-12-04 16:20:59 -0800 | [diff] [blame] | 251 | void AudioPolicyService::AudioPolicyClient::onRecordingConfigurationUpdate( |
Eric Laurent | a9f8665 | 2018-11-28 17:23:11 -0800 | [diff] [blame] | 252 | int event, |
| 253 | const record_client_info_t *clientInfo, |
| 254 | const audio_config_base_t *clientConfig, |
| 255 | std::vector<effect_descriptor_t> clientEffects, |
| 256 | const audio_config_base_t *deviceConfig, |
| 257 | std::vector<effect_descriptor_t> effects, |
| 258 | audio_patch_handle_t patchHandle, |
| 259 | audio_source_t source) |
Jean-Michel Trivi | 2f4fe9f | 2015-12-04 16:20:59 -0800 | [diff] [blame] | 260 | { |
Jean-Michel Trivi | ac4e429 | 2016-12-22 11:39:31 -0800 | [diff] [blame] | 261 | mAudioPolicyService->onRecordingConfigurationUpdate(event, clientInfo, |
Eric Laurent | a9f8665 | 2018-11-28 17:23:11 -0800 | [diff] [blame] | 262 | clientConfig, clientEffects, deviceConfig, effects, patchHandle, source); |
Jean-Michel Trivi | 2f4fe9f | 2015-12-04 16:20:59 -0800 | [diff] [blame] | 263 | } |
| 264 | |
François Gaffie | cfe1732 | 2018-11-07 13:41:29 +0100 | [diff] [blame] | 265 | void AudioPolicyService::AudioPolicyClient::onAudioVolumeGroupChanged(volume_group_t group, |
| 266 | int flags) |
| 267 | { |
| 268 | mAudioPolicyService->onAudioVolumeGroupChanged(group, flags); |
| 269 | } |
| 270 | |
Jean-Michel Trivi | 9a6b9ad | 2020-10-22 16:46:43 -0700 | [diff] [blame] | 271 | void AudioPolicyService::AudioPolicyClient::onRoutingUpdated() |
| 272 | { |
| 273 | mAudioPolicyService->onRoutingUpdated(); |
| 274 | } |
| 275 | |
Jean-Michel Trivi | 78f2b30 | 2022-04-15 18:18:41 +0000 | [diff] [blame] | 276 | void AudioPolicyService::AudioPolicyClient::onVolumeRangeInitRequest() |
| 277 | { |
| 278 | mAudioPolicyService->onVolumeRangeInitRequest(); |
| 279 | } |
| 280 | |
Glenn Kasten | eeecb98 | 2016-02-26 10:44:04 -0800 | [diff] [blame] | 281 | 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] | 282 | { |
Glenn Kasten | eeecb98 | 2016-02-26 10:44:04 -0800 | [diff] [blame] | 283 | return AudioSystem::newAudioUniqueId(use); |
Eric Laurent | de3f839 | 2014-07-27 18:38:22 -0700 | [diff] [blame] | 284 | } |
| 285 | |
Ytai Ben-Tsvi | 1ef846b | 2020-03-26 09:41:15 -0700 | [diff] [blame] | 286 | void AudioPolicyService::AudioPolicyClient::setSoundTriggerCaptureState(bool active) |
| 287 | { |
| 288 | mAudioPolicyService->mCaptureStateNotifier.setCaptureState(active); |
Ytai Ben-Tsvi | 74cd6b0 | 2019-10-25 10:06:40 -0700 | [diff] [blame] | 289 | } |
| 290 | |
jiabin | b4fed19 | 2020-09-22 14:45:40 -0700 | [diff] [blame] | 291 | status_t AudioPolicyService::AudioPolicyClient::getAudioPort(struct audio_port_v7 *port) |
| 292 | { |
| 293 | sp<IAudioFlinger> af = AudioSystem::get_audio_flinger(); |
| 294 | if (af == 0) { |
| 295 | ALOGW("%s: could not get AudioFlinger", __func__); |
| 296 | return PERMISSION_DENIED; |
| 297 | } |
| 298 | return af->getAudioPort(port); |
| 299 | } |
| 300 | |
jiabin | f042b9b | 2021-05-07 23:46:28 +0000 | [diff] [blame] | 301 | status_t AudioPolicyService::AudioPolicyClient::updateSecondaryOutputs( |
| 302 | const TrackSecondaryOutputsMap& trackSecondaryOutputs) { |
| 303 | sp<IAudioFlinger> af = AudioSystem::get_audio_flinger(); |
| 304 | if (af == nullptr) { |
| 305 | ALOGW("%s: could not get AudioFlinger", __func__); |
| 306 | return PERMISSION_DENIED; |
| 307 | } |
| 308 | return af->updateSecondaryOutputs(trackSecondaryOutputs); |
| 309 | } |
| 310 | |
Mikhail Naganov | 516d398 | 2022-02-01 23:53:59 +0000 | [diff] [blame] | 311 | status_t AudioPolicyService::AudioPolicyClient::setDeviceConnectedState( |
| 312 | const struct audio_port_v7 *port, bool connected) { |
| 313 | sp<IAudioFlinger> af = AudioSystem::get_audio_flinger(); |
| 314 | if (af == nullptr) { |
| 315 | ALOGW("%s: could not get AudioFlinger", __func__); |
| 316 | return PERMISSION_DENIED; |
| 317 | } |
| 318 | return af->setDeviceConnectedState(port, connected); |
| 319 | } |
| 320 | |
jiabin | c44b346 | 2022-12-08 12:52:31 -0800 | [diff] [blame^] | 321 | status_t AudioPolicyService::AudioPolicyClient::invalidateTracks( |
| 322 | const std::vector<audio_port_handle_t>& portIds) { |
| 323 | sp<IAudioFlinger> af = AudioSystem::get_audio_flinger(); |
| 324 | if (af == 0) { |
| 325 | return PERMISSION_DENIED; |
| 326 | } |
| 327 | |
| 328 | return af->invalidateTracks(portIds); |
| 329 | } |
| 330 | |
Mikhail Naganov | 516d398 | 2022-02-01 23:53:59 +0000 | [diff] [blame] | 331 | |
Mikhail Naganov | 1b2a794 | 2017-12-08 10:18:09 -0800 | [diff] [blame] | 332 | } // namespace android |