1 /*
2 * Copyright (c) 2024 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 #ifndef LOG_TAG
16 #define LOG_TAG "AudioPolicyProxy"
17 #endif
18
19 #include "audio_policy_proxy.h"
20
21 #include "audio_policy_log.h"
22
23 namespace OHOS {
24 namespace AudioStandard {
25 using namespace std;
26
GetMaxVolumeLevel(AudioVolumeType volumeType)27 int32_t AudioPolicyProxy::GetMaxVolumeLevel(AudioVolumeType volumeType)
28 {
29 MessageParcel data;
30 MessageParcel reply;
31 MessageOption option;
32
33 bool ret = data.WriteInterfaceToken(GetDescriptor());
34 CHECK_AND_RETURN_RET_LOG(ret, -1, "WriteInterfaceToken failed");
35
36 data.WriteInt32(static_cast<int32_t>(volumeType));
37 int32_t error = Remote()->SendRequest(
38 static_cast<uint32_t>(AudioPolicyInterfaceCode::GET_MAX_VOLUMELEVEL), data, reply, option);
39 CHECK_AND_RETURN_RET_LOG(error == ERR_NONE, error, "get max volume failed, error: %d", error);
40 return reply.ReadInt32();
41 }
42
GetMinVolumeLevel(AudioVolumeType volumeType)43 int32_t AudioPolicyProxy::GetMinVolumeLevel(AudioVolumeType volumeType)
44 {
45 MessageParcel data;
46 MessageParcel reply;
47 MessageOption option;
48
49 bool ret = data.WriteInterfaceToken(GetDescriptor());
50 CHECK_AND_RETURN_RET_LOG(ret, -1, "WriteInterfaceToken failed");
51 data.WriteInt32(static_cast<int32_t>(volumeType));
52 int32_t error = Remote()->SendRequest(
53 static_cast<uint32_t>(AudioPolicyInterfaceCode::GET_MIN_VOLUMELEVEL), data, reply, option);
54 CHECK_AND_RETURN_RET_LOG(error == ERR_NONE, error, "get min volume failed, error: %d", error);
55 return reply.ReadInt32();
56 }
57
SetSystemVolumeLevelLegacy(AudioVolumeType volumeType,int32_t volumeLevel)58 int32_t AudioPolicyProxy::SetSystemVolumeLevelLegacy(AudioVolumeType volumeType, int32_t volumeLevel)
59 {
60 MessageParcel data;
61 MessageParcel reply;
62 MessageOption option;
63 bool ret = data.WriteInterfaceToken(GetDescriptor());
64 CHECK_AND_RETURN_RET_LOG(ret, -1, "WriteInterfaceToken failed");
65
66 data.WriteInt32(static_cast<int32_t>(volumeType));
67 data.WriteInt32(volumeLevel);
68 int32_t error = Remote()->SendRequest(
69 static_cast<uint32_t>(AudioPolicyInterfaceCode::SET_SYSTEM_VOLUMELEVEL_LEGACY), data, reply, option);
70 CHECK_AND_RETURN_RET_LOG(error == ERR_NONE, error, "set volume failed, error: %d", error);
71 return reply.ReadInt32();
72 }
73
SetSelfAppVolumeLevel(int32_t volumeLevel,int32_t volumeFlag)74 int32_t AudioPolicyProxy::SetSelfAppVolumeLevel(int32_t volumeLevel, int32_t volumeFlag)
75 {
76 MessageParcel data;
77 MessageParcel reply;
78 MessageOption option;
79 bool ret = data.WriteInterfaceToken(GetDescriptor());
80 CHECK_AND_RETURN_RET_LOG(ret, -1, "WriteInterfaceToken failed");
81
82 data.WriteInt32(volumeLevel);
83 data.WriteInt32(volumeFlag);
84 int32_t error = Remote()->SendRequest(static_cast<uint32_t>(
85 AudioPolicyInterfaceCode::SET_SELF_APP_VOLUMELEVEL), data, reply, option);
86 CHECK_AND_RETURN_RET_LOG(error == ERR_NONE, error, "set app volume failed, error: %d", error);
87 return reply.ReadInt32();
88 }
89
IsAppVolumeMute(int32_t appUid,bool owned)90 bool AudioPolicyProxy::IsAppVolumeMute(int32_t appUid, bool owned)
91 {
92 MessageParcel data;
93 MessageParcel reply;
94 MessageOption option;
95 bool ret = data.WriteInterfaceToken(GetDescriptor());
96 CHECK_AND_RETURN_RET_LOG(ret, -1, "WriteInterfaceToken failed");
97
98 data.WriteInt32(appUid);
99 data.WriteBool(owned);
100 int32_t error = Remote()->SendRequest(
101 static_cast<uint32_t>(AudioPolicyInterfaceCode::IS_APP_MUTE), data, reply, option);
102 CHECK_AND_RETURN_RET_LOG(error == ERR_NONE, error, "is app muted failed, error: %d", error);
103 return reply.ReadBool();
104 }
105
SetAppVolumeMuted(int32_t appUid,bool muted,int32_t volumeFlag)106 int32_t AudioPolicyProxy::SetAppVolumeMuted(int32_t appUid, bool muted, int32_t volumeFlag)
107 {
108 MessageParcel data;
109 MessageParcel reply;
110 MessageOption option;
111 bool ret = data.WriteInterfaceToken(GetDescriptor());
112 CHECK_AND_RETURN_RET_LOG(ret, -1, "WriteInterfaceToken failed");
113
114 data.WriteInt32(appUid);
115 data.WriteBool(muted);
116 data.WriteInt32(volumeFlag);
117 int32_t error = Remote()->SendRequest(
118 static_cast<uint32_t>(AudioPolicyInterfaceCode::SET_APP_VOLUME_MUTED), data, reply, option);
119 CHECK_AND_RETURN_RET_LOG(error == ERR_NONE, error, "set app muted failed, error: %d", error);
120 return reply.ReadInt32();
121 }
122
SetAppVolumeLevel(int32_t appUid,int32_t volumeLevel,int32_t volumeFlag)123 int32_t AudioPolicyProxy::SetAppVolumeLevel(int32_t appUid, int32_t volumeLevel, int32_t volumeFlag)
124 {
125 MessageParcel data;
126 MessageParcel reply;
127 MessageOption option;
128 bool ret = data.WriteInterfaceToken(GetDescriptor());
129 CHECK_AND_RETURN_RET_LOG(ret, -1, "WriteInterfaceToken failed");
130
131 data.WriteInt32(appUid);
132 data.WriteInt32(volumeLevel);
133 data.WriteInt32(volumeFlag);
134 int32_t error = Remote()->SendRequest(
135 static_cast<uint32_t>(AudioPolicyInterfaceCode::SET_APP_VOLUMELEVEL), data, reply, option);
136 CHECK_AND_RETURN_RET_LOG(error == ERR_NONE, error, "set app volume failed, error: %d", error);
137 return reply.ReadInt32();
138 }
139
SetSystemVolumeLevel(AudioVolumeType volumeType,int32_t volumeLevel,int32_t volumeFlag)140 int32_t AudioPolicyProxy::SetSystemVolumeLevel(AudioVolumeType volumeType, int32_t volumeLevel, int32_t volumeFlag)
141 {
142 MessageParcel data;
143 MessageParcel reply;
144 MessageOption option;
145 bool ret = data.WriteInterfaceToken(GetDescriptor());
146 CHECK_AND_RETURN_RET_LOG(ret, -1, "WriteInterfaceToken failed");
147
148 data.WriteInt32(static_cast<int32_t>(volumeType));
149 data.WriteInt32(volumeLevel);
150 data.WriteInt32(volumeFlag);
151 int32_t error = Remote()->SendRequest(
152 static_cast<uint32_t>(AudioPolicyInterfaceCode::SET_SYSTEM_VOLUMELEVEL), data, reply, option);
153 CHECK_AND_RETURN_RET_LOG(error == ERR_NONE, error, "set volume failed, error: %d", error);
154 return reply.ReadInt32();
155 }
156
SetSystemVolumeLevelWithDevice(AudioVolumeType volumeType,int32_t volumeLevel,DeviceType deviceType,int32_t volumeFlag)157 int32_t AudioPolicyProxy::SetSystemVolumeLevelWithDevice(AudioVolumeType volumeType, int32_t volumeLevel,
158 DeviceType deviceType, int32_t volumeFlag)
159 {
160 MessageParcel data;
161 MessageParcel reply;
162 MessageOption option;
163 bool ret = data.WriteInterfaceToken(GetDescriptor());
164 CHECK_AND_RETURN_RET_LOG(ret, -1, "WriteInterfaceToken failed");
165
166 data.WriteInt32(static_cast<int32_t>(volumeType));
167 data.WriteInt32(volumeLevel);
168 data.WriteInt32(static_cast<int32_t>(deviceType));
169 data.WriteInt32(volumeFlag);
170 int32_t error = Remote()->SendRequest(
171 static_cast<uint32_t>(AudioPolicyInterfaceCode::SET_SYSTEM_VOLUMELEVEL_WITH_DEVICE), data, reply, option);
172 CHECK_AND_RETURN_RET_LOG(error == ERR_NONE, error, "set volume failed, error: %d", error);
173 return reply.ReadInt32();
174 }
175
GetSystemActiveVolumeType(const int32_t clientUid)176 AudioStreamType AudioPolicyProxy::GetSystemActiveVolumeType(const int32_t clientUid)
177 {
178 MessageParcel data;
179 MessageParcel reply;
180 MessageOption option;
181
182 bool ret = data.WriteInterfaceToken(GetDescriptor());
183 CHECK_AND_RETURN_RET_LOG(ret, STREAM_DEFAULT, "WriteInterfaceToken failed");
184 data.WriteInt32(clientUid);
185 int32_t error = Remote()->SendRequest(
186 static_cast<uint32_t>(AudioPolicyInterfaceCode::GET_SYSTEM_ACTIVEVOLUME_TYPE), data, reply, option);
187 if (error != ERR_NONE) {
188 AUDIO_ERR_LOG("get stream in focus failed, error: %d", error);
189 }
190 return static_cast<AudioStreamType>(reply.ReadInt32());
191 }
192
GetSystemVolumeLevel(AudioVolumeType volumeType)193 int32_t AudioPolicyProxy::GetSystemVolumeLevel(AudioVolumeType volumeType)
194 {
195 MessageParcel data;
196 MessageParcel reply;
197 MessageOption option;
198
199 bool ret = data.WriteInterfaceToken(GetDescriptor());
200 CHECK_AND_RETURN_RET_LOG(ret, -1, "WriteInterfaceToken failed");
201 data.WriteInt32(static_cast<int32_t>(volumeType));
202 int32_t error = Remote()->SendRequest(
203 static_cast<uint32_t>(AudioPolicyInterfaceCode::GET_SYSTEM_VOLUMELEVEL), data, reply, option);
204 CHECK_AND_RETURN_RET_LOG(error == ERR_NONE, error, "get volume failed, error: %d", error);
205 return reply.ReadInt32();
206 }
207
GetSelfAppVolumeLevel()208 int32_t AudioPolicyProxy::GetSelfAppVolumeLevel()
209 {
210 MessageParcel data;
211 MessageParcel reply;
212 MessageOption option;
213
214 bool ret = data.WriteInterfaceToken(GetDescriptor());
215 CHECK_AND_RETURN_RET_LOG(ret, -1, "WriteInterfaceToken failed");
216 int32_t error = Remote()->SendRequest(
217 static_cast<uint32_t>(AudioPolicyInterfaceCode::GET_SELF_APP_VOLUME_LEVEL), data, reply, option);
218 CHECK_AND_RETURN_RET_LOG(error == ERR_NONE, error, "get volume failed, error: %d", error);
219 return reply.ReadInt32();
220 }
221
GetAppVolumeLevel(int32_t appUid)222 int32_t AudioPolicyProxy::GetAppVolumeLevel(int32_t appUid)
223 {
224 MessageParcel data;
225 MessageParcel reply;
226 MessageOption option;
227
228 bool ret = data.WriteInterfaceToken(GetDescriptor());
229 CHECK_AND_RETURN_RET_LOG(ret, -1, "WriteInterfaceToken failed");
230 data.WriteInt32(appUid);
231 int32_t error = Remote()->SendRequest(
232 static_cast<uint32_t>(AudioPolicyInterfaceCode::GET_APP_VOLUMELEVEL), data, reply, option);
233 CHECK_AND_RETURN_RET_LOG(error == ERR_NONE, error, "get volume failed, error: %d", error);
234 return reply.ReadInt32();
235 }
236
SetLowPowerVolume(int32_t streamId,float volume)237 int32_t AudioPolicyProxy::SetLowPowerVolume(int32_t streamId, float volume)
238 {
239 MessageParcel data;
240 MessageParcel reply;
241 MessageOption option;
242 bool ret = data.WriteInterfaceToken(GetDescriptor());
243 CHECK_AND_RETURN_RET_LOG(ret, -1, "WriteInterfaceToken failed");
244
245 data.WriteInt32(streamId);
246 data.WriteFloat(volume);
247 int32_t error = Remote()->SendRequest(
248 static_cast<uint32_t>(AudioPolicyInterfaceCode::SET_LOW_POWER_STREM_VOLUME), data, reply, option);
249 CHECK_AND_RETURN_RET_LOG(error == ERR_NONE, error, "set low power stream volume failed, error: %d", error);
250 return reply.ReadInt32();
251 }
252
GetLowPowerVolume(int32_t streamId)253 float AudioPolicyProxy::GetLowPowerVolume(int32_t streamId)
254 {
255 MessageParcel data;
256 MessageParcel reply;
257 MessageOption option;
258
259 bool ret = data.WriteInterfaceToken(GetDescriptor());
260 CHECK_AND_RETURN_RET_LOG(ret, -1, "WriteInterfaceToken failed");
261 data.WriteInt32(streamId);
262 int32_t error = Remote()->SendRequest(
263 static_cast<uint32_t>(AudioPolicyInterfaceCode::GET_LOW_POWRR_STREM_VOLUME), data, reply, option);
264 CHECK_AND_RETURN_RET_LOG(error == ERR_NONE, error, "get low power stream volume failed, error: %d", error);
265 return reply.ReadFloat();
266 }
267
GetSingleStreamVolume(int32_t streamId)268 float AudioPolicyProxy::GetSingleStreamVolume(int32_t streamId)
269 {
270 MessageParcel data;
271 MessageParcel reply;
272 MessageOption option;
273
274 bool ret = data.WriteInterfaceToken(GetDescriptor());
275 CHECK_AND_RETURN_RET_LOG(ret, -1, "WriteInterfaceToken failed");
276 data.WriteInt32(streamId);
277 int32_t error = Remote()->SendRequest(
278 static_cast<uint32_t>(AudioPolicyInterfaceCode::GET_SINGLE_STREAM_VOLUME), data, reply, option);
279 CHECK_AND_RETURN_RET_LOG(error == ERR_NONE, error, "get single stream volume failed, error: %d", error);
280 return reply.ReadFloat();
281 }
282
IsVolumeUnadjustable()283 bool AudioPolicyProxy::IsVolumeUnadjustable()
284 {
285 MessageParcel data;
286 MessageParcel reply;
287 MessageOption option;
288
289 bool ret = data.WriteInterfaceToken(GetDescriptor());
290 CHECK_AND_RETURN_RET_LOG(ret, false, "WriteInterfaceToken failed");
291 int32_t error = Remote()->SendRequest(
292 static_cast<uint32_t>(AudioPolicyInterfaceCode::IS_VOLUME_UNADJUSTABLE), data, reply, option);
293 if (error != ERR_NONE) {
294 AUDIO_ERR_LOG("isvolumeadjustable failed, error: %d", error);
295 }
296 return reply.ReadBool();
297 }
298
AdjustVolumeByStep(VolumeAdjustType adjustType)299 int32_t AudioPolicyProxy::AdjustVolumeByStep(VolumeAdjustType adjustType)
300 {
301 MessageParcel data;
302 MessageParcel reply;
303 MessageOption option;
304
305 bool ret = data.WriteInterfaceToken(GetDescriptor());
306 CHECK_AND_RETURN_RET_LOG(ret, IPC_PROXY_ERR, "WriteInterfaceToken failed");
307
308 data.WriteInt32(adjustType);
309
310 int32_t error = Remote()->SendRequest(
311 static_cast<uint32_t>(AudioPolicyInterfaceCode::ADJUST_VOLUME_BY_STEP), data, reply, option);
312 CHECK_AND_RETURN_RET_LOG(error == ERR_NONE, ERR_TRANSACTION_FAILED, "error: %d", error);
313
314 return reply.ReadInt32();
315 }
316
AdjustSystemVolumeByStep(AudioVolumeType volumeType,VolumeAdjustType adjustType)317 int32_t AudioPolicyProxy::AdjustSystemVolumeByStep(AudioVolumeType volumeType, VolumeAdjustType adjustType)
318 {
319 MessageParcel data;
320 MessageParcel reply;
321 MessageOption option;
322
323 bool ret = data.WriteInterfaceToken(GetDescriptor());
324 CHECK_AND_RETURN_RET_LOG(ret, IPC_PROXY_ERR, "WriteInterfaceToken failed");
325 data.WriteInt32(volumeType);
326 data.WriteInt32(adjustType);
327
328 int32_t error = Remote()->SendRequest(
329 static_cast<uint32_t>(AudioPolicyInterfaceCode::ADJUST_SYSTEM_VOLUME_BY_STEP), data, reply, option);
330 CHECK_AND_RETURN_RET_LOG(error == ERR_NONE, ERR_TRANSACTION_FAILED, "error: %d", error);
331
332 return reply.ReadInt32();
333 }
334
GetSystemVolumeInDb(AudioVolumeType volumeType,int32_t volumeLevel,DeviceType deviceType)335 float AudioPolicyProxy::GetSystemVolumeInDb(AudioVolumeType volumeType, int32_t volumeLevel, DeviceType deviceType)
336 {
337 MessageParcel data;
338 MessageParcel reply;
339 MessageOption option;
340
341 bool ret = data.WriteInterfaceToken(GetDescriptor());
342 CHECK_AND_RETURN_RET_LOG(ret, false, "WriteInterfaceToken failed");
343
344 data.WriteInt32(static_cast<int32_t>(volumeType));
345 data.WriteInt32(volumeLevel);
346 data.WriteInt32(static_cast<int32_t>(deviceType));
347
348 int32_t error = Remote()->SendRequest(
349 static_cast<uint32_t>(AudioPolicyInterfaceCode::GET_SYSTEM_VOLUME_IN_DB), data, reply, option);
350 if (error != ERR_NONE) {
351 AUDIO_ERR_LOG("GetSystemVolumeInDb failed, error: %d", error);
352 }
353
354 return reply.ReadFloat();
355 }
356
GetVolumeGroupInfos(std::string networkId,std::vector<sptr<VolumeGroupInfo>> & infos)357 int32_t AudioPolicyProxy::GetVolumeGroupInfos(std::string networkId, std::vector<sptr<VolumeGroupInfo>> &infos)
358 {
359 MessageParcel data;
360 MessageParcel reply;
361 MessageOption option;
362
363 bool res = data.WriteInterfaceToken(GetDescriptor());
364 CHECK_AND_RETURN_RET_LOG(res, ERROR, "WriteInterfaceToken failed");
365
366 data.WriteString(networkId);
367 int32_t error = Remote()->SendRequest(
368 static_cast<uint32_t>(AudioPolicyInterfaceCode::GET_VOLUME_GROUP_INFO), data, reply, option);
369 CHECK_AND_RETURN_RET_LOG(error == ERR_NONE, error, "GetVolumeGroupInfo, error: %d", error);
370
371 int32_t ret = reply.ReadInt32();
372 if (ret > 0) {
373 for (int32_t i = 0; i < ret; i++) {
374 infos.push_back(VolumeGroupInfo::Unmarshalling(reply));
375 }
376 return SUCCESS;
377 } else {
378 return ret;
379 }
380 }
381
GetMinStreamVolume()382 float AudioPolicyProxy::GetMinStreamVolume()
383 {
384 MessageParcel data;
385 MessageParcel reply;
386 MessageOption option;
387
388 bool ret = data.WriteInterfaceToken(GetDescriptor());
389 CHECK_AND_RETURN_RET_LOG(ret, -1, "WriteInterfaceToken failed");
390 int32_t error = Remote()->SendRequest(
391 static_cast<uint32_t>(AudioPolicyInterfaceCode::GET_MIN_VOLUME_STREAM), data, reply, option);
392 CHECK_AND_RETURN_RET_LOG(error == ERR_NONE, error, "get min volume for stream failed, error: %d", error);
393 return reply.ReadFloat();
394 }
395
GetMaxStreamVolume()396 float AudioPolicyProxy::GetMaxStreamVolume()
397 {
398 MessageParcel data;
399 MessageParcel reply;
400 MessageOption option;
401
402 bool ret = data.WriteInterfaceToken(GetDescriptor());
403 CHECK_AND_RETURN_RET_LOG(ret, -1, "WriteInterfaceToken failed");
404 int32_t error = Remote()->SendRequest(
405 static_cast<uint32_t>(AudioPolicyInterfaceCode::GET_MAX_VOLUME_STREAM), data, reply, option);
406 CHECK_AND_RETURN_RET_LOG(error == ERR_NONE, error, "get max volume for stream failed, error: %d", error);
407 return reply.ReadFloat();
408 }
409
SetDeviceAbsVolumeSupported(const std::string & macAddress,const bool support)410 int32_t AudioPolicyProxy::SetDeviceAbsVolumeSupported(const std::string &macAddress, const bool support)
411 {
412 MessageParcel data;
413 MessageParcel reply;
414 MessageOption option;
415
416 bool ret = data.WriteInterfaceToken(GetDescriptor());
417 CHECK_AND_RETURN_RET_LOG(ret, ERROR, "WriteInterfaceToken failed");
418 data.WriteString(macAddress);
419 data.WriteBool(support);
420
421 int32_t error = Remote()->SendRequest(
422 static_cast<uint32_t>(AudioPolicyInterfaceCode::SET_DEVICE_ABSOLUTE_VOLUME_SUPPORTED), data, reply, option);
423 CHECK_AND_RETURN_RET_LOG(error == ERR_NONE, ERROR,
424 "SetDeviceAbsVolumeSupported failed, error: %d", error);
425 return reply.ReadInt32();
426 }
427
IsAbsVolumeScene()428 bool AudioPolicyProxy::IsAbsVolumeScene()
429 {
430 MessageParcel data;
431 MessageParcel reply;
432 MessageOption option;
433
434 bool ret = data.WriteInterfaceToken(GetDescriptor());
435 CHECK_AND_RETURN_RET_LOG(ret, ERROR, "WriteInterfaceToken failed");
436
437 int32_t error = Remote()->SendRequest(
438 static_cast<uint32_t>(AudioPolicyInterfaceCode::GET_ABS_VOLUME_SCENE), data, reply, option);
439 CHECK_AND_RETURN_RET_LOG(error == ERR_NONE, ERROR, "IsAbsVolumeScene failed, error: %d", error);
440 return reply.ReadBool();
441 }
442
SetA2dpDeviceVolume(const std::string & macAddress,const int32_t volume,const bool updateUi)443 int32_t AudioPolicyProxy::SetA2dpDeviceVolume(const std::string &macAddress, const int32_t volume,
444 const bool updateUi)
445 {
446 MessageParcel data;
447 MessageParcel reply;
448 MessageOption option;
449
450 bool ret = data.WriteInterfaceToken(GetDescriptor());
451 CHECK_AND_RETURN_RET_LOG(ret, ERROR, "WriteInterfaceToken failed");
452 data.WriteString(macAddress);
453 data.WriteInt32(volume);
454 data.WriteBool(updateUi);
455
456 int32_t error = Remote()->SendRequest(
457 static_cast<uint32_t>(AudioPolicyInterfaceCode::SET_A2DP_DEVICE_VOLUME), data, reply, option);
458 CHECK_AND_RETURN_RET_LOG(error == ERR_NONE, ERROR, "SetA2dpDeviceVolume failed, error: %d", error);
459 return reply.ReadInt32();
460 }
461
DisableSafeMediaVolume()462 int32_t AudioPolicyProxy::DisableSafeMediaVolume()
463 {
464 MessageParcel data;
465 MessageParcel reply;
466 MessageOption option;
467
468 bool ret = data.WriteInterfaceToken(GetDescriptor());
469 CHECK_AND_RETURN_RET_LOG(ret, ERROR, "WriteInterfaceToken failed");
470
471 int32_t error = Remote()->SendRequest(
472 static_cast<uint32_t>(AudioPolicyInterfaceCode::DISABLE_SAFE_MEDIA_VOLUME), data, reply, option);
473 CHECK_AND_RETURN_RET_LOG(error == ERR_NONE, ERROR, "SendRequest failed, error: %{public}d", error);
474 return reply.ReadInt32();
475 }
476
477 } // namespace AudioStandard
478 } // namespace OHOS