• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 "call_ability_callback_stub.h"
17 
18 #include <securec.h>
19 
20 #include "call_manager_errors.h"
21 #include "telephony_log_wrapper.h"
22 #include "native_call_manager_utils.h"
23 
24 namespace OHOS {
25 namespace Telephony {
26 const int32_t MAX_LEN = 100000;
CallAbilityCallbackStub()27 CallAbilityCallbackStub::CallAbilityCallbackStub()
28 {
29     memberFuncMap_[static_cast<uint32_t>(CallManagerCallAbilityInterfaceCode::UPDATE_CALL_STATE_INFO)] =
30         [this](MessageParcel &data, MessageParcel &reply) { return OnUpdateCallStateInfo(data, reply); };
31     memberFuncMap_[static_cast<uint32_t>(CallManagerCallAbilityInterfaceCode::UPDATE_MEETIME_STATE_INFO)] =
32         [this](MessageParcel &data, MessageParcel &reply) { return OnUpdateMeeTimeStateInfo(data, reply); };
33     memberFuncMap_[static_cast<uint32_t>(CallManagerCallAbilityInterfaceCode::UPDATE_CALL_EVENT)] =
34         [this](MessageParcel &data, MessageParcel &reply) { return OnUpdateCallEvent(data, reply); };
35     memberFuncMap_[static_cast<uint32_t>(CallManagerCallAbilityInterfaceCode::UPDATE_CALL_DISCONNECTED_CAUSE)] =
36         [this](MessageParcel &data, MessageParcel &reply) { return OnUpdateCallDisconnectedCause(data, reply); };
37     memberFuncMap_[static_cast<uint32_t>(CallManagerCallAbilityInterfaceCode::UPDATE_CALL_ASYNC_RESULT_REQUEST)] =
38         [this](MessageParcel &data, MessageParcel &reply) { return OnUpdateAysncResults(data, reply); };
39     memberFuncMap_[static_cast<uint32_t>(CallManagerCallAbilityInterfaceCode::REPORT_OTT_CALL_REQUEST)] =
40         [this](MessageParcel &data, MessageParcel &reply) { return OnUpdateOttCallRequest(data, reply); };
41     memberFuncMap_[static_cast<uint32_t>(CallManagerCallAbilityInterfaceCode::UPDATE_MMI_CODE_RESULT_REQUEST)] =
42         [this](MessageParcel &data, MessageParcel &reply) { return OnUpdateMmiCodeResults(data, reply); };
43     memberFuncMap_[static_cast<uint32_t>(
44         CallManagerCallAbilityInterfaceCode::UPDATE_AUDIO_DEVICE_CHANGE_RESULT_REQUEST)] =
45         [this](MessageParcel &data, MessageParcel &reply) { return OnUpdateAudioDeviceChange(data, reply); };
46     memberFuncMap_[static_cast<uint32_t>(CallManagerCallAbilityInterfaceCode::REPORT_POST_DIAL_DELAY)] =
47         [this](MessageParcel &data, MessageParcel &reply) { return OnUpdatePostDialDelay(data, reply); };
48     memberFuncMap_[static_cast<uint32_t>(CallManagerCallAbilityInterfaceCode::UPDATE_IMS_CALL_MODE_RECEIVE)] =
49         [this](MessageParcel &data, MessageParcel &reply) { return OnUpdateImsCallModeChange(data, reply); };
50     memberFuncMap_[static_cast<uint32_t>(CallManagerCallAbilityInterfaceCode::CALL_SESSION_EVENT_CHANGE)] =
51         [this](MessageParcel &data, MessageParcel &reply) { return OnUpdateCallSessionEventChange(data, reply); };
52     memberFuncMap_[static_cast<uint32_t>(CallManagerCallAbilityInterfaceCode::PEERD_DIMENSIONS_CHANGE)] =
53         [this](MessageParcel &data, MessageParcel &reply) { return OnUpdatePeerDimensionsChange(data, reply); };
54     memberFuncMap_[static_cast<uint32_t>(CallManagerCallAbilityInterfaceCode::CALL_DATA_USAGE_CHANGE)] =
55         [this](MessageParcel &data, MessageParcel &reply) { return OnUpdateCallDataUsageChange(data, reply); };
56     memberFuncMap_[static_cast<uint32_t>(CallManagerCallAbilityInterfaceCode::CAMERA_CAPABILITIES_CHANGE)] =
57         [this](MessageParcel &data, MessageParcel &reply) { return OnUpdateCameraCapabilities(data, reply); };
58     memberFuncMap_[static_cast<uint32_t>(CallManagerCallAbilityInterfaceCode::UPDATE_PHONE_STATE)] =
59         [this](MessageParcel &data, MessageParcel &reply) { return OnUpdatePhoneState(data, reply); };
60 }
61 
~CallAbilityCallbackStub()62 CallAbilityCallbackStub::~CallAbilityCallbackStub() {}
63 
OnRemoteRequest(uint32_t code,MessageParcel & data,MessageParcel & reply,MessageOption & option)64 int32_t CallAbilityCallbackStub::OnRemoteRequest(
65     uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option)
66 {
67     std::u16string myDescriptor = CallAbilityCallbackStub::GetDescriptor();
68     std::u16string remoteDescriptor = data.ReadInterfaceToken();
69     if (myDescriptor != remoteDescriptor) {
70         TELEPHONY_LOGE("descriptor checked failed");
71         return TELEPHONY_ERR_DESCRIPTOR_MISMATCH;
72     }
73     TELEPHONY_LOGD("OnReceived, cmd = %{public}u", code);
74     auto itFunc = memberFuncMap_.find(code);
75     if (itFunc != memberFuncMap_.end()) {
76         auto memberFunc = itFunc->second;
77         if (memberFunc != nullptr) {
78             return memberFunc(data, reply);
79         }
80     }
81     return IPCObjectStub::OnRemoteRequest(code, data, reply, option);
82 }
83 
OnUpdateCallStateInfo(MessageParcel & data,MessageParcel & reply)84 int32_t CallAbilityCallbackStub::OnUpdateCallStateInfo(MessageParcel &data, MessageParcel &reply)
85 {
86     int32_t result = TELEPHONY_SUCCESS;
87     if (!data.ContainFileDescriptors()) {
88         TELEPHONY_LOGD("sent raw data is less than 32k");
89     }
90     CallAttributeInfo parcelPtr = NativeCallManagerUtils::ReadCallAttributeInfo(data);
91     result = OnCallDetailsChange(parcelPtr);
92     if (!reply.WriteInt32(result)) {
93         TELEPHONY_LOGE("writing parcel failed");
94         return TELEPHONY_ERR_WRITE_REPLY_FAIL;
95     }
96     return TELEPHONY_SUCCESS;
97 }
98 
OnUpdateMeeTimeStateInfo(MessageParcel & data,MessageParcel & reply)99 int32_t CallAbilityCallbackStub::OnUpdateMeeTimeStateInfo(MessageParcel &data, MessageParcel &reply)
100 {
101     int32_t result = TELEPHONY_SUCCESS;
102     if (!data.ContainFileDescriptors()) {
103         TELEPHONY_LOGD("sent raw data is less than 32k");
104     }
105     CallAttributeInfo parcelPtr = NativeCallManagerUtils::ReadCallAttributeInfo(data);
106     result = OnMeeTimeDetailsChange(parcelPtr);
107     if (!reply.WriteInt32(result)) {
108         TELEPHONY_LOGE("writing parcel failed");
109         return TELEPHONY_ERR_WRITE_REPLY_FAIL;
110     }
111     return TELEPHONY_SUCCESS;
112 }
113 
OnUpdateCallEvent(MessageParcel & data,MessageParcel & reply)114 int32_t CallAbilityCallbackStub::OnUpdateCallEvent(MessageParcel &data, MessageParcel &reply)
115 {
116     int32_t result = TELEPHONY_SUCCESS;
117     const CallEventInfo *parcelPtr = nullptr;
118     int32_t len = data.ReadInt32();
119     if (len <= 0 || len >= MAX_LEN) {
120         TELEPHONY_LOGE("Invalid parameter, len = %{public}d", len);
121         return TELEPHONY_ERR_ARGUMENT_INVALID;
122     }
123     if (!data.ContainFileDescriptors()) {
124         TELEPHONY_LOGW("sent raw data is less than 32k");
125     }
126     if ((parcelPtr = reinterpret_cast<const CallEventInfo *>(data.ReadRawData(sizeof(CallEventInfo)))) == nullptr) {
127         TELEPHONY_LOGE("reading raw data failed, length = %d", len);
128         return TELEPHONY_ERR_LOCAL_PTR_NULL;
129     }
130 
131     CallEventInfo info = *parcelPtr;
132     result = OnCallEventChange(info);
133     if (!reply.WriteInt32(result)) {
134         TELEPHONY_LOGE("writing parcel failed");
135         return TELEPHONY_ERR_WRITE_REPLY_FAIL;
136     }
137     return TELEPHONY_SUCCESS;
138 }
139 
OnUpdateCallDisconnectedCause(MessageParcel & data,MessageParcel & reply)140 int32_t CallAbilityCallbackStub::OnUpdateCallDisconnectedCause(MessageParcel &data, MessageParcel &reply)
141 {
142     DisconnectedDetails dcDetails;
143     dcDetails.reason = static_cast<DisconnectedReason>(data.ReadInt32());
144     dcDetails.message = data.ReadString();
145     int32_t result = OnCallDisconnectedCause(dcDetails);
146     if (!reply.WriteInt32(result)) {
147         TELEPHONY_LOGE("writing parcel failed");
148         return TELEPHONY_ERR_WRITE_REPLY_FAIL;
149     }
150     return TELEPHONY_SUCCESS;
151 }
152 
OnUpdateAysncResults(MessageParcel & data,MessageParcel & reply)153 int32_t CallAbilityCallbackStub::OnUpdateAysncResults(MessageParcel &data, MessageParcel &reply)
154 {
155     int32_t result = TELEPHONY_SUCCESS;
156     AppExecFwk::PacMap resultInfo;
157     CallResultReportId reportId = static_cast<CallResultReportId>(data.ReadInt32());
158     resultInfo.PutIntValue("result", data.ReadInt32());
159     switch (reportId) {
160         case CallResultReportId::GET_CALL_WAITING_REPORT_ID:
161         case CallResultReportId::GET_CALL_RESTRICTION_REPORT_ID:
162             resultInfo.PutIntValue("status", data.ReadInt32());
163             resultInfo.PutIntValue("classCw", data.ReadInt32());
164             break;
165         case CallResultReportId::GET_CALL_TRANSFER_REPORT_ID:
166             resultInfo.PutIntValue("status", data.ReadInt32());
167             resultInfo.PutIntValue("classx", data.ReadInt32());
168             resultInfo.PutStringValue("number", data.ReadString());
169             resultInfo.PutIntValue("type", data.ReadInt32());
170             resultInfo.PutIntValue("reason", data.ReadInt32());
171             resultInfo.PutIntValue("time", data.ReadInt32());
172             break;
173         case CallResultReportId::GET_CALL_CLIP_ID:
174             resultInfo.PutIntValue("action", data.ReadInt32());
175             resultInfo.PutIntValue("clipStat", data.ReadInt32());
176             break;
177         case CallResultReportId::GET_CALL_CLIR_ID:
178             resultInfo.PutIntValue("action", data.ReadInt32());
179             resultInfo.PutIntValue("clirStat", data.ReadInt32());
180             break;
181         case CallResultReportId::START_RTT_REPORT_ID:
182             resultInfo.PutIntValue("active", data.ReadInt32());
183             break;
184         case CallResultReportId::GET_IMS_CONFIG_REPORT_ID:
185         case CallResultReportId::GET_IMS_FEATURE_VALUE_REPORT_ID:
186             resultInfo.PutIntValue("value", data.ReadInt32());
187             break;
188         case CallResultReportId::STOP_RTT_REPORT_ID:
189             resultInfo.PutIntValue("inactive", data.ReadInt32());
190             break;
191         default:
192             break;
193     }
194     if (!data.ContainFileDescriptors()) {
195         TELEPHONY_LOGW("sent raw data is less than 32k");
196     }
197     result = OnReportAsyncResults(reportId, resultInfo);
198     if (!reply.WriteInt32(result)) {
199         TELEPHONY_LOGE("writing parcel failed");
200         return TELEPHONY_ERR_WRITE_REPLY_FAIL;
201     }
202     return TELEPHONY_SUCCESS;
203 }
204 
OnUpdateMmiCodeResults(MessageParcel & data,MessageParcel & reply)205 int32_t CallAbilityCallbackStub::OnUpdateMmiCodeResults(MessageParcel &data, MessageParcel &reply)
206 {
207     int32_t result = TELEPHONY_SUCCESS;
208     const MmiCodeInfo *parcelPtr = nullptr;
209     int32_t len = data.ReadInt32();
210     if (len <= 0 || len >= MAX_LEN) {
211         TELEPHONY_LOGE("Invalid parameter, len = %{public}d", len);
212         return TELEPHONY_ERR_ARGUMENT_INVALID;
213     }
214     if (!data.ContainFileDescriptors()) {
215         TELEPHONY_LOGW("sent raw data is less than 32k");
216     }
217     if ((parcelPtr = reinterpret_cast<const MmiCodeInfo *>(data.ReadRawData(sizeof(MmiCodeInfo)))) == nullptr) {
218         TELEPHONY_LOGE("reading raw data failed, length = %d", len);
219         return TELEPHONY_ERR_LOCAL_PTR_NULL;
220     }
221 
222     MmiCodeInfo info = *parcelPtr;
223     result = OnReportMmiCodeResult(info);
224     if (!reply.WriteInt32(result)) {
225         TELEPHONY_LOGE("writing parcel failed");
226         return TELEPHONY_ERR_WRITE_REPLY_FAIL;
227     }
228     return TELEPHONY_SUCCESS;
229 }
230 
OnUpdateAudioDeviceChange(MessageParcel & data,MessageParcel & reply)231 int32_t CallAbilityCallbackStub::OnUpdateAudioDeviceChange(MessageParcel &data, MessageParcel &reply)
232 {
233     int32_t result = TELEPHONY_SUCCESS;
234     if (!data.ContainFileDescriptors()) {
235         TELEPHONY_LOGD("sent raw data is less than 32k");
236     }
237     AudioDeviceInfo info;
238     if (memset_s(&info, sizeof(AudioDeviceInfo), 0, sizeof(AudioDeviceInfo)) != EOK) {
239         TELEPHONY_LOGE("memset_s address fail");
240         return TELEPHONY_ERR_MEMSET_FAIL;
241     }
242     int32_t len = data.ReadInt32();
243     if (len <= 0 || len >= MAX_LEN) {
244         TELEPHONY_LOGE("Invalid parameter, len = %{public}d", len);
245         return TELEPHONY_ERR_ARGUMENT_INVALID;
246     }
247     AudioDevice *audioDevicePtr = nullptr;
248     for (int32_t i = 0; i < len + 1; i++) {
249         audioDevicePtr = static_cast<AudioDevice *>(const_cast<void *>(data.ReadRawData(sizeof(AudioDevice))));
250         if (audioDevicePtr == nullptr) {
251             TELEPHONY_LOGE("Invalid parameter audioDevicePtr");
252             return TELEPHONY_ERR_ARGUMENT_INVALID;
253         }
254         if (i < len) {
255             info.audioDeviceList.push_back(*audioDevicePtr);
256         } else {
257             info.currentAudioDevice = *audioDevicePtr;
258         }
259     }
260 
261     info.isMuted = data.ReadBool();
262     info.callId = data.ReadInt32();
263     result = OnReportAudioDeviceChange(info);
264     if (!reply.WriteInt32(result)) {
265         TELEPHONY_LOGE("writing parcel failed");
266         return TELEPHONY_ERR_WRITE_REPLY_FAIL;
267     }
268     return TELEPHONY_SUCCESS;
269 }
270 
OnUpdateOttCallRequest(MessageParcel & data,MessageParcel & reply)271 int32_t CallAbilityCallbackStub::OnUpdateOttCallRequest(MessageParcel &data, MessageParcel &reply)
272 {
273     int32_t result = TELEPHONY_SUCCESS;
274     AppExecFwk::PacMap resultInfo;
275     OttCallRequestId requestId = static_cast<OttCallRequestId>(data.ReadInt32());
276     resultInfo.PutStringValue("phoneNumber", data.ReadString());
277     resultInfo.PutStringValue("bundleName", data.ReadString());
278     resultInfo.PutIntValue("videoState", data.ReadInt32());
279     switch (requestId) {
280         case OttCallRequestId::OTT_REQUEST_INVITE_TO_CONFERENCE:
281             resultInfo.PutStringValue("number", data.ReadString());
282             break;
283         case OttCallRequestId::OTT_REQUEST_UPDATE_CALL_MEDIA_MODE:
284             resultInfo.PutIntValue("callMediaMode", data.ReadInt32());
285             break;
286         default:
287             break;
288     }
289     if (!data.ContainFileDescriptors()) {
290         TELEPHONY_LOGW("sent raw data is less than 32k");
291     }
292     result = OnOttCallRequest(requestId, resultInfo);
293     if (!reply.WriteInt32(result)) {
294         TELEPHONY_LOGE("writing parcel failed");
295         return TELEPHONY_ERR_WRITE_REPLY_FAIL;
296     }
297     return TELEPHONY_SUCCESS;
298 }
299 
OnUpdatePostDialDelay(MessageParcel & data,MessageParcel & reply)300 int32_t CallAbilityCallbackStub::OnUpdatePostDialDelay(MessageParcel &data, MessageParcel &reply)
301 {
302     std::string remainPostDial = data.ReadString();
303     int32_t result = OnReportPostDialDelay(remainPostDial);
304     if (!reply.WriteInt32(result)) {
305         TELEPHONY_LOGE("writing parcel failed");
306         return TELEPHONY_ERR_WRITE_REPLY_FAIL;
307     }
308     return TELEPHONY_SUCCESS;
309 }
310 
OnUpdateImsCallModeChange(MessageParcel & data,MessageParcel & reply)311 int32_t CallAbilityCallbackStub::OnUpdateImsCallModeChange(MessageParcel &data, MessageParcel &reply)
312 {
313     int32_t result = TELEPHONY_SUCCESS;
314     const CallMediaModeInfo *parcelPtr = nullptr;
315     int32_t len = data.ReadInt32();
316     if (len <= 0 || len >= MAX_LEN) {
317         TELEPHONY_LOGE("Invalid parameter, len = %{public}d", len);
318         return TELEPHONY_ERR_ARGUMENT_INVALID;
319     }
320     if (!data.ContainFileDescriptors()) {
321         TELEPHONY_LOGD("sent raw data is less than 32k");
322     }
323     if ((parcelPtr = reinterpret_cast<const CallMediaModeInfo *>(data.ReadRawData(len))) == nullptr) {
324         TELEPHONY_LOGE("reading raw data failed, length = %d", len);
325         return TELEPHONY_ERR_LOCAL_PTR_NULL;
326     }
327 
328     result = OnReportImsCallModeChange(*parcelPtr);
329     if (!reply.WriteInt32(result)) {
330         TELEPHONY_LOGE("writing parcel failed");
331         return TELEPHONY_ERR_WRITE_REPLY_FAIL;
332     }
333     return TELEPHONY_SUCCESS;
334 }
335 
OnUpdateCallSessionEventChange(MessageParcel & data,MessageParcel & reply)336 int32_t CallAbilityCallbackStub::OnUpdateCallSessionEventChange(MessageParcel &data, MessageParcel &reply)
337 {
338     int32_t result = TELEPHONY_SUCCESS;
339     if (!data.ContainFileDescriptors()) {
340         TELEPHONY_LOGW("sent raw data is less than 32k");
341     }
342 
343     const CallSessionEvent *parcelPtr = nullptr;
344     int32_t len = data.ReadInt32();
345     if (len <= 0 || len >= MAX_LEN) {
346         TELEPHONY_LOGE("Invalid parameter, len = %{public}d", len);
347         return TELEPHONY_ERR_ARGUMENT_INVALID;
348     }
349     if ((parcelPtr = reinterpret_cast<const CallSessionEvent *>(data.ReadRawData(len))) == nullptr) {
350         TELEPHONY_LOGE("reading raw data failed, length = %d", len);
351         return TELEPHONY_ERR_LOCAL_PTR_NULL;
352     }
353 
354     result = OnReportCallSessionEventChange(*parcelPtr);
355     if (!reply.WriteInt32(result)) {
356         TELEPHONY_LOGE("writing parcel failed");
357         return TELEPHONY_ERR_WRITE_REPLY_FAIL;
358     }
359     return TELEPHONY_SUCCESS;
360 }
361 
OnUpdatePeerDimensionsChange(MessageParcel & data,MessageParcel & reply)362 int32_t CallAbilityCallbackStub::OnUpdatePeerDimensionsChange(MessageParcel &data, MessageParcel &reply)
363 {
364     int32_t result = TELEPHONY_SUCCESS;
365     if (!data.ContainFileDescriptors()) {
366         TELEPHONY_LOGW("sent raw data is less than 32k");
367     }
368 
369     const PeerDimensionsDetail *parcelPtr = nullptr;
370     int32_t len = data.ReadInt32();
371     if (len <= 0 || len >= MAX_LEN) {
372         TELEPHONY_LOGE("Invalid parameter, len = %{public}d", len);
373         return TELEPHONY_ERR_ARGUMENT_INVALID;
374     }
375     if ((parcelPtr = reinterpret_cast<const PeerDimensionsDetail *>(data.ReadRawData(len))) == nullptr) {
376         TELEPHONY_LOGE("reading raw data failed, length = %d", len);
377         return TELEPHONY_ERR_LOCAL_PTR_NULL;
378     }
379 
380     result = OnReportPeerDimensionsChange(*parcelPtr);
381     if (!reply.WriteInt32(result)) {
382         TELEPHONY_LOGE("writing parcel failed");
383         return TELEPHONY_ERR_WRITE_REPLY_FAIL;
384     }
385     return TELEPHONY_SUCCESS;
386 }
387 
OnUpdateCallDataUsageChange(MessageParcel & data,MessageParcel & reply)388 int32_t CallAbilityCallbackStub::OnUpdateCallDataUsageChange(MessageParcel &data, MessageParcel &reply)
389 {
390     int32_t result = TELEPHONY_SUCCESS;
391     if (!data.ContainFileDescriptors()) {
392         TELEPHONY_LOGW("sent raw data is less than 32k");
393     }
394 
395     int64_t dataUsage = data.ReadInt64();
396     result = OnReportCallDataUsageChange(dataUsage);
397     if (!reply.WriteInt32(result)) {
398         TELEPHONY_LOGE("writing parcel failed");
399         return TELEPHONY_ERR_WRITE_REPLY_FAIL;
400     }
401     return TELEPHONY_SUCCESS;
402 }
403 
OnUpdateCameraCapabilities(MessageParcel & data,MessageParcel & reply)404 int32_t CallAbilityCallbackStub::OnUpdateCameraCapabilities(MessageParcel &data, MessageParcel &reply)
405 {
406     int32_t result = TELEPHONY_SUCCESS;
407     if (!data.ContainFileDescriptors()) {
408         TELEPHONY_LOGW("sent raw data is less than 32k");
409     }
410 
411     const CameraCapabilities *parcelPtr = nullptr;
412     int32_t len = data.ReadInt32();
413     if (len <= 0 || len >= MAX_LEN) {
414         TELEPHONY_LOGE("Invalid parameter, len = %{public}d", len);
415         return TELEPHONY_ERR_ARGUMENT_INVALID;
416     }
417     if ((parcelPtr = reinterpret_cast<const CameraCapabilities *>(data.ReadRawData(len))) == nullptr) {
418         TELEPHONY_LOGE("reading raw data failed, length = %d", len);
419         return TELEPHONY_ERR_LOCAL_PTR_NULL;
420     }
421 
422     result = OnReportCameraCapabilities(*parcelPtr);
423     if (!reply.WriteInt32(result)) {
424         TELEPHONY_LOGE("writing parcel failed");
425         return TELEPHONY_ERR_WRITE_REPLY_FAIL;
426     }
427     return TELEPHONY_SUCCESS;
428 }
429 
OnUpdatePhoneState(MessageParcel & data,MessageParcel & reply)430 int32_t CallAbilityCallbackStub::OnUpdatePhoneState(MessageParcel &data, MessageParcel &reply)
431 {
432     if (!data.ContainFileDescriptors()) {
433         TELEPHONY_LOGD("sent raw data is less than 32k");
434     }
435 
436     int32_t numActive = data.ReadInt32();
437     int32_t numHeld = data.ReadInt32();
438     int32_t callState = data.ReadInt32();
439     std::string number = data.ReadString();
440     int32_t result = OnPhoneStateChange(numActive, numHeld, callState, number);
441     if (!reply.WriteInt32(result)) {
442         TELEPHONY_LOGE("writing parcel failed");
443         return TELEPHONY_ERR_WRITE_REPLY_FAIL;
444     }
445     return TELEPHONY_SUCCESS;
446 }
447 } // namespace Telephony
448 } // namespace OHOS
449