1 /*
2 * Copyright (c) 2021-2022 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16 #include "audio_errors.h"
17 #include "audio_policy_server.h"
18 #include "audio_policy_types.h"
19 #include "audio_log.h"
20 #include "audio_policy_manager_stub.h"
21
22 namespace OHOS {
23 namespace AudioStandard {
24 using namespace std;
25
ReadAudioInterruptParams(MessageParcel & data,AudioInterrupt & audioInterrupt)26 void AudioPolicyManagerStub::ReadAudioInterruptParams(MessageParcel &data, AudioInterrupt &audioInterrupt)
27 {
28 audioInterrupt.streamUsage = static_cast<StreamUsage>(data.ReadInt32());
29 audioInterrupt.contentType = static_cast<ContentType>(data.ReadInt32());
30 audioInterrupt.streamType = static_cast<AudioStreamType>(data.ReadInt32());
31 audioInterrupt.sessionID = data.ReadUint32();
32 }
33
ReadAudioManagerInterruptParams(MessageParcel & data,AudioInterrupt & audioInterrupt)34 void AudioPolicyManagerStub::ReadAudioManagerInterruptParams(MessageParcel &data, AudioInterrupt &audioInterrupt)
35 {
36 audioInterrupt.streamUsage = static_cast<StreamUsage>(data.ReadInt32());
37 audioInterrupt.contentType = static_cast<ContentType>(data.ReadInt32());
38 audioInterrupt.streamType = static_cast<AudioStreamType>(data.ReadInt32());
39 audioInterrupt.pauseWhenDucked = data.ReadBool();
40 }
41
WriteAudioInteruptParams(MessageParcel & reply,const AudioInterrupt & audioInterrupt)42 void AudioPolicyManagerStub::WriteAudioInteruptParams(MessageParcel &reply, const AudioInterrupt &audioInterrupt)
43 {
44 reply.WriteInt32(static_cast<int32_t>(audioInterrupt.streamUsage));
45 reply.WriteInt32(static_cast<int32_t>(audioInterrupt.contentType));
46 reply.WriteInt32(static_cast<int32_t>(audioInterrupt.streamType));
47 reply.WriteUint32(audioInterrupt.sessionID);
48 }
49
ReadStreamChangeInfo(MessageParcel & data,const AudioMode & mode,AudioStreamChangeInfo & streamChangeInfo)50 void AudioPolicyManagerStub::ReadStreamChangeInfo(MessageParcel &data, const AudioMode &mode,
51 AudioStreamChangeInfo &streamChangeInfo)
52 {
53 if (mode == AUDIO_MODE_PLAYBACK) {
54 streamChangeInfo.audioRendererChangeInfo.sessionId = data.ReadInt32();
55 streamChangeInfo.audioRendererChangeInfo.rendererState = static_cast<RendererState>(data.ReadInt32());
56 streamChangeInfo.audioRendererChangeInfo.clientUID = data.ReadInt32();
57 streamChangeInfo.audioRendererChangeInfo.rendererInfo.contentType = static_cast<ContentType>(data.ReadInt32());
58 streamChangeInfo.audioRendererChangeInfo.rendererInfo.streamUsage = static_cast<StreamUsage>(data.ReadInt32());
59 streamChangeInfo.audioRendererChangeInfo.rendererInfo.rendererFlags = data.ReadInt32();
60 return;
61 } else {
62 // mode == AUDIO_MODE_RECORDING
63 streamChangeInfo.audioCapturerChangeInfo.sessionId = data.ReadInt32();
64 streamChangeInfo.audioCapturerChangeInfo.capturerState = static_cast<CapturerState>(data.ReadInt32());
65 streamChangeInfo.audioCapturerChangeInfo.clientUID = data.ReadInt32();
66 streamChangeInfo.audioCapturerChangeInfo.capturerInfo.sourceType = static_cast<SourceType>(data.ReadInt32());
67 streamChangeInfo.audioCapturerChangeInfo.capturerInfo.capturerFlags = data.ReadInt32();
68 }
69 }
70
SetStreamVolumeInternal(MessageParcel & data,MessageParcel & reply)71 void AudioPolicyManagerStub::SetStreamVolumeInternal(MessageParcel &data, MessageParcel &reply)
72 {
73 AudioStreamType streamType = static_cast<AudioStreamType>(data.ReadInt32());
74 float volume = data.ReadFloat();
75 int result = SetStreamVolume(streamType, volume);
76 if (result == SUCCESS)
77 reply.WriteInt32(AUDIO_OK);
78 else
79 reply.WriteInt32(AUDIO_ERR);
80 }
81
SetRingerModeInternal(MessageParcel & data,MessageParcel & reply)82 void AudioPolicyManagerStub::SetRingerModeInternal(MessageParcel &data, MessageParcel &reply)
83 {
84 AudioRingerMode rMode = static_cast<AudioRingerMode>(data.ReadInt32());
85 int32_t result = SetRingerMode(rMode);
86 reply.WriteInt32(result);
87 }
88
GetToneInfoInternal(MessageParcel & data,MessageParcel & reply)89 void AudioPolicyManagerStub::GetToneInfoInternal(MessageParcel &data, MessageParcel &reply)
90 {
91 std::shared_ptr<ToneInfo> ltoneInfo = GetToneConfig(data.ReadInt32());
92 if (ltoneInfo == nullptr) {
93 AUDIO_ERR_LOG("AudioPolicyManagerStub: GetToneInfoInternal obj is null");
94 return;
95 }
96 reply.WriteUint32(ltoneInfo->segmentCnt);
97 reply.WriteUint32(ltoneInfo->repeatCnt);
98 reply.WriteUint32(ltoneInfo->repeatSegment);
99 for (uint32_t i = 0; i < ltoneInfo->segmentCnt; i++) {
100 reply.WriteUint32(ltoneInfo->segments[i].duration);
101 reply.WriteUint16(ltoneInfo->segments[i].loopCnt);
102 reply.WriteUint16(ltoneInfo->segments[i].loopIndx);
103 for (uint32_t j = 0; j < TONEINFO_MAX_WAVES + 1; j++) {
104 reply.WriteUint16(ltoneInfo->segments[i].waveFreq[j]);
105 }
106 }
107 }
108
GetSupportedTonesInternal(MessageParcel & data,MessageParcel & reply)109 void AudioPolicyManagerStub::GetSupportedTonesInternal(MessageParcel &data, MessageParcel &reply)
110 {
111 int32_t lToneListSize = 0;
112 std::vector<int32_t> lToneList = GetSupportedTones();
113 lToneListSize = static_cast<int32_t>(lToneList.size());
114 reply.WriteInt32(lToneListSize);
115 for (int i = 0; i < lToneListSize; i++) {
116 reply.WriteInt32(lToneList[i]);
117 }
118 }
119
GetRingerModeInternal(MessageParcel & reply)120 void AudioPolicyManagerStub::GetRingerModeInternal(MessageParcel &reply)
121 {
122 AudioRingerMode rMode = GetRingerMode();
123 reply.WriteInt32(static_cast<int>(rMode));
124 }
125
SetAudioSceneInternal(MessageParcel & data,MessageParcel & reply)126 void AudioPolicyManagerStub::SetAudioSceneInternal(MessageParcel &data, MessageParcel &reply)
127 {
128 AudioScene audioScene = static_cast<AudioScene>(data.ReadInt32());
129 int32_t result = SetAudioScene(audioScene);
130 reply.WriteInt32(result);
131 }
132
SetMicrophoneMuteInternal(MessageParcel & data,MessageParcel & reply)133 void AudioPolicyManagerStub::SetMicrophoneMuteInternal(MessageParcel &data, MessageParcel &reply)
134 {
135 bool isMute = data.ReadBool();
136 int32_t result = SetMicrophoneMute(isMute);
137 reply.WriteInt32(result);
138 }
139
SetMicrophoneMuteAudioConfigInternal(MessageParcel & data,MessageParcel & reply)140 void AudioPolicyManagerStub::SetMicrophoneMuteAudioConfigInternal(MessageParcel &data, MessageParcel &reply)
141 {
142 bool isMute = data.ReadBool();
143 int32_t result = SetMicrophoneMuteAudioConfig(isMute);
144 reply.WriteInt32(result);
145 }
146
IsMicrophoneMuteInternal(MessageParcel & data,MessageParcel & reply)147 void AudioPolicyManagerStub::IsMicrophoneMuteInternal(MessageParcel &data, MessageParcel &reply)
148 {
149 API_VERSION api_v = static_cast<API_VERSION>(data.ReadInt32());
150 int32_t result = IsMicrophoneMute(api_v);
151 reply.WriteBool(result);
152 }
153
GetAudioSceneInternal(MessageParcel & reply)154 void AudioPolicyManagerStub::GetAudioSceneInternal(MessageParcel &reply)
155 {
156 AudioScene audioScene = GetAudioScene();
157 reply.WriteInt32(static_cast<int>(audioScene));
158 }
159
GetStreamVolumeInternal(MessageParcel & data,MessageParcel & reply)160 void AudioPolicyManagerStub::GetStreamVolumeInternal(MessageParcel &data, MessageParcel &reply)
161 {
162 AudioStreamType streamType = static_cast<AudioStreamType>(data.ReadInt32());
163 float volume = GetStreamVolume(streamType);
164 reply.WriteFloat(volume);
165 }
166
SetLowPowerVolumeInternal(MessageParcel & data,MessageParcel & reply)167 void AudioPolicyManagerStub::SetLowPowerVolumeInternal(MessageParcel &data, MessageParcel &reply)
168 {
169 int32_t streamId = data.ReadInt32();
170 float volume = data.ReadFloat();
171 int result = SetLowPowerVolume(streamId, volume);
172 if (result == SUCCESS)
173 reply.WriteInt32(AUDIO_OK);
174 else
175 reply.WriteInt32(AUDIO_ERR);
176 }
177
GetLowPowerVolumeInternal(MessageParcel & data,MessageParcel & reply)178 void AudioPolicyManagerStub::GetLowPowerVolumeInternal(MessageParcel &data, MessageParcel &reply)
179 {
180 int32_t streamId = data.ReadInt32();
181 float volume = GetLowPowerVolume(streamId);
182 reply.WriteFloat(volume);
183 }
184
GetSingleStreamVolumeInternal(MessageParcel & data,MessageParcel & reply)185 void AudioPolicyManagerStub::GetSingleStreamVolumeInternal(MessageParcel &data, MessageParcel &reply)
186 {
187 int32_t streamId = data.ReadInt32();
188 float volume = GetSingleStreamVolume(streamId);
189 reply.WriteFloat(volume);
190 }
191
SetStreamMuteInternal(MessageParcel & data,MessageParcel & reply)192 void AudioPolicyManagerStub::SetStreamMuteInternal(MessageParcel &data, MessageParcel &reply)
193 {
194 AudioStreamType streamType = static_cast<AudioStreamType>(data.ReadInt32());
195 bool mute = data.ReadBool();
196 int result = SetStreamMute(streamType, mute);
197 if (result == SUCCESS)
198 reply.WriteInt32(AUDIO_OK);
199 else
200 reply.WriteInt32(AUDIO_ERR);
201 }
202
GetStreamMuteInternal(MessageParcel & data,MessageParcel & reply)203 void AudioPolicyManagerStub::GetStreamMuteInternal(MessageParcel &data, MessageParcel &reply)
204 {
205 AudioStreamType streamType = static_cast<AudioStreamType>(data.ReadInt32());
206 bool mute = GetStreamMute(streamType);
207 reply.WriteBool(mute);
208 }
209
IsStreamActiveInternal(MessageParcel & data,MessageParcel & reply)210 void AudioPolicyManagerStub::IsStreamActiveInternal(MessageParcel &data, MessageParcel &reply)
211 {
212 AudioStreamType streamType = static_cast<AudioStreamType>(data.ReadInt32());
213 bool isActive = IsStreamActive(streamType);
214 reply.WriteBool(isActive);
215 }
216
GetDevicesInternal(MessageParcel & data,MessageParcel & reply)217 void AudioPolicyManagerStub::GetDevicesInternal(MessageParcel &data, MessageParcel &reply)
218 {
219 AUDIO_DEBUG_LOG("GET_DEVICES AudioManagerStub");
220 int deviceFlag = data.ReadInt32();
221 DeviceFlag deviceFlagConfig = static_cast<DeviceFlag>(deviceFlag);
222 std::vector<sptr<AudioDeviceDescriptor>> devices = GetDevices(deviceFlagConfig);
223 int32_t size = static_cast<int32_t>(devices.size());
224 AUDIO_DEBUG_LOG("GET_DEVICES size= %{public}d", size);
225 reply.WriteInt32(size);
226 for (int i = 0; i < size; i++) {
227 devices[i]->Marshalling(reply);
228 }
229 }
230
GetActiveOutputDeviceDescriptorsInternal(MessageParcel & data,MessageParcel & reply)231 void AudioPolicyManagerStub::GetActiveOutputDeviceDescriptorsInternal(MessageParcel &data, MessageParcel &reply)
232 {
233 AUDIO_DEBUG_LOG("GET_ACTIVE_OUTPUT_DEVICE_DESCRIPTORS AudioManagerStub");
234 std::vector<sptr<AudioDeviceDescriptor>> devices = GetActiveOutputDeviceDescriptors();
235 int32_t size = static_cast<int32_t>(devices.size());
236 AUDIO_DEBUG_LOG("GET_ACTIVE_OUTPUT_DEVICE_DESCRIPTORS size= %{public}d", size);
237 reply.WriteInt32(size);
238 for (int i = 0; i < size; i++) {
239 devices[i]->Marshalling(reply);
240 }
241 }
242
SetDeviceActiveInternal(MessageParcel & data,MessageParcel & reply)243 void AudioPolicyManagerStub::SetDeviceActiveInternal(MessageParcel &data, MessageParcel &reply)
244 {
245 InternalDeviceType deviceType = static_cast<InternalDeviceType>(data.ReadInt32());
246 bool active = data.ReadBool();
247 int32_t result = SetDeviceActive(deviceType, active);
248 if (result == SUCCESS)
249 reply.WriteInt32(AUDIO_OK);
250 else
251 reply.WriteInt32(AUDIO_ERR);
252 }
253
IsDeviceActiveInternal(MessageParcel & data,MessageParcel & reply)254 void AudioPolicyManagerStub::IsDeviceActiveInternal(MessageParcel &data, MessageParcel &reply)
255 {
256 InternalDeviceType deviceType = static_cast<InternalDeviceType>(data.ReadInt32());
257 bool result = IsDeviceActive(deviceType);
258 reply.WriteBool(result);
259 }
260
GetActiveOutputDeviceInternal(MessageParcel & data,MessageParcel & reply)261 void AudioPolicyManagerStub::GetActiveOutputDeviceInternal(MessageParcel &data, MessageParcel &reply)
262 {
263 InternalDeviceType deviceType = GetActiveOutputDevice();
264 reply.WriteInt32(static_cast<int>(deviceType));
265 }
266
GetActiveInputDeviceInternal(MessageParcel & data,MessageParcel & reply)267 void AudioPolicyManagerStub::GetActiveInputDeviceInternal(MessageParcel &data, MessageParcel &reply)
268 {
269 InternalDeviceType deviceType = GetActiveInputDevice();
270 reply.WriteInt32(static_cast<int>(deviceType));
271 }
272
SetRingerModeCallbackInternal(MessageParcel & data,MessageParcel & reply)273 void AudioPolicyManagerStub::SetRingerModeCallbackInternal(MessageParcel &data, MessageParcel &reply)
274 {
275 int32_t clientId = data.ReadInt32();
276 sptr<IRemoteObject> object = data.ReadRemoteObject();
277 if (object == nullptr) {
278 AUDIO_ERR_LOG("AudioPolicyManagerStub: SetRingerModeCallback obj is null");
279 return;
280 }
281 int32_t result = SetRingerModeCallback(clientId, object);
282 reply.WriteInt32(result);
283 }
284
SetMicStateChangeCallbackInternal(MessageParcel & data,MessageParcel & reply)285 void AudioPolicyManagerStub::SetMicStateChangeCallbackInternal(MessageParcel &data, MessageParcel &reply)
286 {
287 int32_t clientId = data.ReadInt32();
288 sptr<IRemoteObject> object = data.ReadRemoteObject();
289 if (object == nullptr) {
290 AUDIO_ERR_LOG("AudioPolicyManagerStub: AudioInterruptCallback obj is null");
291 return;
292 }
293 int32_t result = SetMicStateChangeCallback(clientId, object);
294 reply.WriteInt32(result);
295 }
296
UnsetRingerModeCallbackInternal(MessageParcel & data,MessageParcel & reply)297 void AudioPolicyManagerStub::UnsetRingerModeCallbackInternal(MessageParcel &data, MessageParcel &reply)
298 {
299 int32_t clientId = data.ReadInt32();
300 int32_t result = UnsetRingerModeCallback(clientId);
301 reply.WriteInt32(result);
302 }
303
SelectOutputDeviceInternal(MessageParcel & data,MessageParcel & reply)304 void AudioPolicyManagerStub::SelectOutputDeviceInternal(MessageParcel &data, MessageParcel &reply)
305 {
306 sptr<AudioRendererFilter> audioRendererFilter = AudioRendererFilter::Unmarshalling(data);
307 if (audioRendererFilter == nullptr) {
308 AUDIO_ERR_LOG("AudioRendererFilter unmarshall fail.");
309 return;
310 }
311
312 int validSize = 20; // Use 20 as limit.
313 int size = data.ReadInt32();
314 if (size <= 0 || size > validSize) {
315 AUDIO_ERR_LOG("SelectOutputDevice get invalid device size.");
316 return;
317 }
318 std::vector<sptr<AudioDeviceDescriptor>> targetOutputDevice;
319 for (int i = 0; i < size; i++) {
320 sptr<AudioDeviceDescriptor> audioDeviceDescriptor = AudioDeviceDescriptor::Unmarshalling(data);
321 if (audioDeviceDescriptor == nullptr) {
322 AUDIO_ERR_LOG("Unmarshalling fail.");
323 return;
324 }
325 targetOutputDevice.push_back(audioDeviceDescriptor);
326 }
327
328 int32_t ret = SelectOutputDevice(audioRendererFilter, targetOutputDevice);
329 reply.WriteInt32(ret);
330 }
331
GetSelectedDeviceInfoInternal(MessageParcel & data,MessageParcel & reply)332 void AudioPolicyManagerStub::GetSelectedDeviceInfoInternal(MessageParcel &data, MessageParcel &reply)
333 {
334 int32_t uid = data.ReadInt32();
335 int32_t pid = data.ReadInt32();
336 AudioStreamType streamType = static_cast<AudioStreamType>(data.ReadInt32());
337
338 std::string deviceName = GetSelectedDeviceInfo(uid, pid, streamType);
339 reply.WriteString(deviceName);
340 }
341
SelectInputDeviceInternal(MessageParcel & data,MessageParcel & reply)342 void AudioPolicyManagerStub::SelectInputDeviceInternal(MessageParcel &data, MessageParcel &reply)
343 {
344 sptr<AudioCapturerFilter> audioCapturerFilter = AudioCapturerFilter::Unmarshalling(data);
345 if (audioCapturerFilter == nullptr) {
346 AUDIO_ERR_LOG("AudioCapturerFilter unmarshall fail.");
347 return;
348 }
349
350 int validSize = 10; // Use 10 as limit.
351 int size = data.ReadInt32();
352 if (size <= 0 || size > validSize) {
353 AUDIO_ERR_LOG("SelectInputDevice get invalid device size.");
354 return;
355 }
356 std::vector<sptr<AudioDeviceDescriptor>> targetInputDevice;
357 for (int i = 0; i < size; i++) {
358 sptr<AudioDeviceDescriptor> audioDeviceDescriptor = AudioDeviceDescriptor::Unmarshalling(data);
359 if (audioDeviceDescriptor == nullptr) {
360 AUDIO_ERR_LOG("Unmarshalling fail.");
361 return;
362 }
363 targetInputDevice.push_back(audioDeviceDescriptor);
364 }
365
366 int32_t ret = SelectInputDevice(audioCapturerFilter, targetInputDevice);
367 reply.WriteInt32(ret);
368 }
369
SetDeviceChangeCallbackInternal(MessageParcel & data,MessageParcel & reply)370 void AudioPolicyManagerStub::SetDeviceChangeCallbackInternal(MessageParcel &data, MessageParcel &reply)
371 {
372 int32_t clientId = data.ReadInt32();
373 DeviceFlag flag = static_cast<DeviceFlag>(data.ReadInt32());
374 sptr<IRemoteObject> object = data.ReadRemoteObject();
375 if (object == nullptr) {
376 AUDIO_ERR_LOG("AudioPolicyManagerStub: AudioInterruptCallback obj is null");
377 return;
378 }
379 int32_t result = SetDeviceChangeCallback(clientId, flag, object);
380 reply.WriteInt32(result);
381 }
382
UnsetDeviceChangeCallbackInternal(MessageParcel & data,MessageParcel & reply)383 void AudioPolicyManagerStub::UnsetDeviceChangeCallbackInternal(MessageParcel &data, MessageParcel &reply)
384 {
385 int32_t clientId = data.ReadInt32();
386 int32_t result = UnsetDeviceChangeCallback(clientId);
387 reply.WriteInt32(result);
388 }
389
SetInterruptCallbackInternal(MessageParcel & data,MessageParcel & reply)390 void AudioPolicyManagerStub::SetInterruptCallbackInternal(MessageParcel &data, MessageParcel &reply)
391 {
392 uint32_t sessionID = data.ReadUint32();
393 sptr<IRemoteObject> object = data.ReadRemoteObject();
394 if (object == nullptr) {
395 AUDIO_ERR_LOG("AudioPolicyManagerStub: AudioInterruptCallback obj is null");
396 return;
397 }
398 int32_t result = SetAudioInterruptCallback(sessionID, object);
399 reply.WriteInt32(result);
400 }
401
UnsetInterruptCallbackInternal(MessageParcel & data,MessageParcel & reply)402 void AudioPolicyManagerStub::UnsetInterruptCallbackInternal(MessageParcel &data, MessageParcel &reply)
403 {
404 uint32_t sessionID = data.ReadUint32();
405 int32_t result = UnsetAudioInterruptCallback(sessionID);
406 reply.WriteInt32(result);
407 }
408
ActivateInterruptInternal(MessageParcel & data,MessageParcel & reply)409 void AudioPolicyManagerStub::ActivateInterruptInternal(MessageParcel &data, MessageParcel &reply)
410 {
411 AudioInterrupt audioInterrupt = {};
412 ReadAudioInterruptParams(data, audioInterrupt);
413 int32_t result = ActivateAudioInterrupt(audioInterrupt);
414 reply.WriteInt32(result);
415 }
416
DeactivateInterruptInternal(MessageParcel & data,MessageParcel & reply)417 void AudioPolicyManagerStub::DeactivateInterruptInternal(MessageParcel &data, MessageParcel &reply)
418 {
419 AudioInterrupt audioInterrupt = {};
420 ReadAudioInterruptParams(data, audioInterrupt);
421 int32_t result = DeactivateAudioInterrupt(audioInterrupt);
422 reply.WriteInt32(result);
423 }
424
SetAudioManagerInterruptCbInternal(MessageParcel & data,MessageParcel & reply)425 void AudioPolicyManagerStub::SetAudioManagerInterruptCbInternal(MessageParcel &data, MessageParcel &reply)
426 {
427 uint32_t clientID = data.ReadUint32();
428 sptr<IRemoteObject> object = data.ReadRemoteObject();
429 if (object == nullptr) {
430 AUDIO_ERR_LOG("AudioPolicyManagerStub: AudioInterruptCallback obj is null");
431 return;
432 }
433 int32_t result = SetAudioManagerInterruptCallback(clientID, object);
434 reply.WriteInt32(result);
435 }
436
UnsetAudioManagerInterruptCbInternal(MessageParcel & data,MessageParcel & reply)437 void AudioPolicyManagerStub::UnsetAudioManagerInterruptCbInternal(MessageParcel &data, MessageParcel &reply)
438 {
439 uint32_t clientID = data.ReadUint32();
440 int32_t result = UnsetAudioManagerInterruptCallback(clientID);
441 reply.WriteInt32(result);
442 }
443
RequestAudioFocusInternal(MessageParcel & data,MessageParcel & reply)444 void AudioPolicyManagerStub::RequestAudioFocusInternal(MessageParcel &data, MessageParcel &reply)
445 {
446 AudioInterrupt audioInterrupt = {};
447 uint32_t clientID = data.ReadUint32();
448 ReadAudioManagerInterruptParams(data, audioInterrupt);
449 int32_t result = RequestAudioFocus(clientID, audioInterrupt);
450 reply.WriteInt32(result);
451 }
452
AbandonAudioFocusInternal(MessageParcel & data,MessageParcel & reply)453 void AudioPolicyManagerStub::AbandonAudioFocusInternal(MessageParcel &data, MessageParcel &reply)
454 {
455 AudioInterrupt audioInterrupt = {};
456 uint32_t clientID = data.ReadUint32();
457 ReadAudioManagerInterruptParams(data, audioInterrupt);
458 int32_t result = AbandonAudioFocus(clientID, audioInterrupt);
459 reply.WriteInt32(result);
460 }
461
GetStreamInFocusInternal(MessageParcel & reply)462 void AudioPolicyManagerStub::GetStreamInFocusInternal(MessageParcel &reply)
463 {
464 AudioStreamType streamInFocus = GetStreamInFocus();
465 reply.WriteInt32(static_cast<int32_t>(streamInFocus));
466 }
467
GetSessionInfoInFocusInternal(MessageParcel & reply)468 void AudioPolicyManagerStub::GetSessionInfoInFocusInternal(MessageParcel &reply)
469 {
470 uint32_t invalidSessionID = static_cast<uint32_t>(-1);
471 AudioInterrupt audioInterrupt {STREAM_USAGE_UNKNOWN, CONTENT_TYPE_UNKNOWN, STREAM_DEFAULT, invalidSessionID};
472 int32_t ret = GetSessionInfoInFocus(audioInterrupt);
473 WriteAudioInteruptParams(reply, audioInterrupt);
474 reply.WriteInt32(ret);
475 }
476
SetVolumeKeyEventCallbackInternal(MessageParcel & data,MessageParcel & reply)477 void AudioPolicyManagerStub::SetVolumeKeyEventCallbackInternal(MessageParcel &data, MessageParcel &reply)
478 {
479 int32_t clientPid = data.ReadInt32();
480 sptr<IRemoteObject> remoteObject = data.ReadRemoteObject();
481 if (remoteObject == nullptr) {
482 AUDIO_ERR_LOG("AudioPolicyManagerStub: AudioManagerCallback obj is null");
483 return;
484 }
485 int ret = SetVolumeKeyEventCallback(clientPid, remoteObject);
486 reply.WriteInt32(ret);
487 }
488
UnsetVolumeKeyEventCallbackInternal(MessageParcel & data,MessageParcel & reply)489 void AudioPolicyManagerStub::UnsetVolumeKeyEventCallbackInternal(MessageParcel &data, MessageParcel &reply)
490 {
491 int32_t clientPid = data.ReadInt32();
492 int ret = UnsetVolumeKeyEventCallback(clientPid);
493 reply.WriteInt32(ret);
494 }
495
VerifyClientPermissionInternal(MessageParcel & data,MessageParcel & reply)496 void AudioPolicyManagerStub::VerifyClientPermissionInternal(MessageParcel &data, MessageParcel &reply)
497 {
498 std::string permissionName = data.ReadString();
499 uint32_t appTokenId = data.ReadUint32();
500 uint32_t appUid = data.ReadInt32();
501 bool privacyFlag = data.ReadBool();
502 AudioPermissionState state = static_cast<AudioPermissionState>(data.ReadInt32());
503 bool ret = VerifyClientPermission(permissionName, appTokenId, appUid, privacyFlag, state);
504 reply.WriteBool(ret);
505 }
506
getUsingPemissionFromPrivacyInternal(MessageParcel & data,MessageParcel & reply)507 void AudioPolicyManagerStub::getUsingPemissionFromPrivacyInternal(MessageParcel &data, MessageParcel &reply)
508 {
509 std::string permissionName = data.ReadString();
510 uint32_t appTokenId = data.ReadUint32();
511 AudioPermissionState state = static_cast<AudioPermissionState>(data.ReadInt32());
512 bool ret = getUsingPemissionFromPrivacy(permissionName, appTokenId, state);
513 reply.WriteBool(ret);
514 }
515
GetAudioLatencyFromXmlInternal(MessageParcel & data,MessageParcel & reply)516 void AudioPolicyManagerStub::GetAudioLatencyFromXmlInternal(MessageParcel &data, MessageParcel &reply)
517 {
518 int ret = GetAudioLatencyFromXml();
519 reply.WriteInt32(ret);
520 }
521
GetSinkLatencyFromXmlInternal(MessageParcel & data,MessageParcel & reply)522 void AudioPolicyManagerStub::GetSinkLatencyFromXmlInternal(MessageParcel &data, MessageParcel &reply)
523 {
524 uint32_t ret = GetSinkLatencyFromXml();
525 reply.WriteUint32(ret);
526 }
527
ReconfigureAudioChannelInternal(MessageParcel & data,MessageParcel & reply)528 void AudioPolicyManagerStub::ReconfigureAudioChannelInternal(MessageParcel &data, MessageParcel &reply)
529 {
530 uint32_t count = data.ReadUint32();
531 DeviceType deviceType = static_cast<DeviceType>(data.ReadInt32());
532 int32_t ret = ReconfigureAudioChannel(count, deviceType);
533 reply.WriteInt32(ret);
534 }
535
RegisterAudioRendererEventListenerInternal(MessageParcel & data,MessageParcel & reply)536 void AudioPolicyManagerStub::RegisterAudioRendererEventListenerInternal(MessageParcel &data, MessageParcel &reply)
537 {
538 AUDIO_DEBUG_LOG("AudioPolicyManagerStub:register event listener entered");
539 int32_t clientUID = data.ReadInt32();
540 sptr<IRemoteObject> remoteObject = data.ReadRemoteObject();
541 if (remoteObject == nullptr) {
542 AUDIO_ERR_LOG("AudioPolicyManagerStub: AudioRendererStateCallback obj is null");
543 return;
544 }
545 int ret = RegisterAudioRendererEventListener(clientUID, remoteObject);
546 reply.WriteInt32(ret);
547 AUDIO_DEBUG_LOG("AudioPolicyManagerStub:register event listener exit");
548 }
549
UnregisterAudioRendererEventListenerInternal(MessageParcel & data,MessageParcel & reply)550 void AudioPolicyManagerStub::UnregisterAudioRendererEventListenerInternal(MessageParcel &data, MessageParcel &reply)
551 {
552 AUDIO_DEBUG_LOG("AudioPolicyManagerStub:unregister event listener entered");
553 int32_t clientUID = data.ReadInt32();
554 int ret = UnregisterAudioRendererEventListener(clientUID);
555 reply.WriteInt32(ret);
556 AUDIO_DEBUG_LOG("AudioPolicyManagerStub:unregister event listener exit");
557 }
558
RegisterAudioCapturerEventListenerInternal(MessageParcel & data,MessageParcel & reply)559 void AudioPolicyManagerStub::RegisterAudioCapturerEventListenerInternal(MessageParcel &data, MessageParcel &reply)
560 {
561 AUDIO_DEBUG_LOG("AudioPolicyManagerStub:cap register event listener entered");
562 int32_t clientUID = data.ReadInt32();
563 sptr<IRemoteObject> remoteObject = data.ReadRemoteObject();
564 if (remoteObject == nullptr) {
565 AUDIO_ERR_LOG("AudioPolicyManagerStub: AudioCapturerStateCallback obj is null");
566 return;
567 }
568 int ret = RegisterAudioCapturerEventListener(clientUID, remoteObject);
569 reply.WriteInt32(ret);
570 AUDIO_DEBUG_LOG("AudioPolicyManagerStub:cap register event listener exit");
571 }
572
UnregisterAudioCapturerEventListenerInternal(MessageParcel & data,MessageParcel & reply)573 void AudioPolicyManagerStub::UnregisterAudioCapturerEventListenerInternal(MessageParcel &data, MessageParcel &reply)
574 {
575 AUDIO_DEBUG_LOG("AudioPolicyManagerStub:cap unnregister event listener entered");
576 int32_t clientUID = data.ReadInt32();
577 int ret = UnregisterAudioCapturerEventListener(clientUID);
578 reply.WriteInt32(ret);
579 AUDIO_DEBUG_LOG("AudioPolicyManagerStub:cap unregister event listener exit");
580 }
581
RegisterTrackerInternal(MessageParcel & data,MessageParcel & reply)582 void AudioPolicyManagerStub::RegisterTrackerInternal(MessageParcel &data, MessageParcel &reply)
583 {
584 AUDIO_DEBUG_LOG("AudioPolicyManagerStub:register tracker internal entered");
585
586 AudioStreamChangeInfo streamChangeInfo = {};
587 AudioMode mode = static_cast<AudioMode> (data.ReadInt32());
588 ReadStreamChangeInfo(data, mode, streamChangeInfo);
589 sptr<IRemoteObject> remoteObject = data.ReadRemoteObject();
590 if (remoteObject == nullptr) {
591 AUDIO_ERR_LOG("AudioPolicyManagerStub: Client Tracker obj is null");
592 return;
593 }
594
595 int ret = RegisterTracker(mode, streamChangeInfo, remoteObject);
596 reply.WriteInt32(ret);
597 AUDIO_DEBUG_LOG("AudioPolicyManagerStub:register tracker internal ret = %{public}d", ret);
598 }
599
UpdateTrackerInternal(MessageParcel & data,MessageParcel & reply)600 void AudioPolicyManagerStub::UpdateTrackerInternal(MessageParcel &data, MessageParcel &reply)
601 {
602 AUDIO_DEBUG_LOG("AudioPolicyManagerStub:update tracker internal entered");
603
604 AudioStreamChangeInfo streamChangeInfo = {};
605 AudioMode mode = static_cast<AudioMode> (data.ReadInt32());
606 ReadStreamChangeInfo(data, mode, streamChangeInfo);
607 int ret = UpdateTracker(mode, streamChangeInfo);
608 reply.WriteInt32(ret);
609 AUDIO_DEBUG_LOG("AudioPolicyManagerStub:update tracker internal ret = %{public}d", ret);
610 }
611
GetRendererChangeInfosInternal(MessageParcel & data,MessageParcel & reply)612 void AudioPolicyManagerStub::GetRendererChangeInfosInternal(MessageParcel &data, MessageParcel &reply)
613 {
614 AUDIO_DEBUG_LOG("AudioPolicyManagerStub:Renderer change info internal entered");
615
616 size_t size = 0;
617 vector<unique_ptr<AudioRendererChangeInfo>> audioRendererChangeInfos;
618 int ret = GetCurrentRendererChangeInfos(audioRendererChangeInfos);
619 if (ret != SUCCESS) {
620 AUDIO_ERR_LOG("AudioPolicyManagerStub:GetRendererChangeInfos Error!!");
621 reply.WriteInt32(size);
622 return;
623 }
624
625 size = audioRendererChangeInfos.size();
626 reply.WriteInt32(size);
627 for (const unique_ptr<AudioRendererChangeInfo> &rendererChangeInfo: audioRendererChangeInfos) {
628 if (!rendererChangeInfo) {
629 AUDIO_ERR_LOG("AudioPolicyManagerStub:Renderer change info null, something wrong!!");
630 continue;
631 }
632 reply.WriteInt32(rendererChangeInfo->sessionId);
633 reply.WriteInt32(rendererChangeInfo->rendererState);
634 reply.WriteInt32(rendererChangeInfo->clientUID);
635 reply.WriteInt32(rendererChangeInfo->rendererInfo.contentType);
636 reply.WriteInt32(rendererChangeInfo->rendererInfo.streamUsage);
637 reply.WriteInt32(rendererChangeInfo->rendererInfo.rendererFlags);
638
639 reply.WriteInt32(rendererChangeInfo->outputDeviceInfo.deviceType);
640 reply.WriteInt32(rendererChangeInfo->outputDeviceInfo.deviceRole);
641 reply.WriteInt32(rendererChangeInfo->outputDeviceInfo.deviceId);
642 reply.WriteInt32(rendererChangeInfo->outputDeviceInfo.channelMasks);
643 reply.WriteInt32(rendererChangeInfo->outputDeviceInfo.audioStreamInfo.samplingRate);
644 reply.WriteInt32(rendererChangeInfo->outputDeviceInfo.audioStreamInfo.encoding);
645 reply.WriteInt32(rendererChangeInfo->outputDeviceInfo.audioStreamInfo.format);
646 reply.WriteInt32(rendererChangeInfo->outputDeviceInfo.audioStreamInfo.channels);
647 reply.WriteString(rendererChangeInfo->outputDeviceInfo.deviceName);
648 reply.WriteString(rendererChangeInfo->outputDeviceInfo.macAddress);
649 }
650
651 AUDIO_DEBUG_LOG("AudioPolicyManagerStub:Renderer change info internal exit");
652 }
653
GetCapturerChangeInfosInternal(MessageParcel & data,MessageParcel & reply)654 void AudioPolicyManagerStub::GetCapturerChangeInfosInternal(MessageParcel &data, MessageParcel &reply)
655 {
656 AUDIO_DEBUG_LOG("AudioPolicyManagerStub:Capturer change info internal entered");
657 size_t size = 0;
658 vector<unique_ptr<AudioCapturerChangeInfo>> audioCapturerChangeInfos;
659 int32_t ret = GetCurrentCapturerChangeInfos(audioCapturerChangeInfos);
660 if (ret != SUCCESS) {
661 AUDIO_ERR_LOG("AudioPolicyManagerStub:GetCapturerChangeInfos Error!!");
662 reply.WriteInt32(size);
663 return;
664 }
665
666 size = audioCapturerChangeInfos.size();
667 reply.WriteInt32(size);
668 for (const unique_ptr<AudioCapturerChangeInfo> &capturerChangeInfo: audioCapturerChangeInfos) {
669 if (!capturerChangeInfo) {
670 AUDIO_ERR_LOG("AudioPolicyManagerStub:Capturer change info null, something wrong!!");
671 continue;
672 }
673 reply.WriteInt32(capturerChangeInfo->sessionId);
674 reply.WriteInt32(capturerChangeInfo->capturerState);
675 reply.WriteInt32(capturerChangeInfo->clientUID);
676 reply.WriteInt32(capturerChangeInfo->capturerInfo.sourceType);
677 reply.WriteInt32(capturerChangeInfo->capturerInfo.capturerFlags);
678
679 reply.WriteInt32(capturerChangeInfo->inputDeviceInfo.deviceType);
680 reply.WriteInt32(capturerChangeInfo->inputDeviceInfo.deviceRole);
681 reply.WriteInt32(capturerChangeInfo->inputDeviceInfo.deviceId);
682 reply.WriteInt32(capturerChangeInfo->inputDeviceInfo.channelMasks);
683 reply.WriteInt32(capturerChangeInfo->inputDeviceInfo.audioStreamInfo.samplingRate);
684 reply.WriteInt32(capturerChangeInfo->inputDeviceInfo.audioStreamInfo.encoding);
685 reply.WriteInt32(capturerChangeInfo->inputDeviceInfo.audioStreamInfo.format);
686 reply.WriteInt32(capturerChangeInfo->inputDeviceInfo.audioStreamInfo.channels);
687 reply.WriteString(capturerChangeInfo->inputDeviceInfo.deviceName);
688 reply.WriteString(capturerChangeInfo->inputDeviceInfo.macAddress);
689 }
690 AUDIO_DEBUG_LOG("AudioPolicyManagerStub:Capturer change info internal exit");
691 }
692
UpdateStreamStateInternal(MessageParcel & data,MessageParcel & reply)693 void AudioPolicyManagerStub::UpdateStreamStateInternal(MessageParcel &data, MessageParcel &reply)
694 {
695 AUDIO_DEBUG_LOG("AudioPolicyManagerStub:UpdateStreamStateInternal change info internal entered");
696 int32_t clientUid = data.ReadInt32();
697 StreamSetState streamSetState = static_cast<StreamSetState>(data.ReadInt32());
698 AudioStreamType streamType = static_cast<AudioStreamType>(data.ReadInt32());
699
700 int32_t result = UpdateStreamState(clientUid, streamSetState, streamType);
701 reply.WriteInt32(result);
702 AUDIO_DEBUG_LOG("AudioPolicyManagerStub:UpdateStreamStateInternal change info internal exit");
703 }
704
GetVolumeGroupInfoInternal(MessageParcel & data,MessageParcel & reply)705 void AudioPolicyManagerStub::GetVolumeGroupInfoInternal(MessageParcel& data, MessageParcel& reply)
706 {
707 AUDIO_DEBUG_LOG("GetVolumeGroupInfoInternal entered");
708 std::vector<sptr<VolumeGroupInfo>> groupInfos = GetVolumeGroupInfos();
709 int32_t size = static_cast<int32_t>(groupInfos.size());
710 AUDIO_DEBUG_LOG("GET_DEVICES size= %{public}d", size);
711 reply.WriteInt32(size);
712 for (int i = 0; i < size; i++) {
713 groupInfos[i]->Marshalling(reply);
714 }
715 AUDIO_DEBUG_LOG("AudioPolicyManagerStub:GetVolumeGroups internal exit");
716 }
717
IsAudioRendererLowLatencySupportedInternal(MessageParcel & data,MessageParcel & reply)718 void AudioPolicyManagerStub::IsAudioRendererLowLatencySupportedInternal(MessageParcel &data, MessageParcel &reply)
719 {
720 AudioStreamInfo audioStreamInfo = {};
721 audioStreamInfo.samplingRate = static_cast<AudioSamplingRate>(data.ReadInt32());
722 audioStreamInfo.channels = static_cast<AudioChannel>(data.ReadInt32());
723 audioStreamInfo.format = static_cast<OHOS::AudioStandard::AudioSampleFormat>(data.ReadInt32());
724 audioStreamInfo.encoding = static_cast<AudioEncodingType>(data.ReadInt32());
725 bool isSupported = IsAudioRendererLowLatencySupported(audioStreamInfo);
726 reply.WriteBool(isSupported);
727 }
728
OnRemoteRequest(uint32_t code,MessageParcel & data,MessageParcel & reply,MessageOption & option)729 int AudioPolicyManagerStub::OnRemoteRequest(
730 uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option)
731 {
732 if (data.ReadInterfaceToken() != GetDescriptor()) {
733 AUDIO_ERR_LOG("AudioPolicyManagerStub: ReadInterfaceToken failed");
734 return -1;
735 }
736 switch (code) {
737 case SET_STREAM_VOLUME:
738 SetStreamVolumeInternal(data, reply);
739 break;
740
741 case SET_RINGER_MODE:
742 SetRingerModeInternal(data, reply);
743 break;
744
745 case GET_RINGER_MODE:
746 GetRingerModeInternal(reply);
747 break;
748
749 case SET_AUDIO_SCENE:
750 SetAudioSceneInternal(data, reply);
751 break;
752
753 case GET_AUDIO_SCENE:
754 GetAudioSceneInternal(reply);
755 break;
756
757 case SET_MICROPHONE_MUTE:
758 SetMicrophoneMuteInternal(data, reply);
759 break;
760
761 case SET_MICROPHONE_MUTE_AUDIO_CONFIG:
762 SetMicrophoneMuteAudioConfigInternal(data, reply);
763 break;
764
765 case IS_MICROPHONE_MUTE:
766 IsMicrophoneMuteInternal(data, reply);
767 break;
768
769 case GET_STREAM_VOLUME:
770 GetStreamVolumeInternal(data, reply);
771 break;
772
773 case SET_STREAM_MUTE:
774 SetStreamMuteInternal(data, reply);
775 break;
776
777 case GET_STREAM_MUTE:
778 GetStreamMuteInternal(data, reply);
779 break;
780
781 case IS_STREAM_ACTIVE:
782 IsStreamActiveInternal(data, reply);
783 break;
784
785 case SET_DEVICE_ACTIVE:
786 SetDeviceActiveInternal(data, reply);
787 break;
788
789 case IS_DEVICE_ACTIVE:
790 IsDeviceActiveInternal(data, reply);
791 break;
792
793 case GET_ACTIVE_OUTPUT_DEVICE:
794 GetActiveOutputDeviceInternal(data, reply);
795 break;
796
797 case GET_ACTIVE_INPUT_DEVICE:
798 GetActiveInputDeviceInternal(data, reply);
799 break;
800
801 case SET_RINGERMODE_CALLBACK:
802 SetRingerModeCallbackInternal(data, reply);
803 break;
804
805 case UNSET_RINGERMODE_CALLBACK:
806 UnsetRingerModeCallbackInternal(data, reply);
807 break;
808
809 case SET_MIC_STATE_CHANGE_CALLBACK:
810 SetMicStateChangeCallbackInternal(data, reply);
811 break;
812
813 case SET_DEVICE_CHANGE_CALLBACK:
814 SetDeviceChangeCallbackInternal(data, reply);
815 break;
816
817 case UNSET_DEVICE_CHANGE_CALLBACK:
818 UnsetDeviceChangeCallbackInternal(data, reply);
819 break;
820
821 case SET_CALLBACK:
822 SetInterruptCallbackInternal(data, reply);
823 break;
824
825 case UNSET_CALLBACK:
826 UnsetInterruptCallbackInternal(data, reply);
827 break;
828
829 case ACTIVATE_INTERRUPT:
830 ActivateInterruptInternal(data, reply);
831 break;
832
833 case DEACTIVATE_INTERRUPT:
834 DeactivateInterruptInternal(data, reply);
835 break;
836
837 case SET_INTERRUPT_CALLBACK:
838 SetAudioManagerInterruptCbInternal(data, reply);
839 break;
840
841 case UNSET_INTERRUPT_CALLBACK:
842 UnsetAudioManagerInterruptCbInternal(data, reply);
843 break;
844
845 case REQUEST_AUDIO_FOCUS:
846 RequestAudioFocusInternal(data, reply);
847 break;
848
849 case ABANDON_AUDIO_FOCUS:
850 AbandonAudioFocusInternal(data, reply);
851 break;
852
853 case SET_VOLUME_KEY_EVENT_CALLBACK:
854 SetVolumeKeyEventCallbackInternal(data, reply);
855 break;
856
857 case UNSET_VOLUME_KEY_EVENT_CALLBACK:
858 UnsetVolumeKeyEventCallbackInternal(data, reply);
859 break;
860
861 case GET_STREAM_IN_FOCUS:
862 GetStreamInFocusInternal(reply);
863 break;
864
865 case GET_SESSION_INFO_IN_FOCUS:
866 GetSessionInfoInFocusInternal(reply);
867 break;
868
869 case GET_DEVICES:
870 GetDevicesInternal(data, reply);
871 break;
872
873 case QUERY_PERMISSION:
874 VerifyClientPermissionInternal(data, reply);
875 break;
876
877 case SELECT_OUTPUT_DEVICE:
878 SelectOutputDeviceInternal(data, reply);
879 break;
880
881 case GET_SELECTED_DEVICE_INFO:
882 GetSelectedDeviceInfoInternal(data, reply);
883 break;
884
885 case SELECT_INPUT_DEVICE:
886 SelectInputDeviceInternal(data, reply);
887 break;
888 case GET_TONEINFO:
889 GetToneInfoInternal(data, reply);
890 break;
891 case GET_SUPPORTED_TONES:
892 GetSupportedTonesInternal(data, reply);
893 break;
894 case RECONFIGURE_CHANNEL:
895 ReconfigureAudioChannelInternal(data, reply);
896 break;
897
898 case GET_AUDIO_LATENCY:
899 GetAudioLatencyFromXmlInternal(data, reply);
900 break;
901
902 case GET_SINK_LATENCY:
903 GetSinkLatencyFromXmlInternal(data, reply);
904 break;
905
906 case REGISTER_PLAYBACK_EVENT:
907 RegisterAudioRendererEventListenerInternal(data, reply);
908 break;
909
910 case UNREGISTER_PLAYBACK_EVENT:
911 UnregisterAudioRendererEventListenerInternal(data, reply);
912 break;
913
914 case REGISTER_RECORDING_EVENT:
915 RegisterAudioCapturerEventListenerInternal(data, reply);
916 break;
917
918 case UNREGISTER_RECORDING_EVENT:
919 UnregisterAudioCapturerEventListenerInternal(data, reply);
920 break;
921
922 case REGISTER_TRACKER:
923 RegisterTrackerInternal(data, reply);
924 break;
925
926 case UPDATE_TRACKER:
927 UpdateTrackerInternal(data, reply);
928 break;
929
930 case GET_RENDERER_CHANGE_INFOS:
931 GetRendererChangeInfosInternal(data, reply);
932 break;
933
934 case GET_CAPTURER_CHANGE_INFOS:
935 GetCapturerChangeInfosInternal(data, reply);
936 break;
937
938 case UPDATE_STREAM_STATE:
939 UpdateStreamStateInternal(data, reply);
940 break;
941
942 case SET_LOW_POWER_STREM_VOLUME:
943 SetLowPowerVolumeInternal(data, reply);
944 break;
945
946 case GET_LOW_POWRR_STREM_VOLUME:
947 GetLowPowerVolumeInternal(data, reply);
948 break;
949
950 case GET_SINGLE_STREAM_VOLUME:
951 GetSingleStreamVolumeInternal(data, reply);
952 break;
953
954 case GET_VOLUME_GROUP_INFO:
955 GetVolumeGroupInfoInternal(data, reply);
956 break;
957
958 case IS_AUDIO_RENDER_LOW_LATENCY_SUPPORTED:
959 IsAudioRendererLowLatencySupportedInternal(data, reply);
960 break;
961
962 case GET_USING_PEMISSION_FROM_PRIVACY:
963 getUsingPemissionFromPrivacyInternal(data, reply);
964 break;
965
966 case GET_ACTIVE_OUTPUT_DEVICE_DESCRIPTORS:
967 GetActiveOutputDeviceDescriptorsInternal(data, reply);
968 break;
969
970 default:
971 AUDIO_ERR_LOG("default case, need check AudioPolicyManagerStub");
972 return IPCObjectStub::OnRemoteRequest(code, data, reply, option);
973 }
974 return AUDIO_OK;
975 }
976 } // namespace audio_policy
977 } // namespace OHOS
978