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 "bluetooth_hfp_ag_stub.h"
17 
18 #include "bluetooth_errorcode.h"
19 #include "bluetooth_log.h"
20 
21 namespace OHOS {
22 namespace Bluetooth {
BluetoothHfpAgStub()23 BluetoothHfpAgStub::BluetoothHfpAgStub() {
24     HILOGI("%{public}s start.", __func__);
25     memberFuncMap_[static_cast<uint32_t>(BluetoothHfpAgInterfaceCode::BT_HFP_AG_GET_CONNECT_DEVICES)] =
26         &BluetoothHfpAgStub::GetConnectDevicesInner;
27     memberFuncMap_[static_cast<uint32_t>(BluetoothHfpAgInterfaceCode::BT_HFP_AG_GET_DEVICES_BY_STATES)] =
28         &BluetoothHfpAgStub::GetDevicesByStatesInner;
29     memberFuncMap_[static_cast<uint32_t>(BluetoothHfpAgInterfaceCode::BT_HFP_AG_GET_DEVICE_STATE)] =
30         &BluetoothHfpAgStub::GetDeviceStateInner;
31     memberFuncMap_[static_cast<uint32_t>(BluetoothHfpAgInterfaceCode::BT_HFP_AG_CONNECT)] =
32         &BluetoothHfpAgStub::ConnectInner;
33     memberFuncMap_[static_cast<uint32_t>(BluetoothHfpAgInterfaceCode::BT_HFP_AG_DISCONNECT)] =
34         &BluetoothHfpAgStub::DisconnectInner;
35     memberFuncMap_[static_cast<uint32_t>(BluetoothHfpAgInterfaceCode::BT_HFP_AG_GET_SCO_STATE)] =
36         &BluetoothHfpAgStub::GetScoStateInner;
37     memberFuncMap_[static_cast<uint32_t>(BluetoothHfpAgInterfaceCode::BT_HFP_AG_CONNECT_SCO)] =
38         &BluetoothHfpAgStub::ConnectScoInner;
39     memberFuncMap_[static_cast<uint32_t>(BluetoothHfpAgInterfaceCode::BT_HFP_AG_DISCONNECT_SCO)] =
40         &BluetoothHfpAgStub::DisconnectScoInner;
41     memberFuncMap_[static_cast<uint32_t>(BluetoothHfpAgInterfaceCode::BT_HFP_AG_PHONE_STATE_CHANGED)] =
42         &BluetoothHfpAgStub::PhoneStateChangedInner;
43     memberFuncMap_[static_cast<uint32_t>(BluetoothHfpAgInterfaceCode::BT_HFP_AG_CLCC_RESPONSE)] =
44         &BluetoothHfpAgStub::ClccResponseInner;
45     memberFuncMap_[static_cast<uint32_t>(BluetoothHfpAgInterfaceCode::BT_HFP_AG_OPEN_VOICE_RECOGNITION)] =
46         &BluetoothHfpAgStub::OpenVoiceRecognitionInner;
47     memberFuncMap_[static_cast<uint32_t>(BluetoothHfpAgInterfaceCode::BT_HFP_AG_CLOSE_VOICE_RECOGNITION)] =
48         &BluetoothHfpAgStub::CloseVoiceRecognitionInner;
49     memberFuncMap_[static_cast<uint32_t>(BluetoothHfpAgInterfaceCode::BT_HFP_AG_SET_ACTIVE_DEVICE)] =
50         &BluetoothHfpAgStub::SetActiveDeviceInner;
51     memberFuncMap_[static_cast<uint32_t>(BluetoothHfpAgInterfaceCode::BT_HFP_AG_GET_ACTIVE_DEVICE)] =
52         &BluetoothHfpAgStub::GetActiveDeviceInner;
53     memberFuncMap_[static_cast<uint32_t>(BluetoothHfpAgInterfaceCode::BT_HFP_AG_INTO_MOCK)] =
54         &BluetoothHfpAgStub::IntoMockInner;
55     memberFuncMap_[static_cast<uint32_t>(BluetoothHfpAgInterfaceCode::BT_HFP_AG_SEND_NO_CARRIER)] =
56         &BluetoothHfpAgStub::SendNoCarrierInner;
57     memberFuncMap_[static_cast<uint32_t>(BluetoothHfpAgInterfaceCode::BT_HFP_AG_REGISTER_OBSERVER)] =
58         &BluetoothHfpAgStub::RegisterObserverInner;
59     memberFuncMap_[static_cast<uint32_t>(BluetoothHfpAgInterfaceCode::BT_HFP_AG_DEREGISTER_OBSERVER)] =
60         &BluetoothHfpAgStub::DeregisterObserverInner;
61     memberFuncMap_[static_cast<uint32_t>(BluetoothHfpAgInterfaceCode::BT_HFP_AG_SET_CONNECT_STRATEGY)] =
62         &BluetoothHfpAgStub::SetConnectStrategyInner;
63     memberFuncMap_[static_cast<uint32_t>(BluetoothHfpAgInterfaceCode::BT_HFP_AG_GET_CONNECT_STRATEGY)] =
64         &BluetoothHfpAgStub::GetConnectStrategyInner;
65     memberFuncMap_[static_cast<uint32_t>(BluetoothHfpAgInterfaceCode::BT_HFP_AG_IS_IN_BAND_RINGING_ENABLE)] =
66         &BluetoothHfpAgStub::IsInbandRingingEnabledInner;
67     memberFuncMap_[static_cast<uint32_t>(BluetoothHfpAgInterfaceCode::BT_HFP_AG_CONNECT_SCO_EX)] =
68         &BluetoothHfpAgStub::ConnectScoInnerEx;
69     memberFuncMap_[static_cast<uint32_t>(BluetoothHfpAgInterfaceCode::BT_HFP_AG_DISCONNECT_SCO_EX)] =
70         &BluetoothHfpAgStub::DisconnectScoInnerEx;
71     memberFuncMap_[static_cast<uint32_t>(BluetoothHfpAgInterfaceCode::BT_HFP_AG_CALL_DETAILS_CHANGED)] =
72         &BluetoothHfpAgStub::CallDetailsChangedInner;
73     memberFuncMap_[static_cast<uint32_t>(BluetoothHfpAgInterfaceCode::BT_HFP_AG_IS_VGS_SUPPORTED)] =
74         &BluetoothHfpAgStub::IsVgsSupportedInner;
75     memberFuncMap_[static_cast<uint32_t>(BluetoothHfpAgInterfaceCode::BT_HFP_AG_CALL_LOG)] =
76         &BluetoothHfpAgStub::EnableBtCallLogInner;
77     memberFuncMap_[static_cast<uint32_t>(BluetoothHfpAgInterfaceCode::BT_HFP_AG_GET_VIRTUALDEVICE_LIST)] =
78         &BluetoothHfpAgStub::GetVirtualDeviceListInner;
79     memberFuncMap_[static_cast<uint32_t>(BluetoothHfpAgInterfaceCode::BT_HFP_AG_UPDATE_VIRTUALDEVICE)] =
80         &BluetoothHfpAgStub::UpdateVirtualDeviceInner;
81     HILOGI("%{public}s ends.", __func__);
82 }
83 
~BluetoothHfpAgStub()84 BluetoothHfpAgStub::~BluetoothHfpAgStub()
85 {
86     HILOGI("%{public}s start.", __func__);
87     memberFuncMap_.clear();
88 }
89 
OnRemoteRequest(uint32_t code,MessageParcel & data,MessageParcel & reply,MessageOption & option)90 int BluetoothHfpAgStub::OnRemoteRequest(
91     uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option)
92 {
93     HILOGI("BluetoothHfpAgStub::OnRemoteRequest, cmd = %{public}d, flags= %{public}d", code, option.GetFlags());
94     if (BluetoothHfpAgStub::GetDescriptor() != data.ReadInterfaceToken()) {
95         HILOGI("local descriptor is not equal to remote");
96         return ERR_INVALID_STATE;
97     }
98 
99     auto itFunc = memberFuncMap_.find(code);
100     if (itFunc != memberFuncMap_.end()) {
101         auto memberFunc = itFunc->second;
102         if (memberFunc != nullptr) {
103             return (this->*memberFunc)(data, reply);
104         }
105     }
106     HILOGW("BluetoothHfpAgStub::OnRemoteRequest, default case, need check.");
107     return IPCObjectStub::OnRemoteRequest(code, data, reply, option);
108 }
109 
GetConnectDevicesInner(MessageParcel & data,MessageParcel & reply)110 int32_t BluetoothHfpAgStub::GetConnectDevicesInner(MessageParcel &data, MessageParcel &reply)
111 {
112     std::vector<BluetoothRawAddress> devices;
113     GetConnectDevices(devices);
114     uint32_t DevNum = devices.size();
115     if (!reply.WriteUint32(DevNum)) {
116         HILOGE("BluetoothHfpAgStub:WriteInt32 failed in: %{public}s.", __func__);
117         return BT_ERR_IPC_TRANS_FAILED;
118     }
119     for (uint32_t i = 0; i < DevNum; i++) {
120         if (!reply.WriteParcelable(&devices[i])) {
121             HILOGE("BluetoothHfpAgStub:WriteParcelable failed in: %{public}s.", __func__);
122             return BT_ERR_IPC_TRANS_FAILED;
123         }
124     }
125     return NO_ERROR;
126 }
127 
GetDevicesByStatesInner(MessageParcel & data,MessageParcel & reply)128 ErrCode BluetoothHfpAgStub::GetDevicesByStatesInner(MessageParcel &data, MessageParcel &reply)
129 {
130     std::vector<BluetoothRawAddress> devices;
131     std::vector<int> states;
132     data.ReadInt32Vector(&states);
133     GetDevicesByStates(states, devices);
134     uint32_t DevNum = devices.size();
135     if (!reply.WriteUint32(DevNum)) {
136         HILOGE("BluetoothHfpAgStub:WriteInt32 failed in: %{public}s.", __func__);
137         return ERR_INVALID_VALUE;
138     }
139     for (uint32_t i = 0; i < DevNum; i++) {
140         if (!reply.WriteParcelable(&devices[i])) {
141             HILOGE("BluetoothHfpAgStub:WriteParcelable failed in: %{public}s.", __func__);
142             return ERR_INVALID_VALUE;
143         }
144     }
145     return NO_ERROR;
146 }
147 
GetDeviceStateInner(MessageParcel & data,MessageParcel & reply)148 ErrCode BluetoothHfpAgStub::GetDeviceStateInner(MessageParcel &data, MessageParcel &reply)
149 {
150     std::shared_ptr<BluetoothRawAddress> device(data.ReadParcelable<BluetoothRawAddress>());
151     if (!device) {
152         return BT_ERR_IPC_TRANS_FAILED;
153     }
154     int32_t state;
155     int32_t errCode = GetDeviceState(*device, state);
156     if (!reply.WriteInt32(errCode)) {
157         HILOGE("BluetoothHfpAgStub: reply writing failed in: %{public}s.", __func__);
158         return BT_ERR_IPC_TRANS_FAILED;
159     }
160     if (errCode != NO_ERROR) {
161         HILOGE("internal error.");
162         return BT_ERR_INTERNAL_ERROR;
163     }
164     // write state
165     if (!reply.WriteInt32(state)) {
166         HILOGE("reply write failed.");
167         return BT_ERR_IPC_TRANS_FAILED;
168     }
169     return NO_ERROR;
170 }
171 
ConnectInner(MessageParcel & data,MessageParcel & reply)172 int32_t BluetoothHfpAgStub::ConnectInner(MessageParcel &data, MessageParcel &reply)
173 {
174     std::shared_ptr<BluetoothRawAddress> device(data.ReadParcelable<BluetoothRawAddress>());
175     if (!device) {
176         return BT_ERR_IPC_TRANS_FAILED;
177     }
178     int32_t errCode = Connect(*device);
179     if (!reply.WriteInt32(errCode)) {
180         HILOGE("BluetoothHfpAgStub: reply writing failed in: %{public}s.", __func__);
181         return BT_ERR_IPC_TRANS_FAILED;
182     }
183     return NO_ERROR;
184 }
185 
DisconnectInner(MessageParcel & data,MessageParcel & reply)186 int32_t BluetoothHfpAgStub::DisconnectInner(MessageParcel &data, MessageParcel &reply)
187 {
188     std::shared_ptr<BluetoothRawAddress> device(data.ReadParcelable<BluetoothRawAddress>());
189     if (!device) {
190         return BT_ERR_IPC_TRANS_FAILED;
191     }
192     int32_t errCode = Disconnect(*device);
193     if (!reply.WriteInt32(errCode)) {
194         HILOGE("BluetoothHfpAgStub: reply writing failed in: %{public}s.", __func__);
195         return BT_ERR_IPC_TRANS_FAILED;
196     }
197     return NO_ERROR;
198 }
199 
GetScoStateInner(MessageParcel & data,MessageParcel & reply)200 ErrCode BluetoothHfpAgStub::GetScoStateInner(MessageParcel &data, MessageParcel &reply)
201 {
202     std::shared_ptr<BluetoothRawAddress> device(data.ReadParcelable<BluetoothRawAddress>());
203     if (!device) {
204         return TRANSACTION_ERR;
205     }
206     int result = GetScoState(*device);
207     if (!reply.WriteInt32(result)) {
208         HILOGE("BluetoothHfpAgStub: reply writing failed in: %{public}s.", __func__);
209         return ERR_INVALID_VALUE;
210     }
211     return NO_ERROR;
212 }
213 
ConnectScoInner(MessageParcel & data,MessageParcel & reply)214 ErrCode BluetoothHfpAgStub::ConnectScoInner(MessageParcel &data, MessageParcel &reply)
215 {
216     bool result = ConnectSco();
217     if (!reply.WriteBool(result)) {
218         HILOGE("BluetoothHfpAgStub: reply writing failed in: %{public}s.", __func__);
219         return ERR_INVALID_VALUE;
220     }
221     return NO_ERROR;
222 }
223 
DisconnectScoInner(MessageParcel & data,MessageParcel & reply)224 ErrCode BluetoothHfpAgStub::DisconnectScoInner(MessageParcel &data, MessageParcel &reply)
225 {
226     bool result = DisconnectSco();
227     if (!reply.WriteBool(result)) {
228         HILOGE("BluetoothHfpAgStub: reply writing failed in: %{public}s.", __func__);
229         return ERR_INVALID_VALUE;
230     }
231     return NO_ERROR;
232 }
233 
PhoneStateChangedInner(MessageParcel & data,MessageParcel & reply)234 ErrCode BluetoothHfpAgStub::PhoneStateChangedInner(MessageParcel &data, MessageParcel &reply)
235 {
236     std::shared_ptr<BluetoothPhoneState> phoneState(data.ReadParcelable<BluetoothPhoneState>());
237     CHECK_AND_RETURN_LOG_RET(phoneState, BT_ERR_IPC_TRANS_FAILED,
238         "BluetoothHfpAgStub: read phone state failed");
239     PhoneStateChanged(*phoneState);
240     return NO_ERROR;
241 }
242 
ClccResponseInner(MessageParcel & data,MessageParcel & reply)243 ErrCode BluetoothHfpAgStub::ClccResponseInner(MessageParcel &data, MessageParcel &reply)
244 {
245     int index = data.ReadInt32();
246     int direction = data.ReadInt32();
247     int status = data.ReadInt32();
248     int mode = data.ReadInt32();
249     bool mpty = data.ReadBool();
250     std::string number = data.ReadString();
251     int type = data.ReadInt32();
252     ClccResponse(index, direction, status, mode, mpty, number, type);
253     return NO_ERROR;
254 }
255 
OpenVoiceRecognitionInner(MessageParcel & data,MessageParcel & reply)256 ErrCode BluetoothHfpAgStub::OpenVoiceRecognitionInner(MessageParcel &data, MessageParcel &reply)
257 {
258     std::shared_ptr<BluetoothRawAddress> device(data.ReadParcelable<BluetoothRawAddress>());
259     if (!device) {
260         return TRANSACTION_ERR;
261     }
262     int result = OpenVoiceRecognition(*device);
263     if (!reply.WriteInt32(result)) {
264         HILOGE("BluetoothHfpAgStub: reply writing failed in: %{public}s.", __func__);
265         return ERR_INVALID_VALUE;
266     }
267     return NO_ERROR;
268 }
269 
CloseVoiceRecognitionInner(MessageParcel & data,MessageParcel & reply)270 ErrCode BluetoothHfpAgStub::CloseVoiceRecognitionInner(MessageParcel &data, MessageParcel &reply)
271 {
272     std::shared_ptr<BluetoothRawAddress> device(data.ReadParcelable<BluetoothRawAddress>());
273     if (!device) {
274         return TRANSACTION_ERR;
275     }
276     int result = CloseVoiceRecognition(*device);
277     if (!reply.WriteInt32(result)) {
278         HILOGE("BluetoothHfpAgStub: reply writing failed in: %{public}s.", __func__);
279         return ERR_INVALID_VALUE;
280     }
281     return NO_ERROR;
282 }
283 
SetActiveDeviceInner(MessageParcel & data,MessageParcel & reply)284 ErrCode BluetoothHfpAgStub::SetActiveDeviceInner(MessageParcel &data, MessageParcel &reply)
285 {
286     std::shared_ptr<BluetoothRawAddress> device(data.ReadParcelable<BluetoothRawAddress>());
287     if (!device) {
288         return TRANSACTION_ERR;
289     }
290     int result = SetActiveDevice(*device);
291     if (!reply.WriteInt32(result)) {
292         HILOGE("BluetoothHfpAgStub: reply writing failed in: %{public}s.", __func__);
293         return ERR_INVALID_VALUE;
294     }
295     return NO_ERROR;
296 }
297 
IntoMockInner(MessageParcel & data,MessageParcel & reply)298 ErrCode BluetoothHfpAgStub::IntoMockInner(MessageParcel &data, MessageParcel &reply)
299 {
300     std::shared_ptr<BluetoothRawAddress> device(data.ReadParcelable<BluetoothRawAddress>());
301     if (!device) {
302         return TRANSACTION_ERR;
303     }
304     int state = data.ReadInt32();
305     int result = IntoMock(*device, state);
306     if (!reply.WriteInt32(result)) {
307         HILOGE("BluetoothHfpAgStub: reply writing failed in: %{public}s.", __func__);
308         return ERR_INVALID_VALUE;
309     }
310     return NO_ERROR;
311 }
312 
SendNoCarrierInner(MessageParcel & data,MessageParcel & reply)313 ErrCode BluetoothHfpAgStub::SendNoCarrierInner(MessageParcel &data, MessageParcel &reply)
314 {
315     std::shared_ptr<BluetoothRawAddress> device(data.ReadParcelable<BluetoothRawAddress>());
316     if (!device) {
317         return TRANSACTION_ERR;
318     }
319     int result = SendNoCarrier(*device);
320     if (!reply.WriteInt32(result)) {
321         HILOGE("BluetoothHfpAgStub: reply writing failed in: %{public}s.", __func__);
322         return ERR_INVALID_VALUE;
323     }
324     return NO_ERROR;
325 }
326 
GetActiveDeviceInner(MessageParcel & data,MessageParcel & reply)327 ErrCode BluetoothHfpAgStub::GetActiveDeviceInner(MessageParcel &data, MessageParcel &reply)
328 {
329     std::string result = GetActiveDevice();
330     if (!reply.WriteString(result)) {
331         HILOGE("BluetoothHfpAgStub: reply writing failed in: %{public}s.", __func__);
332         return ERR_INVALID_VALUE;
333     }
334     return NO_ERROR;
335 }
336 
RegisterObserverInner(MessageParcel & data,MessageParcel & reply)337 ErrCode BluetoothHfpAgStub::RegisterObserverInner(MessageParcel &data, MessageParcel &reply)
338 {
339     sptr<IRemoteObject> tempObject = data.ReadRemoteObject();
340     sptr<IBluetoothHfpAgObserver> observer = iface_cast<IBluetoothHfpAgObserver>(tempObject);
341     RegisterObserver(observer);
342     return NO_ERROR;
343 }
344 
DeregisterObserverInner(MessageParcel & data,MessageParcel & reply)345 ErrCode BluetoothHfpAgStub::DeregisterObserverInner(MessageParcel &data, MessageParcel &reply)
346 {
347     sptr<IRemoteObject> tempObject = data.ReadRemoteObject();
348     sptr<IBluetoothHfpAgObserver> observer = iface_cast<IBluetoothHfpAgObserver>(tempObject);
349     DeregisterObserver(observer);
350     return NO_ERROR;
351 }
352 
SetConnectStrategyInner(MessageParcel & data,MessageParcel & reply)353 ErrCode BluetoothHfpAgStub::SetConnectStrategyInner(MessageParcel &data, MessageParcel &reply)
354 {
355     int result = BT_ERR_SYSTEM_PERMISSION_FAILED;
356     if (!reply.WriteInt32(result)) {
357         HILOGE("BluetoothHfpAgStub: reply writing failed in: %{public}s.", __func__);
358         return ERR_INVALID_VALUE;
359     }
360     return NO_ERROR;
361 }
362 
GetConnectStrategyInner(MessageParcel & data,MessageParcel & reply)363 ErrCode BluetoothHfpAgStub::GetConnectStrategyInner(MessageParcel &data, MessageParcel &reply)
364 {
365     return NO_ERROR;
366 }
367 
IsInbandRingingEnabledInner(MessageParcel & data,MessageParcel & reply)368 ErrCode BluetoothHfpAgStub::IsInbandRingingEnabledInner(MessageParcel &data, MessageParcel &reply)
369 {
370     bool isEnabled = true;
371     int result = IsInbandRingingEnabled(isEnabled);
372     if (!reply.WriteInt32(result)) {
373         HILOGE("BluetoothHfpAgStub: reply writing failed in: %{public}s.", __func__);
374         return ERR_INVALID_VALUE;
375     }
376     if (!reply.WriteBool(isEnabled)) {
377         HILOGE("BluetoothHfpAgStub: reply writing failed in: %{public}s.", __func__);
378         return ERR_INVALID_VALUE;
379     }
380     return NO_ERROR;
381 }
382 
ConnectScoInnerEx(MessageParcel & data,MessageParcel & reply)383 ErrCode BluetoothHfpAgStub::ConnectScoInnerEx(MessageParcel &data, MessageParcel &reply)
384 {
385     bool result = ConnectSco();
386     if (!reply.WriteBool(result)) {
387         HILOGE("BluetoothHfpAgStub: reply writing failed in: %{public}s.", __func__);
388         return ERR_INVALID_VALUE;
389     }
390     return NO_ERROR;
391 }
392 
DisconnectScoInnerEx(MessageParcel & data,MessageParcel & reply)393 ErrCode BluetoothHfpAgStub::DisconnectScoInnerEx(MessageParcel &data, MessageParcel &reply)
394 {
395     bool result = DisconnectSco();
396     if (!reply.WriteBool(result)) {
397         HILOGE("BluetoothHfpAgStub: reply writing failed in: %{public}s.", __func__);
398         return ERR_INVALID_VALUE;
399     }
400     return NO_ERROR;
401 }
402 
CallDetailsChangedInner(MessageParcel & data,MessageParcel & reply)403 ErrCode BluetoothHfpAgStub::CallDetailsChangedInner(MessageParcel &data, MessageParcel &reply)
404 {
405     return NO_ERROR;
406 }
407 
EnableBtCallLogInner(MessageParcel & data,MessageParcel & reply)408 ErrCode BluetoothHfpAgStub::EnableBtCallLogInner(MessageParcel &data, MessageParcel &reply)
409 {
410     return NO_ERROR;
411 }
412 
IsVgsSupportedInner(MessageParcel & data,MessageParcel & reply)413 int32_t BluetoothHfpAgStub::IsVgsSupportedInner(MessageParcel &data, MessageParcel &reply)
414 {
415     std::shared_ptr<BluetoothRawAddress> device(data.ReadParcelable<BluetoothRawAddress>());
416     CHECK_AND_RETURN_LOG_RET(device, BT_ERR_IPC_TRANS_FAILED, "Read device address failed.");
417     bool isSupported = false;
418     int32_t result = IsVgsSupported(*device, isSupported);
419     CHECK_AND_RETURN_LOG_RET(reply.WriteInt32(result), BT_ERR_INTERNAL_ERROR, "reply WriteInt32 failed");
420     CHECK_AND_RETURN_LOG_RET(reply.WriteBool(isSupported), BT_ERR_INTERNAL_ERROR, "reply WriteBool failed");
421     return NO_ERROR;
422 }
423 
UpdateVirtualDeviceInner(MessageParcel & data,MessageParcel & reply)424 int32_t BluetoothHfpAgStub::UpdateVirtualDeviceInner(MessageParcel &data, MessageParcel &reply)
425 {
426     return BT_ERR_API_NOT_SUPPORT;
427 }
428 
GetVirtualDeviceListInner(MessageParcel & data,MessageParcel & reply)429 int32_t BluetoothHfpAgStub::GetVirtualDeviceListInner(MessageParcel &data, MessageParcel &reply)
430 {
431     return BT_ERR_API_NOT_SUPPORT;
432 }
433 }  // namespace Bluetooth
434 }  // namespace OHOS
435