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_status_callback.h"
17
18 #include "audio_control_manager.h"
19 #include "call_ability_report_proxy.h"
20 #include "call_manager_errors.h"
21 #include "call_manager_hisysevent.h"
22 #include "hitrace_meter.h"
23 #include "report_call_info_handler.h"
24 #include "telephony_log_wrapper.h"
25
26 namespace OHOS {
27 namespace Telephony {
28 constexpr size_t CHAR_INDEX = 0;
29 constexpr int32_t ERR_CALL_ID = 0;
30
CallStatusCallback()31 CallStatusCallback::CallStatusCallback() {}
32
~CallStatusCallback()33 CallStatusCallback::~CallStatusCallback() {}
34
UpdateCallReportInfo(const CallReportInfo & info)35 int32_t CallStatusCallback::UpdateCallReportInfo(const CallReportInfo &info)
36 {
37 CallDetailInfo detailInfo;
38 if (info.callType == CallType::TYPE_VOIP) {
39 detailInfo.voipCallInfo.voipCallId = info.voipCallInfo.voipCallId;
40 detailInfo.voipCallInfo.userName = info.voipCallInfo.userName;
41 (detailInfo.voipCallInfo.userProfile).assign(
42 (info.voipCallInfo.userProfile).begin(), (info.voipCallInfo.userProfile).end());
43 detailInfo.voipCallInfo.extensionId = info.voipCallInfo.extensionId;
44 detailInfo.voipCallInfo.voipBundleName = info.voipCallInfo.voipBundleName;
45 detailInfo.voipCallInfo.abilityName = info.voipCallInfo.abilityName;
46 }
47 detailInfo.callType = info.callType;
48 detailInfo.accountId = info.accountId;
49 detailInfo.index = info.index;
50 detailInfo.state = info.state;
51 detailInfo.callMode = info.callMode;
52 detailInfo.voiceDomain = info.voiceDomain;
53 detailInfo.mpty = info.mpty;
54 (void)memcpy_s(detailInfo.phoneNum, kMaxNumberLen, info.accountNum, kMaxNumberLen);
55 (void)memset_s(detailInfo.bundleName, kMaxBundleNameLen, 0, kMaxBundleNameLen);
56 int32_t ret = DelayedSingleton<ReportCallInfoHandler>::GetInstance()->UpdateCallReportInfo(detailInfo);
57 if (ret != TELEPHONY_SUCCESS) {
58 TELEPHONY_LOGE("UpdateCallReportInfo failed! errCode:%{public}d", ret);
59 } else {
60 TELEPHONY_LOGI("UpdateCallReportInfo success! state:%{public}d", info.state);
61 }
62 return ret;
63 }
64
UpdateCallsReportInfo(const CallsReportInfo & info)65 int32_t CallStatusCallback::UpdateCallsReportInfo(const CallsReportInfo &info)
66 {
67 CallDetailsInfo detailsInfo;
68 CallDetailInfo detailInfo;
69 detailInfo.index = 0;
70 detailInfo.state = TelCallState::CALL_STATUS_UNKNOWN;
71 CallsReportInfo callsInfo = info;
72 std::vector<CallReportInfo>::iterator it = callsInfo.callVec.begin();
73 for (; it != callsInfo.callVec.end(); ++it) {
74 detailInfo.callType = (*it).callType;
75 detailInfo.accountId = (*it).accountId;
76 detailInfo.index = (*it).index;
77 detailInfo.state = (*it).state;
78 detailInfo.callMode = (*it).callMode;
79 detailInfo.voiceDomain = (*it).voiceDomain;
80 detailInfo.mpty = (*it).mpty;
81 detailInfo.crsType = (*it).crsType;
82 detailInfo.originalCallType = (*it).originalCallType;
83 (void)memcpy_s(detailInfo.phoneNum, kMaxNumberLen, (*it).accountNum, kMaxNumberLen);
84 (void)memset_s(detailInfo.bundleName, kMaxBundleNameLen, 0, kMaxBundleNameLen);
85 detailsInfo.callVec.push_back(detailInfo);
86 }
87 detailsInfo.slotId = callsInfo.slotId;
88 CallManagerHisysevent::WriteCallStateBehaviorEvent(
89 detailsInfo.slotId, static_cast<int32_t>(detailInfo.state), detailInfo.index);
90 (void)memset_s(detailsInfo.bundleName, kMaxBundleNameLen, 0, kMaxBundleNameLen);
91
92 if (detailInfo.state == TelCallState::CALL_STATUS_INCOMING) {
93 CallManagerHisysevent::WriteIncomingCallBehaviorEvent(
94 detailsInfo.slotId, static_cast<int32_t>(detailInfo.callType), static_cast<int32_t>(detailInfo.callMode));
95 TELEPHONY_LOGI("CallStatusCallback InComingCall StartAsyncTrace!");
96 DelayedSingleton<CallManagerHisysevent>::GetInstance()->SetIncomingStartTime();
97 StartAsyncTrace(HITRACE_TAG_OHOS, "InComingCall", getpid());
98 }
99 int32_t ret = DelayedSingleton<ReportCallInfoHandler>::GetInstance()->UpdateCallsReportInfo(detailsInfo);
100 if (ret != TELEPHONY_SUCCESS) {
101 TELEPHONY_LOGE("UpdateCallsReportInfo failed! errCode:%{public}d", ret);
102 } else {
103 TELEPHONY_LOGI("UpdateCallsReportInfo success!");
104 }
105 return ret;
106 }
107
UpdateDisconnectedCause(const DisconnectedDetails & details)108 int32_t CallStatusCallback::UpdateDisconnectedCause(const DisconnectedDetails &details)
109 {
110 int32_t ret = DelayedSingleton<ReportCallInfoHandler>::GetInstance()->UpdateDisconnectedCause(details);
111 if (ret != TELEPHONY_SUCCESS) {
112 TELEPHONY_LOGE("UpdateDisconnectedCause failed! errCode:%{public}d", ret);
113 } else {
114 TELEPHONY_LOGI("UpdateDisconnectedCause success!");
115 }
116 return ret;
117 }
118
UpdateEventResultInfo(const CellularCallEventInfo & info)119 int32_t CallStatusCallback::UpdateEventResultInfo(const CellularCallEventInfo &info)
120 {
121 int32_t ret = DelayedSingleton<ReportCallInfoHandler>::GetInstance()->UpdateEventResultInfo(info);
122 if (ret != TELEPHONY_SUCCESS) {
123 TELEPHONY_LOGE("UpdateEventResultInfo failed! errCode:%{public}d", ret);
124 } else {
125 TELEPHONY_LOGI("UpdateEventResultInfo success!");
126 }
127 return ret;
128 }
129
UpdateRBTPlayInfo(const RBTPlayInfo info)130 int32_t CallStatusCallback::UpdateRBTPlayInfo(const RBTPlayInfo info)
131 {
132 TELEPHONY_LOGI("UpdateRBTPlayInfo info = %{public}d", info);
133 bool isLocalRingbackNeeded = false;
134 if (info == RBTPlayInfo::LOCAL_ALERTING) {
135 isLocalRingbackNeeded = true;
136 }
137 DelayedSingleton<AudioControlManager>::GetInstance()->SetLocalRingbackNeeded(isLocalRingbackNeeded);
138 return TELEPHONY_SUCCESS;
139 }
140
StartDtmfResult(const int32_t result)141 int32_t CallStatusCallback::StartDtmfResult(const int32_t result)
142 {
143 CallResultReportId reportId = CallResultReportId::START_DTMF_REPORT_ID;
144 AppExecFwk::PacMap resultInfo;
145 resultInfo.PutIntValue("result", result);
146 TELEPHONY_LOGI("StartDtmfResult result = %{public}d", result);
147 return DelayedSingleton<CallAbilityReportProxy>::GetInstance()->ReportAsyncResults(reportId, resultInfo);
148 }
149
StopDtmfResult(const int32_t result)150 int32_t CallStatusCallback::StopDtmfResult(const int32_t result)
151 {
152 CallResultReportId reportId = CallResultReportId::STOP_DTMF_REPORT_ID;
153 AppExecFwk::PacMap resultInfo;
154 resultInfo.PutIntValue("result", result);
155 TELEPHONY_LOGI("StopDtmfResult result = %{public}d", result);
156 return DelayedSingleton<CallAbilityReportProxy>::GetInstance()->ReportAsyncResults(reportId, resultInfo);
157 }
158
SendUssdResult(const int32_t result)159 int32_t CallStatusCallback::SendUssdResult(const int32_t result)
160 {
161 CallResultReportId reportId = CallResultReportId::SEND_USSD_REPORT_ID;
162 AppExecFwk::PacMap resultInfo;
163 resultInfo.PutIntValue("result", result);
164 TELEPHONY_LOGI("SendUssdResult result = %{public}d", result);
165 return DelayedSingleton<CallAbilityReportProxy>::GetInstance()->ReportAsyncResults(reportId, resultInfo);
166 }
167
SendMmiCodeResult(const MmiCodeInfo & info)168 int32_t CallStatusCallback::SendMmiCodeResult(const MmiCodeInfo &info)
169 {
170 TELEPHONY_LOGI("SendMmiCodeResult result = %{public}d, message = %{public}s", info.result, info.message);
171 int32_t ret = DelayedSingleton<CallAbilityReportProxy>::GetInstance()->ReportMmiCodeResult(info);
172 if (ret != TELEPHONY_SUCCESS) {
173 TELEPHONY_LOGE("UpdateDisconnectedCause failed! errCode:%{public}d", ret);
174 } else {
175 TELEPHONY_LOGI("UpdateDisconnectedCause success!");
176 }
177 return ret;
178 }
179
GetImsCallDataResult(const int32_t result)180 int32_t CallStatusCallback::GetImsCallDataResult(const int32_t result)
181 {
182 CallResultReportId reportId = CallResultReportId::GET_IMS_CALL_DATA_REPORT_ID;
183 AppExecFwk::PacMap resultInfo;
184 resultInfo.PutIntValue("result", result);
185 TELEPHONY_LOGI("GetImsCallDataResult result = %{public}d", result);
186 return DelayedSingleton<CallAbilityReportProxy>::GetInstance()->ReportAsyncResults(reportId, resultInfo);
187 }
188
UpdateGetWaitingResult(const CallWaitResponse & response)189 int32_t CallStatusCallback::UpdateGetWaitingResult(const CallWaitResponse &response)
190 {
191 TELEPHONY_LOGI("GetWaitingResult status = %{public}d, classCw = %{public}d, result = %{public}d", response.status,
192 response.classCw, response.result);
193 CallResultReportId reportId = CallResultReportId::GET_CALL_WAITING_REPORT_ID;
194 AppExecFwk::PacMap resultInfo;
195 resultInfo.PutIntValue("result", response.result);
196 resultInfo.PutIntValue("status", response.status);
197 resultInfo.PutIntValue("classCw", response.classCw);
198 DelayedSingleton<CallAbilityReportProxy>::GetInstance()->ReportAsyncResults(reportId, resultInfo);
199 return TELEPHONY_SUCCESS;
200 }
201
UpdateSetWaitingResult(const int32_t result)202 int32_t CallStatusCallback::UpdateSetWaitingResult(const int32_t result)
203 {
204 TELEPHONY_LOGI("SetWaitingResult result = %{public}d", result);
205 CallResultReportId reportId = CallResultReportId::SET_CALL_WAITING_REPORT_ID;
206 AppExecFwk::PacMap resultInfo;
207 resultInfo.PutIntValue("result", result);
208 DelayedSingleton<CallAbilityReportProxy>::GetInstance()->ReportAsyncResults(reportId, resultInfo);
209 return TELEPHONY_SUCCESS;
210 }
211
UpdateGetRestrictionResult(const CallRestrictionResponse & result)212 int32_t CallStatusCallback::UpdateGetRestrictionResult(const CallRestrictionResponse &result)
213 {
214 TELEPHONY_LOGI("GetRestrictionResult status = %{public}d, classCw = %{public}d, result = %{public}d",
215 result.status, result.classCw, result.result);
216 CallResultReportId reportId = CallResultReportId::GET_CALL_RESTRICTION_REPORT_ID;
217 AppExecFwk::PacMap resultInfo;
218 resultInfo.PutIntValue("result", result.result);
219 resultInfo.PutIntValue("status", result.status);
220 resultInfo.PutIntValue("classCw", result.classCw);
221 return DelayedSingleton<CallAbilityReportProxy>::GetInstance()->ReportAsyncResults(reportId, resultInfo);
222 }
223
UpdateSetRestrictionResult(const int32_t result)224 int32_t CallStatusCallback::UpdateSetRestrictionResult(const int32_t result)
225 {
226 TELEPHONY_LOGI("SetRestrictionResult result = %{public}d", result);
227 CallResultReportId reportId = CallResultReportId::SET_CALL_RESTRICTION_REPORT_ID;
228 AppExecFwk::PacMap resultInfo;
229 resultInfo.PutIntValue("result", result);
230 return DelayedSingleton<CallAbilityReportProxy>::GetInstance()->ReportAsyncResults(reportId, resultInfo);
231 }
232
UpdateSetRestrictionPasswordResult(const int32_t result)233 int32_t CallStatusCallback::UpdateSetRestrictionPasswordResult(const int32_t result)
234 {
235 TELEPHONY_LOGI("SetRestrictionPassword result = %{public}d", result);
236 CallResultReportId reportId = CallResultReportId::SET_CALL_RESTRICTION_PWD_REPORT_ID;
237 AppExecFwk::PacMap resultInfo;
238 resultInfo.PutIntValue("result", result);
239 return DelayedSingleton<CallAbilityReportProxy>::GetInstance()->ReportAsyncResults(reportId, resultInfo);
240 }
241
UpdateGetTransferResult(const CallTransferResponse & response)242 int32_t CallStatusCallback::UpdateGetTransferResult(const CallTransferResponse &response)
243 {
244 CallResultReportId reportId = CallResultReportId::GET_CALL_TRANSFER_REPORT_ID;
245 AppExecFwk::PacMap resultInfo;
246 resultInfo.PutIntValue("result", response.result);
247 resultInfo.PutIntValue("status", response.status);
248 resultInfo.PutIntValue("classx", response.classx);
249 resultInfo.PutStringValue("number", response.number);
250 resultInfo.PutIntValue("type", response.type);
251 resultInfo.PutIntValue("reason", response.reason);
252 resultInfo.PutIntValue("time", response.time);
253 resultInfo.PutIntValue("startHour", response.startHour);
254 resultInfo.PutIntValue("startMinute", response.startMinute);
255 resultInfo.PutIntValue("endHour", response.endHour);
256 resultInfo.PutIntValue("endMinute", response.endMinute);
257 return DelayedSingleton<CallAbilityReportProxy>::GetInstance()->ReportAsyncResults(reportId, resultInfo);
258 }
259
UpdateSetTransferResult(const int32_t result)260 int32_t CallStatusCallback::UpdateSetTransferResult(const int32_t result)
261 {
262 TELEPHONY_LOGI("SetTransferResult result = %{public}d", result);
263 CallResultReportId reportId = CallResultReportId::SET_CALL_TRANSFER_REPORT_ID;
264 AppExecFwk::PacMap resultInfo;
265 resultInfo.PutIntValue("result", result);
266 return DelayedSingleton<CallAbilityReportProxy>::GetInstance()->ReportAsyncResults(reportId, resultInfo);
267 }
268
UpdateGetCallClipResult(const ClipResponse & clipResponse)269 int32_t CallStatusCallback::UpdateGetCallClipResult(const ClipResponse &clipResponse)
270 {
271 TELEPHONY_LOGI("GetCallClipResult action = %{public}d, clipStat = %{public}d, result = %{public}d",
272 clipResponse.action, clipResponse.clipStat, clipResponse.result);
273 CallResultReportId reportId = CallResultReportId::GET_CALL_CLIP_ID;
274 AppExecFwk::PacMap resultInfo;
275 resultInfo.PutIntValue("result", clipResponse.result);
276 resultInfo.PutIntValue("action", clipResponse.action);
277 resultInfo.PutIntValue("clipStat", clipResponse.clipStat);
278 return DelayedSingleton<CallAbilityReportProxy>::GetInstance()->ReportAsyncResults(reportId, resultInfo);
279 }
280
UpdateGetCallClirResult(const ClirResponse & clirResponse)281 int32_t CallStatusCallback::UpdateGetCallClirResult(const ClirResponse &clirResponse)
282 {
283 TELEPHONY_LOGI("GetCallClirResult action = %{public}d, clirStat = %{public}d, result = %{public}d",
284 clirResponse.action, clirResponse.clirStat, clirResponse.result);
285 CallResultReportId reportId = CallResultReportId::GET_CALL_CLIR_ID;
286 AppExecFwk::PacMap resultInfo;
287 resultInfo.PutIntValue("result", clirResponse.result);
288 resultInfo.PutIntValue("action", clirResponse.action);
289 resultInfo.PutIntValue("clirStat", clirResponse.clirStat);
290 return DelayedSingleton<CallAbilityReportProxy>::GetInstance()->ReportAsyncResults(reportId, resultInfo);
291 }
292
UpdateSetCallClirResult(const int32_t result)293 int32_t CallStatusCallback::UpdateSetCallClirResult(const int32_t result)
294 {
295 TELEPHONY_LOGI("GetCallClirResult result = %{public}d", result);
296 CallResultReportId reportId = CallResultReportId::SET_CALL_CLIR_ID;
297 AppExecFwk::PacMap resultInfo;
298 resultInfo.PutIntValue("result", result);
299 return DelayedSingleton<CallAbilityReportProxy>::GetInstance()->ReportAsyncResults(reportId, resultInfo);
300 }
301
StartRttResult(const int32_t result)302 int32_t CallStatusCallback::StartRttResult(const int32_t result)
303 {
304 TELEPHONY_LOGI("StartRttResult result = %{public}d", result);
305 CallResultReportId reportId = CallResultReportId::START_RTT_REPORT_ID;
306 AppExecFwk::PacMap resultInfo;
307 resultInfo.PutIntValue("result", result);
308 return DelayedSingleton<CallAbilityReportProxy>::GetInstance()->ReportAsyncResults(reportId, resultInfo);
309 }
310
StopRttResult(const int32_t result)311 int32_t CallStatusCallback::StopRttResult(const int32_t result)
312 {
313 TELEPHONY_LOGI("StopRttResult result = %{public}d", result);
314 CallResultReportId reportId = CallResultReportId::STOP_RTT_REPORT_ID;
315 AppExecFwk::PacMap resultInfo;
316 resultInfo.PutIntValue("result", result);
317 return DelayedSingleton<CallAbilityReportProxy>::GetInstance()->ReportAsyncResults(reportId, resultInfo);
318 }
319
GetImsConfigResult(const GetImsConfigResponse & response)320 int32_t CallStatusCallback::GetImsConfigResult(const GetImsConfigResponse &response)
321 {
322 CallResultReportId reportId = CallResultReportId::GET_IMS_CONFIG_REPORT_ID;
323 AppExecFwk::PacMap resultInfo;
324 resultInfo.PutIntValue("result", response.result);
325 resultInfo.PutIntValue("value", response.value);
326 TELEPHONY_LOGI("result = %{public}d value = %{public}d", response.result, response.value);
327 return DelayedSingleton<CallAbilityReportProxy>::GetInstance()->ReportAsyncResults(reportId, resultInfo);
328 }
329
SetImsConfigResult(const int32_t result)330 int32_t CallStatusCallback::SetImsConfigResult(const int32_t result)
331 {
332 CallResultReportId reportId = CallResultReportId::SET_IMS_CONFIG_REPORT_ID;
333 AppExecFwk::PacMap resultInfo;
334 resultInfo.PutIntValue("result", result);
335 TELEPHONY_LOGI("result = %{public}d", result);
336 return DelayedSingleton<CallAbilityReportProxy>::GetInstance()->ReportAsyncResults(reportId, resultInfo);
337 }
338
GetImsFeatureValueResult(const GetImsFeatureValueResponse & response)339 int32_t CallStatusCallback::GetImsFeatureValueResult(const GetImsFeatureValueResponse &response)
340 {
341 CallResultReportId reportId = CallResultReportId::GET_IMS_FEATURE_VALUE_REPORT_ID;
342 AppExecFwk::PacMap resultInfo;
343 resultInfo.PutIntValue("result", response.result);
344 resultInfo.PutIntValue("value", response.value);
345 TELEPHONY_LOGI("result = %{public}d value = %{public}d", response.result, response.value);
346 return DelayedSingleton<CallAbilityReportProxy>::GetInstance()->ReportAsyncResults(reportId, resultInfo);
347 }
348
SetImsFeatureValueResult(const int32_t result)349 int32_t CallStatusCallback::SetImsFeatureValueResult(const int32_t result)
350 {
351 CallResultReportId reportId = CallResultReportId::SET_IMS_FEATURE_VALUE_REPORT_ID;
352 AppExecFwk::PacMap resultInfo;
353 resultInfo.PutIntValue("result", result);
354 TELEPHONY_LOGI("result = %{public}d", result);
355 return DelayedSingleton<CallAbilityReportProxy>::GetInstance()->ReportAsyncResults(reportId, resultInfo);
356 }
357
ReceiveUpdateCallMediaModeRequest(const CallModeReportInfo & response)358 int32_t CallStatusCallback::ReceiveUpdateCallMediaModeRequest(const CallModeReportInfo &response)
359 {
360 TELEPHONY_LOGI("ReceiveUpdateCallMediaModeRequest result = %{public}d", response.result);
361 int32_t ret = DelayedSingleton<ReportCallInfoHandler>::GetInstance()->ReceiveImsCallModeRequest(response);
362 if (ret != TELEPHONY_SUCCESS) {
363 TELEPHONY_LOGE("ReceiveUpdateCallMediaModeRequest failed! errCode:%{public}d", ret);
364 } else {
365 TELEPHONY_LOGI("ReceiveUpdateCallMediaModeRequest success!");
366 }
367 return ret;
368 }
369
ReceiveUpdateCallMediaModeResponse(const CallModeReportInfo & response)370 int32_t CallStatusCallback::ReceiveUpdateCallMediaModeResponse(const CallModeReportInfo &response)
371 {
372 TELEPHONY_LOGI("ReceiveUpdateCallMediaModeResponse result = %{public}d", response.result);
373 int32_t ret = DelayedSingleton<ReportCallInfoHandler>::GetInstance()->ReceiveImsCallModeResponse(response);
374 if (ret != TELEPHONY_SUCCESS) {
375 TELEPHONY_LOGE("ReceiveUpdateCallMediaModeResponse failed! errCode:%{public}d", ret);
376 } else {
377 TELEPHONY_LOGI("ReceiveUpdateCallMediaModeResponse success!");
378 }
379 return ret;
380 }
381
InviteToConferenceResult(const int32_t result)382 int32_t CallStatusCallback::InviteToConferenceResult(const int32_t result)
383 {
384 CallResultReportId reportId = CallResultReportId::INVITE_TO_CONFERENCE_REPORT_ID;
385 AppExecFwk::PacMap resultInfo;
386 resultInfo.PutIntValue("result", result);
387 TELEPHONY_LOGI("InviteToConferenceResult result = %{public}d", result);
388 return DelayedSingleton<CallAbilityReportProxy>::GetInstance()->ReportAsyncResults(reportId, resultInfo);
389 }
390
CloseUnFinishedUssdResult(const int32_t result)391 int32_t CallStatusCallback::CloseUnFinishedUssdResult(const int32_t result)
392 {
393 CallResultReportId reportId = CallResultReportId::CLOSE_UNFINISHED_USSD_REPORT_ID;
394 AppExecFwk::PacMap resultInfo;
395 resultInfo.PutIntValue("result", result);
396 TELEPHONY_LOGI("CloseUnFinishedUssdResult result = %{public}d", result);
397 return DelayedSingleton<CallAbilityReportProxy>::GetInstance()->ReportAsyncResults(reportId, resultInfo);
398 }
399
ReportPostDialChar(const std::string & c)400 int32_t CallStatusCallback::ReportPostDialChar(const std::string &c)
401 {
402 TELEPHONY_LOGI("ReportPostDialChar");
403 char nextDtmf = ' ';
404 if (!c.empty() && c.length() > CHAR_INDEX) {
405 nextDtmf = c[CHAR_INDEX];
406 }
407 return DelayedSingleton<AudioControlManager>::GetInstance()->OnPostDialNextChar(nextDtmf);
408 }
409
ReportPostDialDelay(const std::string & str)410 int32_t CallStatusCallback::ReportPostDialDelay(const std::string &str)
411 {
412 TELEPHONY_LOGI("ReportPostDialDelay");
413 return DelayedSingleton<CallAbilityReportProxy>::GetInstance()->ReportPostDialDelay(str);
414 }
415
HandleCallSessionEventChanged(const CallSessionReportInfo & reportInfo)416 int32_t CallStatusCallback::HandleCallSessionEventChanged(const CallSessionReportInfo &reportInfo)
417 {
418 TELEPHONY_LOGI("HandleCallSessionEventChanged");
419 sptr<CallBase> callPtr = CallObjectManager::GetOneCallObjectByIndex(reportInfo.index);
420 CallSessionEvent sessionEvent;
421 if (callPtr == nullptr) {
422 sessionEvent.callId = ERR_CALL_ID;
423 } else {
424 sessionEvent.callId = callPtr->GetCallID();
425 }
426 sessionEvent.eventId = reportInfo.eventId;
427 return DelayedSingleton<CallAbilityReportProxy>::GetInstance()->ReportCallSessionEventChange(sessionEvent);
428 }
429
HandlePeerDimensionsChanged(const PeerDimensionsReportInfo & dimensionsReportInfo)430 int32_t CallStatusCallback::HandlePeerDimensionsChanged(const PeerDimensionsReportInfo &dimensionsReportInfo)
431 {
432 TELEPHONY_LOGI("HandlePeerDimensionsChanged");
433 sptr<CallBase> callPtr = CallObjectManager::GetOneCallObjectByIndex(dimensionsReportInfo.index);
434 PeerDimensionsDetail detail;
435 if (callPtr == nullptr) {
436 detail.callId = ERR_CALL_ID;
437 } else {
438 detail.callId = callPtr->GetCallID();
439 }
440 detail.width = dimensionsReportInfo.width;
441 detail.height = dimensionsReportInfo.height;
442 return DelayedSingleton<CallAbilityReportProxy>::GetInstance()->ReportPeerDimensionsChange(detail);
443 }
444
HandleCallDataUsageChanged(const int64_t dataUsage)445 int32_t CallStatusCallback::HandleCallDataUsageChanged(const int64_t dataUsage)
446 {
447 TELEPHONY_LOGI("HandleCallDataUsageChanged");
448 return DelayedSingleton<CallAbilityReportProxy>::GetInstance()->ReportCallDataUsageChange(dataUsage);
449 }
450
HandleCameraCapabilitiesChanged(const CameraCapabilitiesReportInfo & cameraCapabilitiesReportInfo)451 int32_t CallStatusCallback::HandleCameraCapabilitiesChanged(
452 const CameraCapabilitiesReportInfo &cameraCapabilitiesReportInfo)
453 {
454 TELEPHONY_LOGI("CameraCapabilitiesChange");
455 sptr<CallBase> callPtr = CallObjectManager::GetOneCallObjectByIndex(cameraCapabilitiesReportInfo.index);
456 CameraCapabilities cameraCapabilities;
457 if (callPtr == nullptr) {
458 TELEPHONY_LOGI("callPtr is null, set callId as ERR_CALL_ID");
459 cameraCapabilities.callId = ERR_CALL_ID;
460 } else {
461 cameraCapabilities.callId = callPtr->GetCallID();
462 }
463 cameraCapabilities.width = cameraCapabilitiesReportInfo.width;
464 cameraCapabilities.height = cameraCapabilitiesReportInfo.height;
465 return DelayedSingleton<CallAbilityReportProxy>::GetInstance()->ReportCameraCapabilities(cameraCapabilities);
466 }
467 } // namespace Telephony
468 } // namespace OHOS
469