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 "cellular_call_handler.h"
17
18 #include "cellular_call_config.h"
19 #include "cellular_call_hisysevent.h"
20 #include "cellular_call_service.h"
21 #include "hitrace_meter.h"
22 #include "tel_ril_call_parcel.h"
23 #include "tel_ril_types.h"
24 #include "ims_call_client.h"
25 #include "operator_config_types.h"
26 #include "radio_event.h"
27 #include "resource_utils.h"
28 #include "satellite_call_client.h"
29 #include "satellite_radio_event.h"
30 #include "securec.h"
31
32 namespace OHOS {
33 namespace Telephony {
34 const uint32_t GET_CS_CALL_DATA_ID = 10001;
35 const uint32_t GET_IMS_CALL_DATA_ID = 10002;
36 const uint32_t OPERATOR_CONFIG_CHANGED_ID = 10004;
37 const uint32_t GET_SATELLITE_CALL_DATA_ID = 10005;
38 const uint32_t NETWORK_STATE_CHANGED = 10006;
39 const int64_t DELAY_TIME = 100;
40 const int32_t MAX_REQUEST_COUNT = 50;
41 // message was null, mean report the default message to user which have been define at CellularCallSupplement
42 const std::string DEFAULT_NULL_MESSAGE = "";
43
CellularCallHandler(const EventFwk::CommonEventSubscribeInfo & subscriberInfo)44 CellularCallHandler::CellularCallHandler(const EventFwk::CommonEventSubscribeInfo &subscriberInfo)
45 : TelEventHandler("CellularCallHandler"), CommonEventSubscriber(subscriberInfo)
46 {
47 InitBasicFuncMap();
48 InitConfigFuncMap();
49 InitSupplementFuncMap();
50 InitActiveReportFuncMap();
51 InitSatelliteCallFuncMap();
52 InitAdditionalFuncMap();
53 }
54
InitBasicFuncMap()55 void CellularCallHandler::InitBasicFuncMap()
56 {
57 requestFuncMap_[RadioEvent::RADIO_DIAL] =
58 [this](const AppExecFwk::InnerEvent::Pointer &event) { DialResponse(event); };
59 requestFuncMap_[RadioEvent::RADIO_HANGUP_CONNECT] =
60 [this](const AppExecFwk::InnerEvent::Pointer &event) { CommonResultResponse(event); };
61 requestFuncMap_[RadioEvent::RADIO_REJECT_CALL] =
62 [this](const AppExecFwk::InnerEvent::Pointer &event) { CommonResultResponse(event); };
63 requestFuncMap_[RadioEvent::RADIO_ACCEPT_CALL] =
64 [this](const AppExecFwk::InnerEvent::Pointer &event) { CommonResultResponse(event); };
65 requestFuncMap_[RadioEvent::RADIO_HOLD_CALL] =
66 [this](const AppExecFwk::InnerEvent::Pointer &event) { CommonResultResponse(event); };
67 requestFuncMap_[RadioEvent::RADIO_ACTIVE_CALL] =
68 [this](const AppExecFwk::InnerEvent::Pointer &event) { CommonResultResponse(event); };
69 requestFuncMap_[RadioEvent::RADIO_SWAP_CALL] =
70 [this](const AppExecFwk::InnerEvent::Pointer &event) { SwapCallResponse(event); };
71 requestFuncMap_[RadioEvent::RADIO_COMBINE_CALL] =
72 [this](const AppExecFwk::InnerEvent::Pointer &event) { CommonResultResponse(event); };
73 requestFuncMap_[RadioEvent::RADIO_JOIN_CALL] =
74 [this](const AppExecFwk::InnerEvent::Pointer &event) { CommonResultResponse(event); };
75 requestFuncMap_[RadioEvent::RADIO_SPLIT_CALL] =
76 [this](const AppExecFwk::InnerEvent::Pointer &event) { CommonResultResponse(event); };
77 requestFuncMap_[RadioEvent::RADIO_CALL_SUPPLEMENT] =
78 [this](const AppExecFwk::InnerEvent::Pointer &event) { CommonResultResponse(event); };
79 requestFuncMap_[RadioEvent::RADIO_SEND_DTMF] =
80 [this](const AppExecFwk::InnerEvent::Pointer &event) { SendDtmfResponse(event); };
81 requestFuncMap_[RadioEvent::RADIO_START_DTMF] =
82 [this](const AppExecFwk::InnerEvent::Pointer &event) { StartDtmfResponse(event); };
83 requestFuncMap_[RadioEvent::RADIO_STOP_DTMF] =
84 [this](const AppExecFwk::InnerEvent::Pointer &event) { StopDtmfResponse(event); };
85 requestFuncMap_[RadioEvent::RADIO_CURRENT_CALLS] =
86 [this](const AppExecFwk::InnerEvent::Pointer &event) { GetCsCallsDataResponse(event); };
87 requestFuncMap_[RadioEvent::RADIO_GET_CALL_FAIL_REASON] =
88 [this](const AppExecFwk::InnerEvent::Pointer &event) { GetCallFailReasonResponse(event); };
89 requestFuncMap_[RadioEvent::RADIO_RECV_CALL_MEDIA_MODE_REQUEST] =
90 [this](const AppExecFwk::InnerEvent::Pointer &event) { ReceiveUpdateCallMediaModeRequest(event); };
91 requestFuncMap_[RadioEvent::RADIO_RECV_CALL_MEDIA_MODE_RESPONSE] =
92 [this](const AppExecFwk::InnerEvent::Pointer &event) { ReceiveUpdateCallMediaModeResponse(event); };
93 requestFuncMap_[RadioEvent::RADIO_CALL_SESSION_EVENT_CHANGED] =
94 [this](const AppExecFwk::InnerEvent::Pointer &event) { HandleCallSessionEventChanged(event); };
95 requestFuncMap_[RadioEvent::RADIO_CALL_PEER_DIMENSIONS_CHANGED] =
96 [this](const AppExecFwk::InnerEvent::Pointer &event) { HandlePeerDimensionsChanged(event); };
97 requestFuncMap_[RadioEvent::RADIO_CALL_DATA_USAGE_CHANGED] =
98 [this](const AppExecFwk::InnerEvent::Pointer &event) { HandleCallDataUsageChanged(event); };
99 requestFuncMap_[RadioEvent::RADIO_CAMERA_CAPABILITIES_CHANGED] =
100 [this](const AppExecFwk::InnerEvent::Pointer &event) { HandleCameraCapabilitiesChanged(event); };
101 requestFuncMap_[RadioEvent::RADIO_IMS_GET_CALL_DATA] =
102 [this](const AppExecFwk::InnerEvent::Pointer &event) { GetImsCallsDataResponse(event); };
103 }
104
InitConfigFuncMap()105 void CellularCallHandler::InitConfigFuncMap()
106 {
107 requestFuncMap_[RadioEvent::RADIO_SET_CMUT] =
108 [this](const AppExecFwk::InnerEvent::Pointer &event) { SetMuteResponse(event); };
109 requestFuncMap_[RadioEvent::RADIO_GET_CMUT] =
110 [this](const AppExecFwk::InnerEvent::Pointer &event) { GetMuteResponse(event); };
111 requestFuncMap_[RadioEvent::RADIO_SET_CALL_PREFERENCE_MODE] =
112 [this](const AppExecFwk::InnerEvent::Pointer &event) { SetDomainPreferenceModeResponse(event); };
113 requestFuncMap_[RadioEvent::RADIO_GET_CALL_PREFERENCE_MODE] =
114 [this](const AppExecFwk::InnerEvent::Pointer &event) { GetDomainPreferenceModeResponse(event); };
115 requestFuncMap_[RadioEvent::RADIO_SET_IMS_SWITCH_STATUS] =
116 [this](const AppExecFwk::InnerEvent::Pointer &event) { SetImsSwitchStatusResponse(event); };
117 requestFuncMap_[RadioEvent::RADIO_GET_IMS_SWITCH_STATUS] =
118 [this](const AppExecFwk::InnerEvent::Pointer &event) { GetImsSwitchStatusResponse(event); };
119 requestFuncMap_[RadioEvent::RADIO_SET_VONR_SWITCH_STATUS] =
120 [this](const AppExecFwk::InnerEvent::Pointer &event) { SetVoNRSwitchStatusResponse(event); };
121 requestFuncMap_[RadioEvent::RADIO_SET_EMERGENCY_CALL_LIST] =
122 [this](const AppExecFwk::InnerEvent::Pointer &event) { SetEmergencyCallListResponse(event); };
123 requestFuncMap_[RadioEvent::RADIO_GET_EMERGENCY_CALL_LIST] =
124 [this](const AppExecFwk::InnerEvent::Pointer &event) { GetEmergencyCallListResponse(event); };
125 requestFuncMap_[OPERATOR_CONFIG_CHANGED_ID] =
126 [this](const AppExecFwk::InnerEvent::Pointer &event) { HandleOperatorConfigChanged(event); };
127 }
128
InitSupplementFuncMap()129 void CellularCallHandler::InitSupplementFuncMap()
130 {
131 requestFuncMap_[RadioEvent::RADIO_GET_CALL_WAIT] =
132 [this](const AppExecFwk::InnerEvent::Pointer &event) { GetCallWaitingResponse(event); };
133 requestFuncMap_[RadioEvent::RADIO_SET_CALL_WAIT] =
134 [this](const AppExecFwk::InnerEvent::Pointer &event) { SetCallWaitingResponse(event); };
135 requestFuncMap_[RadioEvent::RADIO_GET_CALL_FORWARD] =
136 [this](const AppExecFwk::InnerEvent::Pointer &event) { GetCallTransferResponse(event); };
137 requestFuncMap_[RadioEvent::RADIO_SET_CALL_FORWARD] =
138 [this](const AppExecFwk::InnerEvent::Pointer &event) { SetCallTransferInfoResponse(event); };
139 requestFuncMap_[RadioEvent::RADIO_GET_CALL_CLIP] =
140 [this](const AppExecFwk::InnerEvent::Pointer &event) { GetClipResponse(event); };
141 requestFuncMap_[RadioEvent::RADIO_SET_CALL_CLIP] =
142 [this](const AppExecFwk::InnerEvent::Pointer &event) { SetClipResponse(event); };
143 requestFuncMap_[RadioEvent::RADIO_GET_CALL_CLIR] =
144 [this](const AppExecFwk::InnerEvent::Pointer &event) { GetClirResponse(event); };
145 requestFuncMap_[RadioEvent::RADIO_SET_CALL_CLIR] =
146 [this](const AppExecFwk::InnerEvent::Pointer &event) { SetClirResponse(event); };
147 requestFuncMap_[RadioEvent::RADIO_IMS_GET_COLR] =
148 [this](const AppExecFwk::InnerEvent::Pointer &event) { GetColrResponse(event); };
149 requestFuncMap_[RadioEvent::RADIO_IMS_SET_COLR] =
150 [this](const AppExecFwk::InnerEvent::Pointer &event) { SetColrResponse(event); };
151 requestFuncMap_[RadioEvent::RADIO_IMS_GET_COLP] =
152 [this](const AppExecFwk::InnerEvent::Pointer &event) { GetColpResponse(event); };
153 requestFuncMap_[RadioEvent::RADIO_IMS_SET_COLP] =
154 [this](const AppExecFwk::InnerEvent::Pointer &event) { SetColpResponse(event); };
155 requestFuncMap_[RadioEvent::RADIO_GET_CALL_RESTRICTION] =
156 [this](const AppExecFwk::InnerEvent::Pointer &event) { GetCallRestrictionResponse(event); };
157 requestFuncMap_[RadioEvent::RADIO_SET_CALL_RESTRICTION] =
158 [this](const AppExecFwk::InnerEvent::Pointer &event) { SetCallRestrictionResponse(event); };
159 requestFuncMap_[RadioEvent::RADIO_SET_CALL_RESTRICTION_PWD] =
160 [this](const AppExecFwk::InnerEvent::Pointer &event) { SetBarringPasswordResponse(event); };
161 requestFuncMap_[RadioEvent::RADIO_SET_USSD] =
162 [this](const AppExecFwk::InnerEvent::Pointer &event) { SendUssdResponse(event); };
163 requestFuncMap_[MMIHandlerId::EVENT_SET_UNLOCK_PIN_PUK_ID] =
164 [this](const AppExecFwk::InnerEvent::Pointer &event) { SendUnlockPinPukResponse(event); };
165 requestFuncMap_[RadioEvent::RADIO_CLOSE_UNFINISHED_USSD] =
166 [this](const AppExecFwk::InnerEvent::Pointer &event) { CloseUnFinishedUssdResponse(event); };
167 }
168
InitActiveReportFuncMap()169 void CellularCallHandler::InitActiveReportFuncMap()
170 {
171 requestFuncMap_[RadioEvent::RADIO_CALL_STATUS_INFO] =
172 [this](const AppExecFwk::InnerEvent::Pointer &event) { CsCallStatusInfoReport(event); };
173 requestFuncMap_[RadioEvent::RADIO_IMS_CALL_STATUS_INFO] =
174 [this](const AppExecFwk::InnerEvent::Pointer &event) { ImsCallStatusInfoReport(event); };
175 requestFuncMap_[RadioEvent::RADIO_AVAIL] =
176 [this](const AppExecFwk::InnerEvent::Pointer &event) { GetCsCallData(event); };
177 requestFuncMap_[RadioEvent::RADIO_NOT_AVAIL] =
178 [this](const AppExecFwk::InnerEvent::Pointer &event) { GetCsCallData(event); };
179 requestFuncMap_[RadioEvent::RADIO_CALL_USSD_NOTICE] =
180 [this](const AppExecFwk::InnerEvent::Pointer &event) { UssdNotifyResponse(event); };
181 requestFuncMap_[RadioEvent::RADIO_CALL_RINGBACK_VOICE] =
182 [this](const AppExecFwk::InnerEvent::Pointer &event) { CallRingBackVoiceResponse(event); };
183 requestFuncMap_[RadioEvent::RADIO_CALL_SRVCC_STATUS] =
184 [this](const AppExecFwk::InnerEvent::Pointer &event) { UpdateSrvccStateReport(event); };
185 requestFuncMap_[RadioEvent::RADIO_CALL_SS_NOTICE] =
186 [this](const AppExecFwk::InnerEvent::Pointer &event) { SsNotifyResponse(event); };
187 requestFuncMap_[RadioEvent::RADIO_CALL_EMERGENCY_NUMBER_REPORT] =
188 [this](const AppExecFwk::InnerEvent::Pointer &event) { ReportEccChanged(event); };
189 requestFuncMap_[RadioEvent::RADIO_SIM_STATE_CHANGE] =
190 [this](const AppExecFwk::InnerEvent::Pointer &event) { SimStateChangeReport(event); };
191 requestFuncMap_[RadioEvent::RADIO_SIM_RECORDS_LOADED] =
192 [this](const AppExecFwk::InnerEvent::Pointer &event) { SimRecordsLoadedReport(event); };
193 requestFuncMap_[RadioEvent::RADIO_SIM_ACCOUNT_LOADED] =
194 [this](const AppExecFwk::InnerEvent::Pointer &event) { SimAccountLoadedReport(event); };
195 requestFuncMap_[RadioEvent::RADIO_CALL_RSRVCC_STATUS] =
196 [this](const AppExecFwk::InnerEvent::Pointer &event) { UpdateRsrvccStateReport(event); };
197 requestFuncMap_[RadioEvent::RADIO_RESIDENT_NETWORK_CHANGE] =
198 [this](const AppExecFwk::InnerEvent::Pointer &event) { ResidentNetworkChangeReport(event); };
199 requestFuncMap_[NETWORK_STATE_CHANGED] =
200 [this](const AppExecFwk::InnerEvent::Pointer &event) { NetworkStateChangeReport(event); };
201 requestFuncMap_[RadioEvent::RADIO_RIL_ADAPTER_HOST_DIED] =
202 [this](const AppExecFwk::InnerEvent::Pointer &event) { OnRilAdapterHostDied(event); };
203 requestFuncMap_[RadioEvent::RADIO_FACTORY_RESET] =
204 [this](const AppExecFwk::InnerEvent::Pointer &event) { FactoryReset(event); };
205 requestFuncMap_[RadioEvent::RADIO_NV_REFRESH_FINISHED] =
206 [this](const AppExecFwk::InnerEvent::Pointer &event) { NvCfgFinishedIndication(event); };
207 #ifdef CALL_MANAGER_AUTO_START_OPTIMIZE
208 requestFuncMap_[RadioEvent::RADIO_GET_STATUS] =
209 [this](const AppExecFwk::InnerEvent::Pointer &event) { GetRadioStateProcess(event); };
210 requestFuncMap_[RadioEvent::RADIO_STATE_CHANGED] =
211 [this](const AppExecFwk::InnerEvent::Pointer &event) { RadioStateChangeProcess(event); };
212 #endif
213 }
214
InitSatelliteCallFuncMap()215 void CellularCallHandler::InitSatelliteCallFuncMap()
216 {
217 requestFuncMap_[SatelliteRadioEvent::SATELLITE_RADIO_CALL_STATE_CHANGED] =
218 [this](const AppExecFwk::InnerEvent::Pointer &event) { SatelliteCallStatusInfoReport(event); };
219 requestFuncMap_[SatelliteRadioEvent::SATELLITE_RADIO_DIAL] =
220 [this](const AppExecFwk::InnerEvent::Pointer &event) { DialSatelliteResponse(event); };
221 requestFuncMap_[SatelliteRadioEvent::SATELLITE_RADIO_HANGUP] =
222 [this](const AppExecFwk::InnerEvent::Pointer &event) { CommonResultResponse(event); };
223 requestFuncMap_[SatelliteRadioEvent::SATELLITE_RADIO_ANSWER] =
224 [this](const AppExecFwk::InnerEvent::Pointer &event) { CommonResultResponse(event); };
225 requestFuncMap_[SatelliteRadioEvent::SATELLITE_RADIO_REJECT] =
226 [this](const AppExecFwk::InnerEvent::Pointer &event) { CommonResultResponse(event); };
227 requestFuncMap_[SatelliteRadioEvent::SATELLITE_RADIO_GET_CALL_DATA] =
228 [this](const AppExecFwk::InnerEvent::Pointer &event) { GetSatelliteCallsDataResponse(event); };
229 requestFuncMap_[GET_SATELLITE_CALL_DATA_ID] =
230 [this](const AppExecFwk::InnerEvent::Pointer &event) { GetSatelliteCallsDataRequest(event); };
231 }
232
InitAdditionalFuncMap()233 void CellularCallHandler::InitAdditionalFuncMap()
234 {
235 requestFuncMap_[GET_CS_CALL_DATA_ID] =
236 [this](const AppExecFwk::InnerEvent::Pointer &event) { GetCsCallsDataRequest(event); };
237 requestFuncMap_[GET_IMS_CALL_DATA_ID] =
238 [this](const AppExecFwk::InnerEvent::Pointer &event) { GetImsCallsDataRequest(event); };
239 requestFuncMap_[REGISTER_HANDLER_ID] =
240 [this](const AppExecFwk::InnerEvent::Pointer &event) { RegisterHandler(event); };
241 requestFuncMap_[MMIHandlerId::EVENT_MMI_Id] =
242 [this](const AppExecFwk::InnerEvent::Pointer &event) { GetMMIResponse(event); };
243 requestFuncMap_[DtmfHandlerId::EVENT_EXECUTE_POST_DIAL] =
244 [this](const AppExecFwk::InnerEvent::Pointer &event) { ExecutePostDial(event); };
245 }
246
RegisterImsCallCallbackHandler()247 void CellularCallHandler::RegisterImsCallCallbackHandler()
248 {
249 // Register IMS
250 std::shared_ptr<ImsCallClient> imsCallClient = DelayedSingleton<ImsCallClient>::GetInstance();
251 if (imsCallClient != nullptr) {
252 imsCallClient->RegisterImsCallCallbackHandler(slotId_, shared_from_this());
253 }
254 }
255
RegisterSatelliteCallCallbackHandler()256 void CellularCallHandler::RegisterSatelliteCallCallbackHandler()
257 {
258 // Register Satellite
259 std::shared_ptr<SatelliteCallClient> satelliteCallClient = DelayedSingleton<SatelliteCallClient>::GetInstance();
260 if (satelliteCallClient != nullptr) {
261 satelliteCallClient->RegisterSatelliteCallCallbackHandler(slotId_, shared_from_this());
262 }
263 }
264
ProcessEvent(const AppExecFwk::InnerEvent::Pointer & event)265 void CellularCallHandler::ProcessEvent(const AppExecFwk::InnerEvent::Pointer &event)
266 {
267 if (event == nullptr) {
268 TELEPHONY_LOGE("[slot%{public}d] event is null", slotId_);
269 return;
270 }
271
272 uint32_t eventId = event->GetInnerEventId();
273 TELEPHONY_LOGD("[slot%{public}d] eventId = %{public}d", slotId_, eventId);
274
275 auto itFunc = requestFuncMap_.find(event->GetInnerEventId());
276 if (itFunc != requestFuncMap_.end()) {
277 auto requestFunc = itFunc->second;
278 if (requestFunc != nullptr) {
279 return requestFunc(event);
280 }
281 }
282 TELEPHONY_LOGI("[slot%{public}d] Function not found, need check.", slotId_);
283 }
284
OnReceiveEvent(const EventFwk::CommonEventData & data)285 void CellularCallHandler::OnReceiveEvent(const EventFwk::CommonEventData &data)
286 {
287 EventFwk::Want want = data.GetWant();
288 std::string action = want.GetAction();
289 TELEPHONY_LOGI("[slot%{public}d] action=%{public}s code=%{public}d", slotId_, action.c_str(), data.GetCode());
290 if (action == EventFwk::CommonEventSupport::COMMON_EVENT_OPERATOR_CONFIG_CHANGED) {
291 int32_t slotId = want.GetIntParam(BROADCAST_ARG_SLOT_ID, DEFAULT_SIM_SLOT_ID);
292 if (slotId_ != slotId) {
293 return;
294 }
295 this->SendEvent(OPERATOR_CONFIG_CHANGED_ID, DELAY_TIME, Priority::HIGH);
296 }
297 if (action == EventFwk::CommonEventSupport::COMMON_EVENT_NETWORK_STATE_CHANGED) {
298 int32_t slotId = want.GetIntParam(BROADCAST_ARG_SLOT_ID, DEFAULT_SIM_SLOT_ID);
299 if (slotId_ != slotId) {
300 return;
301 }
302 this->SendEvent(NETWORK_STATE_CHANGED, 0, Priority::HIGH);
303 }
304 }
305
GetCsCallData(const AppExecFwk::InnerEvent::Pointer & event)306 void CellularCallHandler::GetCsCallData(const AppExecFwk::InnerEvent::Pointer &event)
307 {
308 this->SendEvent(GET_CS_CALL_DATA_ID, 0, Priority::HIGH);
309 }
310
GetImsCallData(const AppExecFwk::InnerEvent::Pointer & event)311 void CellularCallHandler::GetImsCallData(const AppExecFwk::InnerEvent::Pointer &event)
312 {
313 this->SendEvent(GET_IMS_CALL_DATA_ID, 0, Priority::HIGH);
314 }
315
GetSatelliteCallData(const AppExecFwk::InnerEvent::Pointer & event)316 void CellularCallHandler::GetSatelliteCallData(const AppExecFwk::InnerEvent::Pointer &event)
317 {
318 this->SendEvent(GET_SATELLITE_CALL_DATA_ID, 0, Priority::HIGH);
319 }
320
CellularCallIncomingStartTrace(const int32_t state)321 void CellularCallHandler::CellularCallIncomingStartTrace(const int32_t state)
322 {
323 if (state == static_cast<int32_t>(TelCallState::CALL_STATUS_INCOMING)) {
324 StartAsyncTrace(HITRACE_TAG_OHOS, "CellularCallIncoming", getpid());
325 }
326 }
327
CellularCallIncomingFinishTrace(const int32_t state)328 void CellularCallHandler::CellularCallIncomingFinishTrace(const int32_t state)
329 {
330 if (state == static_cast<int32_t>(TelCallState::CALL_STATUS_INCOMING)) {
331 FinishAsyncTrace(HITRACE_TAG_OHOS, "CellularCallIncoming", getpid());
332 }
333 }
334
ReportCsCallsData(const CallInfoList & callInfoList)335 void CellularCallHandler::ReportCsCallsData(const CallInfoList &callInfoList)
336 {
337 auto serviceInstance = DelayedSingleton<CellularCallService>::GetInstance();
338 if (serviceInstance == nullptr) {
339 TELEPHONY_LOGE("[slot%{public}d] serviceInstance is null", slotId_);
340 return;
341 }
342 CallInfo callInfo;
343 std::vector<CallInfo>::const_iterator it = callInfoList.calls.begin();
344 for (; it != callInfoList.calls.end(); ++it) {
345 callInfo.state = (*it).state;
346 }
347 TELEPHONY_LOGI("[slot%{public}d] callInfoList.callSize:%{public}d", slotId_, callInfoList.callSize);
348 CellularCallIncomingStartTrace(callInfo.state);
349 auto csControl = serviceInstance->GetCsControl(slotId_);
350 if (callInfoList.callSize == 0) {
351 if (isInCsRedial_) {
352 TELEPHONY_LOGI("[slot%{public}d] Ignore hangup during cs redial", slotId_);
353 isInCsRedial_ = false;
354 return;
355 }
356 if (csControl == nullptr) {
357 TELEPHONY_LOGE("[slot%{public}d] cs_control is null", slotId_);
358 CellularCallIncomingFinishTrace(callInfo.state);
359 return;
360 }
361 if (csControl->ReportCallsData(slotId_, callInfoList) != TELEPHONY_SUCCESS) {
362 CellularCallIncomingFinishTrace(callInfo.state);
363 }
364 serviceInstance->SetCsControl(slotId_, nullptr);
365 return;
366 }
367 if (isInCsRedial_) {
368 TELEPHONY_LOGI("[slot%{public}d] Ignore cs call state change during cs redial", slotId_);
369 return;
370 }
371 if (callInfoList.callSize == 1) {
372 if (csControl == nullptr) {
373 csControl = std::make_shared<CSControl>();
374 serviceInstance->SetCsControl(slotId_, csControl);
375 }
376 }
377 if (csControl == nullptr) {
378 TELEPHONY_LOGE("[slot%{public}d] cs_control is null", slotId_);
379 CellularCallIncomingFinishTrace(callInfo.state);
380 return;
381 }
382 if (csControl->ReportCallsData(slotId_, callInfoList) != TELEPHONY_SUCCESS) {
383 CellularCallIncomingFinishTrace(callInfo.state);
384 }
385 }
386
ReportImsCallsData(const ImsCurrentCallList & imsCallInfoList)387 void CellularCallHandler::ReportImsCallsData(const ImsCurrentCallList &imsCallInfoList)
388 {
389 auto serviceInstance = DelayedSingleton<CellularCallService>::GetInstance();
390 if (serviceInstance == nullptr) {
391 TELEPHONY_LOGE("[slot%{public}d] serviceInstance is null", slotId_);
392 return;
393 }
394 ImsCurrentCall imsCallInfo;
395 std::vector<ImsCurrentCall>::const_iterator it = imsCallInfoList.calls.begin();
396 for (; it != imsCallInfoList.calls.end(); ++it) {
397 imsCallInfo.state = (*it).state;
398 }
399 TELEPHONY_LOGI("[slot%{public}d] imsCallInfoList.callSize:%{public}d", slotId_, imsCallInfoList.callSize);
400 CellularCallIncomingStartTrace(imsCallInfo.state);
401 auto imsControl = serviceInstance->GetImsControl(slotId_);
402 if (imsCallInfoList.callSize == 0) {
403 if (imsControl == nullptr) {
404 TELEPHONY_LOGE("[slot%{public}d] ims_control is null", slotId_);
405 return;
406 }
407 if (imsControl->ReportImsCallsData(slotId_, imsCallInfoList) != TELEPHONY_SUCCESS) {
408 CellularCallIncomingFinishTrace(imsCallInfo.state);
409 }
410 serviceInstance->SetImsControl(slotId_, nullptr);
411 return;
412 }
413 if (srvccState_ == SrvccState::STARTED) {
414 TELEPHONY_LOGI("[slot%{public}d] Ignore to report ims call state change during srvcc", slotId_);
415 return;
416 }
417 if (imsCallInfoList.callSize == 1) {
418 if (imsControl == nullptr) {
419 imsControl = std::make_shared<IMSControl>();
420 serviceInstance->SetImsControl(slotId_, imsControl);
421 }
422 }
423 if (imsControl == nullptr) {
424 TELEPHONY_LOGE("[slot%{public}d] ims_control is null", slotId_);
425 CellularCallIncomingFinishTrace(imsCallInfo.state);
426 return;
427 }
428 if (imsControl->ReportImsCallsData(slotId_, imsCallInfoList) != TELEPHONY_SUCCESS) {
429 CellularCallIncomingFinishTrace(imsCallInfo.state);
430 }
431 }
432
GetCsCallsDataResponse(const AppExecFwk::InnerEvent::Pointer & event)433 void CellularCallHandler::GetCsCallsDataResponse(const AppExecFwk::InnerEvent::Pointer &event)
434 {
435 // Returns list of current calls of ME. If command succeeds but no calls are available,
436 // no information response is sent to TE. Refer subclause 9.2 for possible <err> values.
437 TELEPHONY_LOGI("[slot%{public}d] GetCsCallsDataResponse entry", slotId_);
438 auto callInfoList = event->GetSharedObject<CallInfoList>();
439 if (callInfoList == nullptr) {
440 TELEPHONY_LOGE("[slot%{public}d] Cannot get the callInfoList, need to get rilResponseInfo", slotId_);
441 auto rilResponseInfo = event->GetSharedObject<RadioResponseInfo>();
442 if (rilResponseInfo == nullptr) {
443 TELEPHONY_LOGE("[slot%{public}d] callInfoList and rilResponseInfo are null", slotId_);
444 return;
445 }
446 if (rilResponseInfo->error == ErrType::NONE) {
447 TELEPHONY_LOGE("[slot%{public}d] Failed to query the call list but no reason!", slotId_);
448 return;
449 }
450 CellularCallEventInfo eventInfo;
451 eventInfo.eventType = CellularCallEventType::EVENT_REQUEST_RESULT_TYPE;
452 eventInfo.eventId = RequestResultEventId::RESULT_GET_CURRENT_CALLS_FAILED;
453 if (registerInstance_ == nullptr) {
454 TELEPHONY_LOGE("[slot%{public}d] registerInstance_ is null", slotId_);
455 return;
456 }
457 registerInstance_->ReportEventResultInfo(eventInfo);
458 return;
459 }
460 ReportCsCallsData(*callInfoList);
461 }
462
GetImsCallsDataResponse(const AppExecFwk::InnerEvent::Pointer & event)463 void CellularCallHandler::GetImsCallsDataResponse(const AppExecFwk::InnerEvent::Pointer &event)
464 {
465 // Returns list of current calls of ME. If command succeeds but no calls are available,
466 // no information response is sent to TE. Refer subclause 9.2 for possible <err> values.
467 auto imsCallInfoList = event->GetSharedObject<ImsCurrentCallList>();
468 if (imsCallInfoList == nullptr) {
469 TELEPHONY_LOGE("[slot%{public}d] Cannot get the imsCallInfoList, need to get rilResponseInfo", slotId_);
470 auto rilResponseInfo = event->GetSharedObject<RadioResponseInfo>();
471 if (rilResponseInfo == nullptr) {
472 TELEPHONY_LOGE("[slot%{public}d] callInfoList and rilResponseInfo are null", slotId_);
473 return;
474 }
475 if (rilResponseInfo->error == ErrType::NONE) {
476 TELEPHONY_LOGE("[slot%{public}d] Failed to query the call list but no reason!", slotId_);
477 return;
478 }
479 if (registerInstance_ == nullptr) {
480 TELEPHONY_LOGE("[slot%{public}d] registerInstance_ is null", slotId_);
481 return;
482 }
483 registerInstance_->ReportGetCallDataResult(static_cast<int32_t>(rilResponseInfo->error));
484 return;
485 }
486 ReportImsCallsData(*imsCallInfoList);
487 }
488
DialResponse(const AppExecFwk::InnerEvent::Pointer & event)489 void CellularCallHandler::DialResponse(const AppExecFwk::InnerEvent::Pointer &event)
490 {
491 auto result = event->GetSharedObject<RadioResponseInfo>();
492 if (result == nullptr) {
493 TELEPHONY_LOGE("[slot%{public}d] result is null", slotId_);
494 return;
495 }
496 struct CallBehaviorParameterInfo info = { 0 };
497 auto callHiSysEvent = DelayedSingleton<CellularCallHiSysEvent>::GetInstance();
498 if (callHiSysEvent == nullptr) {
499 TELEPHONY_LOGE("CellularCallHiSysEvent is null.");
500 return;
501 }
502 callHiSysEvent->GetCallParameterInfo(info);
503 if (result->error != ErrType::NONE) {
504 TELEPHONY_LOGE("[slot%{public}d] dial error:%{public}d", slotId_, result->error);
505 CellularCallEventInfo eventInfo;
506 eventInfo.eventType = CellularCallEventType::EVENT_REQUEST_RESULT_TYPE;
507
508 /*
509 * 3GPP TS 27.007 V3.9.0 (2001-06)
510 * If ME has succeeded in establishing a logical link between application protocols and external interface,
511 * it will send CONNECT message to the TE. Otherwise, the NO CARRIER response will be returned.
512 */
513 if (result->error == ErrType::ERR_CMD_NO_CARRIER) {
514 eventInfo.eventId = RequestResultEventId::RESULT_DIAL_NO_CARRIER;
515 } else {
516 eventInfo.eventId = RequestResultEventId::RESULT_DIAL_SEND_FAILED;
517 }
518 if (registerInstance_ == nullptr) {
519 TELEPHONY_LOGE("[slot%{public}d] registerInstance_ is null", slotId_);
520 return;
521 }
522 registerInstance_->ReportEventResultInfo(eventInfo);
523 CellularCallHiSysEvent::WriteDialCallBehaviorEvent(info, CallResponseResult::COMMAND_FAILURE);
524 } else {
525 CellularCallHiSysEvent::WriteDialCallBehaviorEvent(info, CallResponseResult::COMMAND_SUCCESS);
526 }
527 }
528
DialSatelliteResponse(const AppExecFwk::InnerEvent::Pointer & event)529 void CellularCallHandler::DialSatelliteResponse(const AppExecFwk::InnerEvent::Pointer &event)
530 {
531 auto result = event->GetSharedObject<RadioResponseInfo>();
532 if (result == nullptr) {
533 TELEPHONY_LOGE("[slot%{public}d] result is null", slotId_);
534 return;
535 }
536 struct CallBehaviorParameterInfo satelliteCallInfo = { 0 };
537 auto callHiSysEvent = DelayedSingleton<CellularCallHiSysEvent>::GetInstance();
538 if (callHiSysEvent == nullptr) {
539 TELEPHONY_LOGE("CellularCallHiSysEvent is null.");
540 return;
541 }
542 callHiSysEvent->GetCallParameterInfo(satelliteCallInfo);
543 if (result->error != ErrType::NONE) {
544 TELEPHONY_LOGE("[slot%{public}d] dial error:%{public}d", slotId_, result->error);
545 CellularCallEventInfo eventInfo;
546 eventInfo.eventType = CellularCallEventType::EVENT_REQUEST_RESULT_TYPE;
547
548 if (result->error == ErrType::ERR_CMD_NO_CARRIER) {
549 eventInfo.eventId = RequestResultEventId::RESULT_DIAL_NO_CARRIER;
550 } else {
551 eventInfo.eventId = RequestResultEventId::RESULT_DIAL_SEND_FAILED;
552 }
553 if (registerInstance_ == nullptr) {
554 TELEPHONY_LOGE("[slot%{public}d] registerInstance_ is null", slotId_);
555 return;
556 }
557 registerInstance_->ReportEventResultInfo(eventInfo);
558 CellularCallHiSysEvent::WriteDialCallBehaviorEvent(satelliteCallInfo, CallResponseResult::COMMAND_FAILURE);
559 } else {
560 CellularCallHiSysEvent::WriteDialCallBehaviorEvent(satelliteCallInfo, CallResponseResult::COMMAND_SUCCESS);
561 }
562 }
563
GetSatelliteCallsDataResponse(const AppExecFwk::InnerEvent::Pointer & event)564 void CellularCallHandler::GetSatelliteCallsDataResponse(const AppExecFwk::InnerEvent::Pointer &event)
565 {
566 auto satelliteCallInfoList = event->GetSharedObject<SatelliteCurrentCallList>();
567 if (satelliteCallInfoList == nullptr) {
568 TELEPHONY_LOGE(
569 "[slot%{public}d] Cannot get the SatelliteCurrentCallList, need to create satelliteCallInfoList", slotId_);
570 satelliteCallInfoList = std::make_shared<SatelliteCurrentCallList>();
571 }
572 ReportSatelliteCallsData(*satelliteCallInfoList);
573 }
574
ReportSatelliteCallsData(const SatelliteCurrentCallList & callInfoList)575 void CellularCallHandler::ReportSatelliteCallsData(const SatelliteCurrentCallList &callInfoList)
576 {
577 auto serviceInstance = DelayedSingleton<CellularCallService>::GetInstance();
578 if (serviceInstance == nullptr) {
579 TELEPHONY_LOGE("[slot%{public}d] serviceInstance is null", slotId_);
580 return;
581 }
582 auto satelliteControl = serviceInstance->GetSatelliteControl(slotId_);
583 SatelliteCurrentCall callInfo;
584 std::vector<SatelliteCurrentCall>::const_iterator it = callInfoList.calls.begin();
585 for (; it != callInfoList.calls.end(); ++it) {
586 callInfo.state = (*it).state;
587 }
588 TELEPHONY_LOGI("[slot%{public}d] callInfoList.callSize:%{public}d", slotId_, callInfoList.callSize);
589 CellularCallIncomingStartTrace(callInfo.state);
590 if (callInfoList.callSize == 0) {
591 if (satelliteControl == nullptr) {
592 TELEPHONY_LOGE("[slot%{public}d] satelliteControl is null", slotId_);
593 CellularCallIncomingFinishTrace(callInfo.state);
594 return;
595 }
596 if (satelliteControl->ReportSatelliteCallsData(slotId_, callInfoList) != TELEPHONY_SUCCESS) {
597 CellularCallIncomingFinishTrace(callInfo.state);
598 }
599 serviceInstance->SetSatelliteControl(slotId_, nullptr);
600 return;
601 }
602 if (callInfoList.callSize == 1) {
603 if (satelliteControl == nullptr) {
604 satelliteControl = std::make_shared<SatelliteControl>();
605 serviceInstance->SetSatelliteControl(slotId_, satelliteControl);
606 }
607 }
608 if (satelliteControl == nullptr) {
609 TELEPHONY_LOGE("[slot%{public}d] satelliteControl is null", slotId_);
610 CellularCallIncomingFinishTrace(callInfo.state);
611 return;
612 }
613 if (satelliteControl->ReportSatelliteCallsData(slotId_, callInfoList) != TELEPHONY_SUCCESS) {
614 CellularCallIncomingFinishTrace(callInfo.state);
615 }
616 }
617
CommonResultEventHandling(const AppExecFwk::InnerEvent::Pointer & event,CellularCallEventInfo & eventInfo)618 void CellularCallHandler::CommonResultEventHandling(
619 const AppExecFwk::InnerEvent::Pointer &event, CellularCallEventInfo &eventInfo)
620 {
621 eventInfo.eventType = CellularCallEventType::EVENT_REQUEST_RESULT_TYPE;
622 switch (event->GetInnerEventId()) {
623 case RadioEvent::RADIO_HANGUP_CONNECT:
624 eventInfo.eventId = RequestResultEventId::RESULT_END_SEND_FAILED;
625 break;
626 case RadioEvent::RADIO_REJECT_CALL:
627 eventInfo.eventId = RequestResultEventId::RESULT_REJECT_SEND_FAILED;
628 break;
629 case RadioEvent::RADIO_ACCEPT_CALL:
630 eventInfo.eventId = RequestResultEventId::RESULT_ACCEPT_SEND_FAILED;
631 break;
632 case RadioEvent::RADIO_HOLD_CALL:
633 eventInfo.eventId = RequestResultEventId::RESULT_HOLD_SEND_FAILED;
634 break;
635 case RadioEvent::RADIO_ACTIVE_CALL:
636 eventInfo.eventId = RequestResultEventId::RESULT_ACTIVE_SEND_FAILED;
637 break;
638 case RadioEvent::RADIO_SWAP_CALL:
639 eventInfo.eventId = RequestResultEventId::RESULT_SWAP_SEND_FAILED;
640 break;
641 case RadioEvent::RADIO_COMBINE_CALL:
642 case RadioEvent::RADIO_JOIN_CALL:
643 eventInfo.eventId = RequestResultEventId::RESULT_COMBINE_SEND_FAILED;
644 break;
645 case RadioEvent::RADIO_SPLIT_CALL:
646 eventInfo.eventId = RequestResultEventId::RESULT_SPLIT_SEND_FAILED;
647 break;
648 case RadioEvent::RADIO_CALL_SUPPLEMENT:
649 eventInfo.eventId = RequestResultEventId::RESULT_SUPPLEMENT_SEND_FAILED;
650 break;
651 default:
652 break;
653 }
654 }
655
CommonResultResponse(const AppExecFwk::InnerEvent::Pointer & event)656 void CellularCallHandler::CommonResultResponse(const AppExecFwk::InnerEvent::Pointer &event)
657 {
658 auto result = event->GetSharedObject<RadioResponseInfo>();
659 if (result == nullptr) {
660 TELEPHONY_LOGE("[slot%{public}d] result is null", slotId_);
661 return;
662 }
663 struct CallBehaviorParameterInfo info = { 0 };
664 auto callHiSysEvent = DelayedSingleton<CellularCallHiSysEvent>::GetInstance();
665 if (callHiSysEvent == nullptr) {
666 TELEPHONY_LOGE("CellularCallHiSysEvent is null.");
667 return;
668 }
669 callHiSysEvent->GetCallParameterInfo(info);
670 if (result->error != ErrType::NONE) {
671 CellularCallEventInfo eventInfo;
672 eventInfo.eventId = RequestResultEventId::INVALID_REQUEST_RESULT_EVENT_ID;
673 CommonResultEventHandling(event, eventInfo);
674 if (eventInfo.eventId == RequestResultEventId::RESULT_END_SEND_FAILED ||
675 eventInfo.eventId == RequestResultEventId::RESULT_REJECT_SEND_FAILED) {
676 CellularCallHiSysEvent::WriteHangUpCallBehaviorEvent(info, CallResponseResult::COMMAND_FAILURE);
677 } else if (eventInfo.eventId == RequestResultEventId::RESULT_ACCEPT_SEND_FAILED) {
678 CellularCallHiSysEvent::WriteAnswerCallBehaviorEvent(info, CallResponseResult::COMMAND_FAILURE);
679 } else {
680 TELEPHONY_LOGW("[slot%{public}d] eventId is:%{public}d, not within the scope of processing", slotId_,
681 eventInfo.eventId);
682 }
683 if (registerInstance_ == nullptr) {
684 TELEPHONY_LOGE("[slot%{public}d] registerInstance_ is null", slotId_);
685 return;
686 }
687 registerInstance_->ReportEventResultInfo(eventInfo);
688 return;
689 }
690 uint32_t id = event->GetInnerEventId();
691 if (id == RadioEvent::RADIO_HANGUP_CONNECT || id == RadioEvent::RADIO_REJECT_CALL) {
692 CellularCallHiSysEvent::WriteHangUpCallBehaviorEvent(info, CallResponseResult::COMMAND_SUCCESS);
693 } else if (id == RadioEvent::RADIO_ACCEPT_CALL) {
694 CellularCallHiSysEvent::WriteAnswerCallBehaviorEvent(info, CallResponseResult::COMMAND_SUCCESS);
695 } else {
696 TELEPHONY_LOGW("[slot%{public}d] id is:%{public}d, not within the scope of processing", slotId_, id);
697 }
698 }
699
ExecutePostDial(const AppExecFwk::InnerEvent::Pointer & event)700 void CellularCallHandler::ExecutePostDial(const AppExecFwk::InnerEvent::Pointer &event)
701 {
702 auto postDialData = event->GetSharedObject<PostDialData>();
703 if (postDialData == nullptr) {
704 TELEPHONY_LOGE("[slot%{public}d] postDialData is null", slotId_);
705 return;
706 }
707 auto serviceInstance = DelayedSingleton<CellularCallService>::GetInstance();
708 if (serviceInstance == nullptr) {
709 TELEPHONY_LOGE("[slot%{public}d] serviceInstance is null", slotId_);
710 return;
711 }
712 int64_t callId = postDialData->callId;
713 if (postDialData->isIms) {
714 auto imsControl = serviceInstance->GetImsControl(slotId_);
715 if (imsControl == nullptr) {
716 TELEPHONY_LOGE("[slot%{public}d] imsControl is null", slotId_);
717 return;
718 }
719 imsControl->ExecutePostDial(slotId_, callId);
720 } else {
721 auto csControl = serviceInstance->GetCsControl(slotId_);
722 if (csControl == nullptr) {
723 TELEPHONY_LOGE("[slot%{public}d] csControl is null", slotId_);
724 return;
725 }
726 csControl->ExecutePostDial(slotId_, callId);
727 }
728 }
729
SwapCallResponse(const AppExecFwk::InnerEvent::Pointer & event)730 void CellularCallHandler::SwapCallResponse(const AppExecFwk::InnerEvent::Pointer &event)
731 {
732 auto serviceInstence = DelayedSingleton<CellularCallService>::GetInstance();
733 if (serviceInstence == nullptr) {
734 TELEPHONY_LOGE("[slot%{public}d] registerInstance_ is null", slotId_);
735 return;
736 }
737 auto callType = event->GetParam();
738 std::shared_ptr<IMSControl> imsControl = nullptr;
739 if (callType == static_cast<int32_t>(CallType::TYPE_IMS)) {
740 imsControl = serviceInstence->GetImsControl(slotId_);
741 if (imsControl == nullptr) {
742 TELEPHONY_LOGE("[slot%{public}d] imsControl is null", slotId_);
743 return;
744 }
745 imsControl->RecoverPendingHold();
746 }
747 auto result = event->GetSharedObject<RadioResponseInfo>();
748 if (result == nullptr) {
749 TELEPHONY_LOGE("[slot%{public}d] result is null", slotId_);
750 return;
751 }
752 if (result->error != ErrType::NONE) {
753 CellularCallEventInfo eventInfo;
754 eventInfo.eventId = RequestResultEventId::INVALID_REQUEST_RESULT_EVENT_ID;
755 CommonResultEventHandling(event, eventInfo);
756 if (registerInstance_ == nullptr) {
757 TELEPHONY_LOGE("[slot%{public}d] registerInstance_ is null", slotId_);
758 return;
759 }
760 registerInstance_->ReportEventResultInfo(eventInfo);
761 return;
762 }
763 if (imsControl != nullptr) {
764 imsControl->DialAfterHold(slotId_);
765 }
766 }
767
SendDtmfResponse(const AppExecFwk::InnerEvent::Pointer & event)768 void CellularCallHandler::SendDtmfResponse(const AppExecFwk::InnerEvent::Pointer &event)
769 {
770 auto result = event->GetSharedObject<RadioResponseInfo>();
771 if (result == nullptr) {
772 TELEPHONY_LOGE("[slot%{public}d] result is null", slotId_);
773 return;
774 }
775
776 std::shared_ptr<PostDialData> postDial = std::make_shared<PostDialData>();
777 postDial->callId = result->flag;
778 postDial->isIms = event->GetParam() == static_cast<int32_t>(CallType::TYPE_IMS);
779 this->SendEvent(EVENT_EXECUTE_POST_DIAL, postDial, DELAY_TIME);
780
781 CellularCallEventInfo eventInfo;
782 eventInfo.eventType = CellularCallEventType::EVENT_REQUEST_RESULT_TYPE;
783 if (result->error != ErrType::NONE) {
784 eventInfo.eventId = RequestResultEventId::RESULT_SEND_DTMF_FAILED;
785 } else {
786 eventInfo.eventId = RequestResultEventId::RESULT_SEND_DTMF_SUCCESS;
787 }
788 if (registerInstance_ == nullptr) {
789 TELEPHONY_LOGE("[slot%{public}d] registerInstance_ is null", slotId_);
790 return;
791 }
792 registerInstance_->ReportEventResultInfo(eventInfo);
793 }
794
StartDtmfResponse(const AppExecFwk::InnerEvent::Pointer & event)795 void CellularCallHandler::StartDtmfResponse(const AppExecFwk::InnerEvent::Pointer &event)
796 {
797 auto result = event->GetSharedObject<RadioResponseInfo>();
798 if (result == nullptr) {
799 TELEPHONY_LOGE("[slot%{public}d] result is null", slotId_);
800 return;
801 }
802 if (registerInstance_ == nullptr) {
803 TELEPHONY_LOGE("[slot%{public}d] registerInstance_ is null", slotId_);
804 return;
805 }
806 registerInstance_->ReportStartDtmfResult(static_cast<int32_t>(result->error));
807 }
808
SimStateChangeReport(const AppExecFwk::InnerEvent::Pointer & event)809 void CellularCallHandler::SimStateChangeReport(const AppExecFwk::InnerEvent::Pointer &event)
810 {
811 CellularCallConfig config;
812 config.HandleSimStateChanged(slotId_);
813 }
814
FactoryReset(const AppExecFwk::InnerEvent::Pointer & event)815 void CellularCallHandler::FactoryReset(const AppExecFwk::InnerEvent::Pointer &event)
816 {
817 CellularCallConfig config;
818 config.HandleFactoryReset(slotId_);
819 }
820
SimRecordsLoadedReport(const AppExecFwk::InnerEvent::Pointer & event)821 void CellularCallHandler::SimRecordsLoadedReport(const AppExecFwk::InnerEvent::Pointer &event)
822 {
823 CellularCallConfig config;
824 config.HandleSimRecordsLoaded(slotId_);
825 }
826
SimAccountLoadedReport(const AppExecFwk::InnerEvent::Pointer & event)827 void CellularCallHandler::SimAccountLoadedReport(const AppExecFwk::InnerEvent::Pointer &event)
828 {
829 CellularCallConfig config;
830 config.HandleSimAccountLoaded(slotId_);
831 }
832
ResidentNetworkChangeReport(const AppExecFwk::InnerEvent::Pointer & event)833 void CellularCallHandler::ResidentNetworkChangeReport(const AppExecFwk::InnerEvent::Pointer &event)
834 {
835 if (event == nullptr) {
836 TELEPHONY_LOGE("ResidentNetworkChangeReport event is nullptr slotId:%{public}d!", slotId_);
837 return;
838 }
839 auto result = event->GetSharedObject<std::string>();
840 if (result == nullptr) {
841 TELEPHONY_LOGE("[slot%{public}d] result is null", slotId_);
842 return;
843 }
844 CellularCallConfig config;
845 config.HandleResidentNetworkChange(slotId_, *result);
846 }
847
NetworkStateChangeReport(const AppExecFwk::InnerEvent::Pointer & event)848 void CellularCallHandler::NetworkStateChangeReport(const AppExecFwk::InnerEvent::Pointer &event)
849 {
850 if (event == nullptr) {
851 TELEPHONY_LOGE("NetworkStateChangeReport event is nullptr slotId:%{public}d!", slotId_);
852 return;
853 }
854 CellularCallConfig config;
855 config.HandleNetworkStateChange(slotId_);
856 }
857
StopDtmfResponse(const AppExecFwk::InnerEvent::Pointer & event)858 void CellularCallHandler::StopDtmfResponse(const AppExecFwk::InnerEvent::Pointer &event)
859 {
860 auto result = event->GetSharedObject<RadioResponseInfo>();
861 if (result == nullptr) {
862 TELEPHONY_LOGE("[slot%{public}d] result is null", slotId_);
863 return;
864 }
865 if (registerInstance_ == nullptr) {
866 TELEPHONY_LOGE("[slot%{public}d] registerInstance_ is null", slotId_);
867 return;
868 }
869 registerInstance_->ReportStopDtmfResult(static_cast<int32_t>(result->error));
870 }
871
ReceiveUpdateCallMediaModeRequest(const AppExecFwk::InnerEvent::Pointer & event)872 void CellularCallHandler::ReceiveUpdateCallMediaModeRequest(const AppExecFwk::InnerEvent::Pointer &event)
873 {
874 struct CallBehaviorParameterInfo info = { 0 };
875 auto callHiSysEvent = DelayedSingleton<CellularCallHiSysEvent>::GetInstance();
876 if (callHiSysEvent == nullptr) {
877 TELEPHONY_LOGE("CellularCallHiSysEvent is null.");
878 return;
879 }
880 callHiSysEvent->GetCallParameterInfo(info);
881 auto result = event->GetSharedObject<ImsCallModeReceiveInfo>();
882 if (result == nullptr) {
883 TELEPHONY_LOGE("[slot%{public}d] result is null", slotId_);
884 return;
885 }
886 if (registerInstance_ == nullptr) {
887 TELEPHONY_LOGE("[slot%{public}d] registerInstance_ is null", slotId_);
888 return;
889 }
890 registerInstance_->ReceiveUpdateCallMediaModeRequest(slotId_, *result);
891 int32_t requestResult = static_cast<ImsCallModeRequestResult>(result->result);
892 CellularCallHiSysEvent::WriteImsCallModeBehaviorEvent(
893 CallModeBehaviorType::RECEIVE_REQUEST_EVENT, info, requestResult);
894 }
895
ReceiveUpdateCallMediaModeResponse(const AppExecFwk::InnerEvent::Pointer & event)896 void CellularCallHandler::ReceiveUpdateCallMediaModeResponse(const AppExecFwk::InnerEvent::Pointer &event)
897 {
898 struct CallBehaviorParameterInfo info = { 0 };
899 auto callHiSysEvent = DelayedSingleton<CellularCallHiSysEvent>::GetInstance();
900 if (callHiSysEvent == nullptr) {
901 TELEPHONY_LOGE("CellularCallHiSysEvent is null.");
902 return;
903 }
904 callHiSysEvent->GetCallParameterInfo(info);
905 auto result = event->GetSharedObject<ImsCallModeReceiveInfo>();
906 if (result == nullptr) {
907 TELEPHONY_LOGE("[slot%{public}d] result is null", slotId_);
908 return;
909 }
910 if (registerInstance_ == nullptr) {
911 TELEPHONY_LOGE("[slot%{public}d] registerInstance_ is null", slotId_);
912 return;
913 }
914 registerInstance_->ReceiveUpdateCallMediaModeResponse(slotId_, *result);
915 info.videoState = static_cast<ImsCallType>(result->callType);
916 int32_t requestResult = static_cast<ImsCallModeRequestResult>(result->result);
917 CellularCallHiSysEvent::WriteImsCallModeBehaviorEvent(
918 CallModeBehaviorType::RECEIVE_RESPONSE_EVENT, info, requestResult);
919 }
920
HandleCallSessionEventChanged(const AppExecFwk::InnerEvent::Pointer & event)921 void CellularCallHandler::HandleCallSessionEventChanged(const AppExecFwk::InnerEvent::Pointer &event)
922 {
923 auto result = event->GetSharedObject<ImsCallSessionEventInfo>();
924 if (result == nullptr) {
925 TELEPHONY_LOGE("[slot%{public}d] result is null", slotId_);
926 return;
927 }
928 if (registerInstance_ == nullptr) {
929 TELEPHONY_LOGE("[slot%{public}d] registerInstance_ is null", slotId_);
930 return;
931 }
932 registerInstance_->HandleCallSessionEventChanged(*result);
933 }
934
HandlePeerDimensionsChanged(const AppExecFwk::InnerEvent::Pointer & event)935 void CellularCallHandler::HandlePeerDimensionsChanged(const AppExecFwk::InnerEvent::Pointer &event)
936 {
937 auto result = event->GetSharedObject<ImsCallPeerDimensionsInfo>();
938 if (result == nullptr) {
939 TELEPHONY_LOGE("[slot%{public}d] result is null", slotId_);
940 return;
941 }
942 if (registerInstance_ == nullptr) {
943 TELEPHONY_LOGE("[slot%{public}d] registerInstance_ is null", slotId_);
944 return;
945 }
946 registerInstance_->HandlePeerDimensionsChanged(*result);
947 }
948
HandleCallDataUsageChanged(const AppExecFwk::InnerEvent::Pointer & event)949 void CellularCallHandler::HandleCallDataUsageChanged(const AppExecFwk::InnerEvent::Pointer &event)
950 {
951 auto result = event->GetSharedObject<ImsCallDataUsageInfo>();
952 if (result == nullptr) {
953 TELEPHONY_LOGE("[slot%{public}d] result is null", slotId_);
954 return;
955 }
956 if (registerInstance_ == nullptr) {
957 TELEPHONY_LOGE("[slot%{public}d] registerInstance_ is null", slotId_);
958 return;
959 }
960 registerInstance_->HandleCallDataUsageChanged(*result);
961 }
962
HandleCameraCapabilitiesChanged(const AppExecFwk::InnerEvent::Pointer & event)963 void CellularCallHandler::HandleCameraCapabilitiesChanged(const AppExecFwk::InnerEvent::Pointer &event)
964 {
965 auto result = event->GetSharedObject<CameraCapabilitiesInfo>();
966 if (result == nullptr) {
967 TELEPHONY_LOGE("[slot%{public}d] result is null", slotId_);
968 return;
969 }
970 if (registerInstance_ == nullptr) {
971 TELEPHONY_LOGE("[slot%{public}d] registerInstance_ is null", slotId_);
972 return;
973 }
974 registerInstance_->HandleCameraCapabilitiesChanged(*result);
975 }
976
SetSlotId(int32_t id)977 void CellularCallHandler::SetSlotId(int32_t id)
978 {
979 slotId_ = id;
980 }
981
GetSlotId()982 int32_t CellularCallHandler::GetSlotId()
983 {
984 return slotId_;
985 }
986
CurrentTimeMillis()987 int64_t CellularCallHandler::CurrentTimeMillis()
988 {
989 int64_t timems =
990 std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch())
991 .count();
992 return timems;
993 }
994
GetCsCallsDataRequest(const AppExecFwk::InnerEvent::Pointer & event)995 void CellularCallHandler::GetCsCallsDataRequest(const AppExecFwk::InnerEvent::Pointer &event)
996 {
997 lastCallsDataFlag_ = CurrentTimeMillis();
998 CellularCallConnectionCS connectionCs;
999 connectionCs.GetCsCallsDataRequest(slotId_, lastCallsDataFlag_);
1000 }
1001
GetImsCallsDataRequest(const AppExecFwk::InnerEvent::Pointer & event)1002 void CellularCallHandler::GetImsCallsDataRequest(const AppExecFwk::InnerEvent::Pointer &event)
1003 {
1004 lastCallsDataFlag_ = CurrentTimeMillis();
1005 CellularCallConnectionIMS connectionIms;
1006 connectionIms.GetImsCallsDataRequest(slotId_, lastCallsDataFlag_);
1007 }
1008
GetSatelliteCallsDataRequest(const AppExecFwk::InnerEvent::Pointer & event)1009 void CellularCallHandler::GetSatelliteCallsDataRequest(const AppExecFwk::InnerEvent::Pointer &event)
1010 {
1011 lastCallsDataFlag_ = CurrentTimeMillis();
1012 CellularCallConnectionSatellite connectionSatellite;
1013 connectionSatellite.GetSatelliteCallsDataRequest(slotId_, lastCallsDataFlag_);
1014 }
1015
RegisterHandler(const AppExecFwk::InnerEvent::Pointer & event)1016 void CellularCallHandler::RegisterHandler(const AppExecFwk::InnerEvent::Pointer &event)
1017 {
1018 CellularCallConnectionCS connectionCs;
1019 connectionCs.RegisterHandler();
1020 }
1021
SetDomainPreferenceModeResponse(const AppExecFwk::InnerEvent::Pointer & event)1022 void CellularCallHandler::SetDomainPreferenceModeResponse(const AppExecFwk::InnerEvent::Pointer &event)
1023 {
1024 auto info = event->GetSharedObject<RadioResponseInfo>();
1025 if (info == nullptr) {
1026 TELEPHONY_LOGE("[slot%{public}d] info is null", slotId_);
1027 return;
1028 }
1029 CellularCallEventInfo eventInfo;
1030 eventInfo.eventType = CellularCallEventType::EVENT_REQUEST_RESULT_TYPE;
1031 if (info->error != ErrType::NONE) {
1032 eventInfo.eventId = RequestResultEventId::RESULT_SET_CALL_PREFERENCE_MODE_FAILED;
1033 } else {
1034 eventInfo.eventId = RequestResultEventId::RESULT_SET_CALL_PREFERENCE_MODE_SUCCESS;
1035
1036 CellularCallConfig config;
1037 config.SetTempMode(slotId_);
1038 }
1039 if (registerInstance_ == nullptr) {
1040 TELEPHONY_LOGE("[slot%{public}d] registerInstance_ is null", slotId_);
1041 return;
1042 }
1043 registerInstance_->ReportEventResultInfo(eventInfo);
1044 }
1045
GetDomainPreferenceModeResponse(const AppExecFwk::InnerEvent::Pointer & event)1046 void CellularCallHandler::GetDomainPreferenceModeResponse(const AppExecFwk::InnerEvent::Pointer &event)
1047 {
1048 auto mode = event->GetSharedObject<int32_t>();
1049 if (mode == nullptr) {
1050 TELEPHONY_LOGI("[slot%{public}d] mode is null", slotId_);
1051 return;
1052 }
1053 CellularCallConfig config;
1054 config.GetDomainPreferenceModeResponse(slotId_, *mode);
1055 }
1056
SetImsSwitchStatusResponse(const AppExecFwk::InnerEvent::Pointer & event)1057 void CellularCallHandler::SetImsSwitchStatusResponse(const AppExecFwk::InnerEvent::Pointer &event)
1058 {
1059 auto info = event->GetSharedObject<RadioResponseInfo>();
1060 if (info == nullptr) {
1061 TELEPHONY_LOGE("[slot%{public}d] info is null", slotId_);
1062 return;
1063 }
1064 if (registerInstance_ == nullptr) {
1065 TELEPHONY_LOGE("[slot%{public}d] registerInstance_ is null", slotId_);
1066 return;
1067 }
1068 CellularCallConfig config;
1069 config.HandleSetLteImsSwitchResult(slotId_, info->error);
1070 }
1071
GetImsSwitchStatusResponse(const AppExecFwk::InnerEvent::Pointer & event)1072 void CellularCallHandler::GetImsSwitchStatusResponse(const AppExecFwk::InnerEvent::Pointer &event) {}
1073
SetVoNRSwitchStatusResponse(const AppExecFwk::InnerEvent::Pointer & event)1074 void CellularCallHandler::SetVoNRSwitchStatusResponse(const AppExecFwk::InnerEvent::Pointer &event)
1075 {
1076 auto info = event->GetSharedObject<RadioResponseInfo>();
1077 if (info == nullptr) {
1078 TELEPHONY_LOGE("[slot%{public}d] info is null", slotId_);
1079 return;
1080 }
1081 CellularCallConfig config;
1082 config.HandleSetVoNRSwitchResult(slotId_, info->error);
1083 }
1084
CsCallStatusInfoReport(const AppExecFwk::InnerEvent::Pointer & event)1085 void CellularCallHandler::CsCallStatusInfoReport(const AppExecFwk::InnerEvent::Pointer &event)
1086 {
1087 TELEPHONY_LOGI("[slot%{public}d] CsCallStatusInfoReport entry", slotId_);
1088 if (srvccState_ == SrvccState::STARTED) {
1089 TELEPHONY_LOGI("[slot%{public}d] Ignore to report cs call state change cause by srvcc started", slotId_);
1090 return;
1091 }
1092 GetCsCallData(event);
1093 }
1094
ImsCallStatusInfoReport(const AppExecFwk::InnerEvent::Pointer & event)1095 void CellularCallHandler::ImsCallStatusInfoReport(const AppExecFwk::InnerEvent::Pointer &event)
1096 {
1097 GetImsCallData(event);
1098 }
1099
SatelliteCallStatusInfoReport(const AppExecFwk::InnerEvent::Pointer & event)1100 void CellularCallHandler::SatelliteCallStatusInfoReport(const AppExecFwk::InnerEvent::Pointer &event)
1101 {
1102 if (srvccState_ == SrvccState::STARTED) {
1103 TELEPHONY_LOGI("[slot%{public}d] Ignore to report satellite call state change cause by srvcc started", slotId_);
1104 return;
1105 }
1106 GetSatelliteCallData(event);
1107 }
1108
UssdNotifyResponse(const AppExecFwk::InnerEvent::Pointer & event)1109 void CellularCallHandler::UssdNotifyResponse(const AppExecFwk::InnerEvent::Pointer &event)
1110 {
1111 auto result = event->GetSharedObject<UssdNoticeInfo>();
1112 if (result == nullptr) {
1113 TELEPHONY_LOGE("[slot%{public}d] result is null", slotId_);
1114 return;
1115 }
1116 CellularCallSupplement supplement;
1117 supplement.EventUssdNotify(*result);
1118 }
1119
SetMuteResponse(const AppExecFwk::InnerEvent::Pointer & event)1120 void CellularCallHandler::SetMuteResponse(const AppExecFwk::InnerEvent::Pointer &event)
1121 {
1122 auto info = event->GetSharedObject<RadioResponseInfo>();
1123 if (info == nullptr) {
1124 TELEPHONY_LOGE("[slot%{public}d] info is null", slotId_);
1125 return;
1126 }
1127 MuteControlResponse response;
1128 if (registerInstance_ == nullptr) {
1129 TELEPHONY_LOGE("[slot%{public}d] registerInstance_ is null", slotId_);
1130 return;
1131 }
1132 response.result = static_cast<int32_t>(info->error);
1133 registerInstance_->ReportSetMuteResult(response);
1134 }
1135
GetMuteResponse(const AppExecFwk::InnerEvent::Pointer & event)1136 void CellularCallHandler::GetMuteResponse(const AppExecFwk::InnerEvent::Pointer &event)
1137 {
1138 MuteControlResponse response;
1139 auto mute = event->GetSharedObject<int32_t>();
1140 if (mute == nullptr) {
1141 TELEPHONY_LOGI("[slot%{public}d] mute is null", slotId_);
1142 auto info = event->GetSharedObject<RadioResponseInfo>();
1143 if (info == nullptr) {
1144 TELEPHONY_LOGE("[slot%{public}d] info is null", slotId_);
1145 return;
1146 }
1147 response.result = static_cast<int32_t>(info->error);
1148 } else {
1149 response.result = static_cast<int32_t>(ErrType::NONE);
1150 response.value = *mute;
1151 }
1152 if (registerInstance_ == nullptr) {
1153 TELEPHONY_LOGE("[slot%{public}d] registerInstance_ is null", slotId_);
1154 return;
1155 }
1156 registerInstance_->ReportGetMuteResult(response);
1157 }
1158
GetEmergencyCallListResponse(const AppExecFwk::InnerEvent::Pointer & event)1159 void CellularCallHandler::GetEmergencyCallListResponse(const AppExecFwk::InnerEvent::Pointer &event)
1160 {
1161 auto eccList = event->GetSharedObject<EmergencyInfoList>();
1162 if (eccList == nullptr) {
1163 TELEPHONY_LOGE("[slot%{public}d] eccList is null", slotId_);
1164 return;
1165 }
1166 CellularCallConfig config;
1167 config.UpdateEmergencyCallFromRadio(slotId_, *eccList);
1168 }
1169
SetEmergencyCallListResponse(const AppExecFwk::InnerEvent::Pointer & event)1170 void CellularCallHandler::SetEmergencyCallListResponse(const AppExecFwk::InnerEvent::Pointer &event)
1171 {
1172 auto info = event->GetSharedObject<RadioResponseInfo>();
1173 if (info == nullptr) {
1174 TELEPHONY_LOGE("[slot%{public}d] info is null", slotId_);
1175 return;
1176 }
1177 if (registerInstance_ == nullptr) {
1178 TELEPHONY_LOGE("[slot%{public}d] registerInstance_ is null", slotId_);
1179 return;
1180 }
1181 SetEccListResponse response;
1182 response.result = static_cast<int32_t>(info->error);
1183 registerInstance_->ReportSetEmergencyCallListResponse(response);
1184 }
1185
CallRingBackVoiceResponse(const AppExecFwk::InnerEvent::Pointer & event)1186 void CellularCallHandler::CallRingBackVoiceResponse(const AppExecFwk::InnerEvent::Pointer &event)
1187 {
1188 auto ringBackVoice = event->GetSharedObject<RingbackVoice>();
1189 if (ringBackVoice == nullptr) {
1190 TELEPHONY_LOGE("[slot%{public}d] ringBackVoice is null", slotId_);
1191 return;
1192 }
1193 if (registerInstance_ == nullptr) {
1194 TELEPHONY_LOGE("[slot%{public}d] registerInstance_ is null", slotId_);
1195 return;
1196 }
1197 registerInstance_->ReportCallRingBackResult(ringBackVoice->status);
1198 }
1199
GetCallFailReasonResponse(const AppExecFwk::InnerEvent::Pointer & event)1200 void CellularCallHandler::GetCallFailReasonResponse(const AppExecFwk::InnerEvent::Pointer &event)
1201 {
1202 if (registerInstance_ == nullptr) {
1203 TELEPHONY_LOGE("[slot%{public}d] registerInstance_ is null", slotId_);
1204 return;
1205 }
1206 auto reason = event->GetSharedObject<int32_t>();
1207 DisconnectedDetails details;
1208 if (reason == nullptr) {
1209 auto info = event->GetSharedObject<DisconnectedDetails>();
1210 if (info == nullptr) {
1211 TELEPHONY_LOGE("[slot%{public}d] info is null", slotId_);
1212 return;
1213 }
1214 details.reason = static_cast<DisconnectedReason>(info->reason);
1215 details.message = (info->message.c_str() == nullptr) ? "" : info->message;
1216 } else {
1217 details.reason = static_cast<DisconnectedReason>(*reason);
1218 details.message = "";
1219 }
1220
1221 if (details.message.empty()) {
1222 std::string callFailedMessageName = "";
1223 bool ret =
1224 ResourceUtils::Get().GetCallFailedMessageName(static_cast<int32_t>(details.reason), callFailedMessageName);
1225 if (!ret) {
1226 TELEPHONY_LOGE("[slot%{public}d] Get call failed message failed!", slotId_);
1227 return;
1228 }
1229 ResourceUtils::Get().GetStringValueByName(callFailedMessageName, details.message);
1230 }
1231 CellularCallHiSysEvent::WriteCallEndBehaviorEvent(slotId_, static_cast<int32_t>(details.reason));
1232 registerInstance_->ReportCallFailReason(details);
1233 }
1234
UpdateSrvccStateReport(const AppExecFwk::InnerEvent::Pointer & event)1235 void CellularCallHandler::UpdateSrvccStateReport(const AppExecFwk::InnerEvent::Pointer &event)
1236 {
1237 auto srvccStatus = event->GetSharedObject<SrvccStatus>();
1238 if (srvccStatus == nullptr) {
1239 TELEPHONY_LOGE("[slot%{public}d] srvccStatus is null", slotId_);
1240 return;
1241 }
1242 TELEPHONY_LOGI("[slot%{public}d] srvccStatus is %{public}d", slotId_, srvccStatus->status);
1243 srvccState_ = srvccStatus->status;
1244 auto serviceInstance_ = DelayedSingleton<CellularCallService>::GetInstance();
1245 if (registerInstance_ == nullptr) {
1246 TELEPHONY_LOGE("[slot%{public}d] registerInstance_ is null", slotId_);
1247 return;
1248 }
1249 serviceInstance_->SetSrvccState(srvccState_);
1250 if (srvccState_ != SrvccState::COMPLETED) {
1251 TELEPHONY_LOGE("[slot%{public}d] srvccState_ != SrvccState::COMPLETED", slotId_);
1252 return;
1253 }
1254 SrvccStateCompleted();
1255 }
1256
ReportEccChanged(const AppExecFwk::InnerEvent::Pointer & event)1257 void CellularCallHandler::ReportEccChanged(const AppExecFwk::InnerEvent::Pointer &event)
1258 {
1259 auto emergencyInfoList = event->GetSharedObject<EmergencyInfoList>();
1260 if (emergencyInfoList == nullptr) {
1261 TELEPHONY_LOGE("[slot%{public}d] emergencyInfoList is null", slotId_);
1262 return;
1263 }
1264 CellularCallConfig config;
1265 auto calls = emergencyInfoList->calls;
1266 if (calls.size() > 0 && static_cast<uint32_t>(calls.back().total) != calls.size()) {
1267 TELEPHONY_LOGE("[slot%{public}d] data error", slotId_);
1268 auto endCall = calls.back();
1269 if (endCall.index < endCall.total) {
1270 return;
1271 }
1272 TELEPHONY_LOGI("[slot%{public}d] try query", slotId_);
1273 config.GetEmergencyCallList(slotId_);
1274 return;
1275 }
1276 config.UpdateEmergencyCallFromRadio(slotId_, *emergencyInfoList);
1277 }
1278
SrvccStateCompleted()1279 void CellularCallHandler::SrvccStateCompleted()
1280 {
1281 if (srvccState_ != SrvccState::COMPLETED) {
1282 TELEPHONY_LOGE("[slot%{public}d] srvccState_ != SrvccState::COMPLETED", slotId_);
1283 return;
1284 }
1285 auto serviceInstance_ = DelayedSingleton<CellularCallService>::GetInstance();
1286 if (serviceInstance_ == nullptr) {
1287 TELEPHONY_LOGE("[slot%{public}d] registerInstance_ is null", slotId_);
1288 return;
1289 }
1290 auto csControl = serviceInstance_->GetCsControl(slotId_);
1291 if (csControl != nullptr) {
1292 TELEPHONY_LOGI("[slot%{public}d] CsControl ReleaseAllConnection", slotId_);
1293 csControl->ReleaseAllConnection();
1294 serviceInstance_->SetCsControl(slotId_, nullptr);
1295 } else {
1296 TELEPHONY_LOGI("[slot%{public}d] CsControl is null", slotId_);
1297 csControl = std::make_shared<CSControl>();
1298 serviceInstance_->SetCsControl(slotId_, csControl);
1299 }
1300 auto imsControl = serviceInstance_->GetImsControl(slotId_);
1301 if (imsControl != nullptr) {
1302 TELEPHONY_LOGI("[slot%{public}d] ImsControl ReleaseAllConnection", slotId_);
1303 imsControl->ReleaseAllConnection();
1304 serviceInstance_->SetImsControl(slotId_, nullptr);
1305 } else {
1306 TELEPHONY_LOGI("[slot%{public}d] imsControl is null", slotId_);
1307 }
1308 srvccState_ = SrvccState::SRVCC_NONE;
1309 }
1310
GetMMIResponse(const AppExecFwk::InnerEvent::Pointer & event)1311 void CellularCallHandler::GetMMIResponse(const AppExecFwk::InnerEvent::Pointer &event)
1312 {
1313 std::unique_ptr<MMICodeUtils> mmiCodeUtils = event->GetUniqueObject<MMICodeUtils>();
1314 if (mmiCodeUtils == nullptr) {
1315 TELEPHONY_LOGE("[slot%{public}d] mmiCodeUtils is null", slotId_);
1316 return;
1317 }
1318 mmiCodeUtils->ExecuteMmiCode(slotId_);
1319 }
1320
GetCallWaitingResponse(const AppExecFwk::InnerEvent::Pointer & event)1321 void CellularCallHandler::GetCallWaitingResponse(const AppExecFwk::InnerEvent::Pointer &event)
1322 {
1323 auto result = event->GetSharedObject<CallWaitResult>();
1324 if (result == nullptr) {
1325 TELEPHONY_LOGE("[slot%{public}d] result is null", slotId_);
1326 return;
1327 }
1328 int32_t flag = SS_FROM_MMI_CODE;
1329 int32_t ret = ConfirmAndRemoveSsRequestCommand(result->result.index, flag);
1330 if (ret != TELEPHONY_SUCCESS) {
1331 return;
1332 }
1333 CellularCallSupplement supplement;
1334 supplement.EventGetCallWaiting(*result, result->result.message, flag);
1335 }
1336
SetCallWaitingResponse(const AppExecFwk::InnerEvent::Pointer & event)1337 void CellularCallHandler::SetCallWaitingResponse(const AppExecFwk::InnerEvent::Pointer &event)
1338 {
1339 auto result = event->GetSharedObject<SsBaseResult>();
1340 if (result == nullptr) {
1341 TELEPHONY_LOGE("[slot%{public}d] result is null", slotId_);
1342 return;
1343 }
1344 int32_t flag = SS_FROM_MMI_CODE;
1345 int32_t ret = ConfirmAndRemoveSsRequestCommand(result->index, flag);
1346 if (ret != TELEPHONY_SUCCESS) {
1347 return;
1348 }
1349 CellularCallSupplement supplement;
1350 if (result->result != TELEPHONY_SUCCESS) {
1351 result->result = TELEPHONY_ERR_RIL_CMD_FAIL;
1352 }
1353 supplement.EventSetCallWaiting(result->result, result->message, flag);
1354 }
1355
GetClirResponse(const AppExecFwk::InnerEvent::Pointer & event)1356 void CellularCallHandler::GetClirResponse(const AppExecFwk::InnerEvent::Pointer &event)
1357 {
1358 auto getClirResult = event->GetSharedObject<GetClirResult>();
1359 if (getClirResult == nullptr) {
1360 TELEPHONY_LOGE("[slot%{public}d] getClirResult is null", slotId_);
1361 return;
1362 }
1363 int32_t flag = SS_FROM_MMI_CODE;
1364 int32_t ret = ConfirmAndRemoveSsRequestCommand(getClirResult->result.index, flag);
1365 if (ret != TELEPHONY_SUCCESS) {
1366 return;
1367 }
1368 CellularCallSupplement supplement;
1369 supplement.EventGetClir(*getClirResult, getClirResult->result.message, flag);
1370 }
1371
SetClirResponse(const AppExecFwk::InnerEvent::Pointer & event)1372 void CellularCallHandler::SetClirResponse(const AppExecFwk::InnerEvent::Pointer &event)
1373 {
1374 auto result = event->GetSharedObject<SsBaseResult>();
1375 if (result == nullptr) {
1376 TELEPHONY_LOGE("[slot%{public}d] result is null", slotId_);
1377 return;
1378 }
1379 int32_t flag = SS_FROM_MMI_CODE;
1380 int32_t ret = ConfirmAndRemoveSsRequestCommand(result->index, flag);
1381 if (ret != TELEPHONY_SUCCESS) {
1382 return;
1383 }
1384 CellularCallSupplement supplement;
1385 supplement.EventSetClir(result->result, result->message, flag);
1386 }
1387
GetClipResponse(const AppExecFwk::InnerEvent::Pointer & event)1388 void CellularCallHandler::GetClipResponse(const AppExecFwk::InnerEvent::Pointer &event)
1389 {
1390 auto getClipResult = event->GetSharedObject<GetClipResult>();
1391 if (getClipResult == nullptr) {
1392 TELEPHONY_LOGE("[slot%{public}d] getClipResult is null", slotId_);
1393 return;
1394 }
1395 int32_t flag = SS_FROM_MMI_CODE;
1396 int32_t ret = ConfirmAndRemoveSsRequestCommand(getClipResult->result.index, flag);
1397 if (ret != TELEPHONY_SUCCESS) {
1398 return;
1399 }
1400 CellularCallSupplement supplement;
1401 supplement.EventGetClip(*getClipResult, getClipResult->result.message, flag);
1402 }
1403
SetClipResponse(const AppExecFwk::InnerEvent::Pointer & event)1404 void CellularCallHandler::SetClipResponse(const AppExecFwk::InnerEvent::Pointer &event)
1405 {
1406 auto result = event->GetSharedObject<SsBaseResult>();
1407 if (result == nullptr) {
1408 TELEPHONY_LOGE("[slot%{public}d] result is null", slotId_);
1409 return;
1410 }
1411 int32_t flag = SS_FROM_MMI_CODE;
1412 int32_t ret = ConfirmAndRemoveSsRequestCommand(result->index, flag);
1413 if (ret != TELEPHONY_SUCCESS) {
1414 return;
1415 }
1416 CellularCallSupplement supplement;
1417 supplement.EventSetClip(result->result, result->message, flag);
1418 }
1419
GetColrResponse(const AppExecFwk::InnerEvent::Pointer & event)1420 void CellularCallHandler::GetColrResponse(const AppExecFwk::InnerEvent::Pointer &event)
1421 {
1422 auto colrResult = event->GetSharedObject<GetColrResult>();
1423 if (colrResult == nullptr) {
1424 TELEPHONY_LOGE("[slot%{public}d] colrResult is null", slotId_);
1425 return;
1426 }
1427 int32_t flag = SS_FROM_MMI_CODE;
1428 int32_t ret = ConfirmAndRemoveSsRequestCommand(colrResult->result.index, flag);
1429 if (ret != TELEPHONY_SUCCESS) {
1430 return;
1431 }
1432 CellularCallSupplement supplement;
1433 supplement.EventGetColr(*colrResult, colrResult->result.message, flag);
1434 }
1435
SetColrResponse(const AppExecFwk::InnerEvent::Pointer & event)1436 void CellularCallHandler::SetColrResponse(const AppExecFwk::InnerEvent::Pointer &event)
1437 {
1438 auto result = event->GetSharedObject<SsBaseResult>();
1439 if (result == nullptr) {
1440 TELEPHONY_LOGE("[slot%{public}d] result is null", slotId_);
1441 return;
1442 }
1443 int32_t flag = SS_FROM_MMI_CODE;
1444 int32_t ret = ConfirmAndRemoveSsRequestCommand(result->index, flag);
1445 if (ret != TELEPHONY_SUCCESS) {
1446 return;
1447 }
1448 CellularCallSupplement supplement;
1449 supplement.EventSetColr(result->result, result->message, flag);
1450 }
1451
GetColpResponse(const AppExecFwk::InnerEvent::Pointer & event)1452 void CellularCallHandler::GetColpResponse(const AppExecFwk::InnerEvent::Pointer &event)
1453 {
1454 auto colpResult = event->GetSharedObject<GetColpResult>();
1455 if (colpResult == nullptr) {
1456 TELEPHONY_LOGE("[slot%{public}d] colpResult is null", slotId_);
1457 return;
1458 }
1459 int32_t flag = SS_FROM_MMI_CODE;
1460 int32_t ret = ConfirmAndRemoveSsRequestCommand(colpResult->result.index, flag);
1461 if (ret != TELEPHONY_SUCCESS) {
1462 return;
1463 }
1464 CellularCallSupplement supplement;
1465 supplement.EventGetColp(*colpResult, colpResult->result.message, flag);
1466 }
1467
SetColpResponse(const AppExecFwk::InnerEvent::Pointer & event)1468 void CellularCallHandler::SetColpResponse(const AppExecFwk::InnerEvent::Pointer &event)
1469 {
1470 auto result = event->GetSharedObject<SsBaseResult>();
1471 if (result == nullptr) {
1472 TELEPHONY_LOGE("[slot%{public}d] result is null", slotId_);
1473 return;
1474 }
1475 int32_t flag = SS_FROM_MMI_CODE;
1476 int32_t ret = ConfirmAndRemoveSsRequestCommand(result->index, flag);
1477 if (ret != TELEPHONY_SUCCESS) {
1478 return;
1479 }
1480 CellularCallSupplement supplement;
1481 supplement.EventSetColp(result->result, result->message, flag);
1482 }
1483
GetCallTransferResponse(const AppExecFwk::InnerEvent::Pointer & event)1484 void CellularCallHandler::GetCallTransferResponse(const AppExecFwk::InnerEvent::Pointer &event)
1485 {
1486 auto cFQueryList = event->GetSharedObject<CallForwardQueryInfoList>();
1487 if (cFQueryList == nullptr) {
1488 TELEPHONY_LOGE("[slot%{public}d] cFQueryList is null", slotId_);
1489 return;
1490 }
1491 SsRequestCommand ss;
1492 int32_t ret = GetSsRequestCommand(cFQueryList->result.index, ss);
1493 if (ret == TELEPHONY_SUCCESS) {
1494 cFQueryList->result.reason = ss.cfReason;
1495 }
1496 int32_t flag = SS_FROM_MMI_CODE;
1497 ret = ConfirmAndRemoveSsRequestCommand(cFQueryList->result.index, flag);
1498 if (ret != TELEPHONY_SUCCESS) {
1499 return;
1500 }
1501 CellularCallSupplement supplement;
1502 supplement.EventGetCallTransferInfo(*cFQueryList, cFQueryList->result.message, flag);
1503 }
1504
SetCallTransferInfoResponse(const AppExecFwk::InnerEvent::Pointer & event)1505 void CellularCallHandler::SetCallTransferInfoResponse(const AppExecFwk::InnerEvent::Pointer &event)
1506 {
1507 auto result = event->GetSharedObject<SsBaseResult>();
1508 if (result == nullptr) {
1509 TELEPHONY_LOGE("[slot%{public}d] result is null", slotId_);
1510 return;
1511 }
1512 int32_t flag = SS_FROM_MMI_CODE;
1513 int32_t ret = ConfirmAndRemoveSsRequestCommand(result->index, flag);
1514 if (ret != TELEPHONY_SUCCESS) {
1515 return;
1516 }
1517 CellularCallSupplement supplement;
1518 CallForwardingInfo info;
1519 auto callHiSysEvent = DelayedSingleton<CellularCallHiSysEvent>::GetInstance();
1520 if (callHiSysEvent == nullptr) {
1521 TELEPHONY_LOGE("CellularCallHiSysEvent is null.");
1522 return;
1523 }
1524 callHiSysEvent->GetCallForwardingInfo(info);
1525 if (result->result == TELEPHONY_SUCCESS) {
1526 CoreManagerInner::GetInstance().SetVoiceCallForwarding(info.slotId, info.enable, info.number);
1527 } else {
1528 result->result = TELEPHONY_ERR_RIL_CMD_FAIL;
1529 }
1530 supplement.EventSetCallTransferInfo(result->result, result->message, flag);
1531 }
1532
GetCallRestrictionResponse(const AppExecFwk::InnerEvent::Pointer & event)1533 void CellularCallHandler::GetCallRestrictionResponse(const AppExecFwk::InnerEvent::Pointer &event)
1534 {
1535 auto result = event->GetSharedObject<CallRestrictionResult>();
1536 if (result == nullptr) {
1537 TELEPHONY_LOGE("[slot%{public}d] result is null", slotId_);
1538 return;
1539 }
1540 int32_t flag = SS_FROM_MMI_CODE;
1541 int32_t ret = ConfirmAndRemoveSsRequestCommand(result->result.index, flag);
1542 if (ret != TELEPHONY_SUCCESS) {
1543 return;
1544 }
1545 CellularCallSupplement supplement;
1546 supplement.EventGetCallRestriction(*result, result->result.message, flag);
1547 }
1548
SetCallRestrictionResponse(const AppExecFwk::InnerEvent::Pointer & event)1549 void CellularCallHandler::SetCallRestrictionResponse(const AppExecFwk::InnerEvent::Pointer &event)
1550 {
1551 auto result = event->GetSharedObject<SsBaseResult>();
1552 if (result == nullptr) {
1553 TELEPHONY_LOGE("[slot%{public}d] result is null", slotId_);
1554 return;
1555 }
1556 int32_t flag = SS_FROM_MMI_CODE;
1557 int32_t ret = ConfirmAndRemoveSsRequestCommand(result->index, flag);
1558 if (ret != TELEPHONY_SUCCESS) {
1559 return;
1560 }
1561 CellularCallSupplement supplement;
1562 if (result->result != TELEPHONY_SUCCESS) {
1563 result->result = TELEPHONY_ERR_RIL_CMD_FAIL;
1564 }
1565 supplement.EventSetCallRestriction(result->result, result->message, flag);
1566 }
1567
SetBarringPasswordResponse(const AppExecFwk::InnerEvent::Pointer & event)1568 void CellularCallHandler::SetBarringPasswordResponse(const AppExecFwk::InnerEvent::Pointer &event)
1569 {
1570 auto result = event->GetSharedObject<SsBaseResult>();
1571 if (result == nullptr) {
1572 TELEPHONY_LOGE("[slot%{public}d] result is null", slotId_);
1573 return;
1574 }
1575 int32_t flag = SS_FROM_MMI_CODE;
1576 int32_t ret = ConfirmAndRemoveSsRequestCommand(result->index, flag);
1577 if (ret != TELEPHONY_SUCCESS) {
1578 return;
1579 }
1580 CellularCallSupplement supplement;
1581 if (result->result != TELEPHONY_SUCCESS) {
1582 result->result = TELEPHONY_ERR_RIL_CMD_FAIL;
1583 }
1584 supplement.EventSetBarringPassword(result->result, result->message, flag);
1585 }
1586
SendUssdResponse(const AppExecFwk::InnerEvent::Pointer & event)1587 void CellularCallHandler::SendUssdResponse(const AppExecFwk::InnerEvent::Pointer &event)
1588 {
1589 auto result = event->GetSharedObject<RadioResponseInfo>();
1590 if (result == nullptr) {
1591 TELEPHONY_LOGE("[slot%{public}d] result is null", slotId_);
1592 return;
1593 }
1594 CellularCallSupplement supplement;
1595 supplement.EventSendUssd(*result);
1596 }
1597
SsNotifyResponse(const AppExecFwk::InnerEvent::Pointer & event)1598 void CellularCallHandler::SsNotifyResponse(const AppExecFwk::InnerEvent::Pointer &event)
1599 {
1600 auto result = event->GetSharedObject<SsNoticeInfo>();
1601 if (result == nullptr) {
1602 TELEPHONY_LOGE("[slot%{public}d] result is null", slotId_);
1603 return;
1604 }
1605 CellularCallSupplement supplement;
1606 supplement.EventSsNotify(*result);
1607 }
1608
SendUnlockPinPukResponse(const AppExecFwk::InnerEvent::Pointer & event)1609 void CellularCallHandler::SendUnlockPinPukResponse(const AppExecFwk::InnerEvent::Pointer &event)
1610 {
1611 auto result = event->GetSharedObject<PinPukResponse>();
1612 if (result == nullptr) {
1613 TELEPHONY_LOGE("[slot%{public}d] result is null", slotId_);
1614 return;
1615 }
1616 CellularCallSupplement supplement;
1617 supplement.EventSetPinPuk(*result);
1618 }
1619
HandleOperatorConfigChanged(const AppExecFwk::InnerEvent::Pointer & event)1620 void CellularCallHandler::HandleOperatorConfigChanged(const AppExecFwk::InnerEvent::Pointer &event)
1621 {
1622 CellularCallConfig config;
1623 config.HandleOperatorConfigChanged(slotId_);
1624 }
1625
UpdateRsrvccStateReport(const AppExecFwk::InnerEvent::Pointer & event)1626 void CellularCallHandler::UpdateRsrvccStateReport(const AppExecFwk::InnerEvent::Pointer &event)
1627 {
1628 isInCsRedial_ = true;
1629 auto serviceInstance = DelayedSingleton<CellularCallService>::GetInstance();
1630 if (serviceInstance == nullptr) {
1631 TELEPHONY_LOGE("[slot%{public}d] serviceInstance is null", slotId_);
1632 return;
1633 }
1634 serviceInstance->SetCsControl(slotId_, nullptr);
1635 }
1636
RequestSsRequestCommandIndex(int32_t & index)1637 void CellularCallHandler::RequestSsRequestCommandIndex(int32_t &index)
1638 {
1639 if (indexCommand_ >= MAX_REQUEST_COUNT) {
1640 indexCommand_ = 0;
1641 } else {
1642 indexCommand_++;
1643 }
1644 index = indexCommand_;
1645 }
1646
SaveSsRequestCommand(const std::shared_ptr<SsRequestCommand> & utCommand,int32_t index)1647 void CellularCallHandler::SaveSsRequestCommand(const std::shared_ptr<SsRequestCommand> &utCommand, int32_t index)
1648 {
1649 if (utCommand == nullptr) {
1650 TELEPHONY_LOGE("[slot%{public}d] utCommand is null", slotId_);
1651 return;
1652 }
1653 int32_t indexCommand = indexCommand_;
1654 std::lock_guard<std::mutex> lock(mutex_);
1655 utCommandMap_.insert(std::make_pair(indexCommand, utCommand));
1656 }
1657
ConfirmAndRemoveSsRequestCommand(int32_t index,int32_t & flag)1658 int32_t CellularCallHandler::ConfirmAndRemoveSsRequestCommand(int32_t index, int32_t &flag)
1659 {
1660 if (index == INVALID_INDEX) {
1661 // -1 mean this command index wasn't come from app, so don't need report result
1662 TELEPHONY_LOGI("[slot%{public}d] index is invalid, nothing need to do", slotId_);
1663 return TELEPHONY_ERROR;
1664 }
1665 std::lock_guard<std::mutex> lock(mutex_);
1666 auto itor = utCommandMap_.find(index);
1667 if (itor == utCommandMap_.end()) {
1668 TELEPHONY_LOGE("[slot%{public}d] the index(%{public}d) in utCommandMap_ haven't been found", slotId_, index);
1669 return TELEPHONY_ERROR;
1670 }
1671 flag = itor->second->flag;
1672 utCommandMap_.erase(index);
1673 return TELEPHONY_SUCCESS;
1674 }
1675
GetSsRequestCommand(int32_t index,SsRequestCommand & ss)1676 int32_t CellularCallHandler::GetSsRequestCommand(int32_t index, SsRequestCommand &ss)
1677 {
1678 std::lock_guard<std::mutex> lock(mutex_);
1679 auto itor = utCommandMap_.find(index);
1680 if (itor == utCommandMap_.end()) {
1681 TELEPHONY_LOGE("[slot%{public}d] the index in utCommandMap_ haven't been found", slotId_);
1682 return TELEPHONY_ERROR;
1683 }
1684
1685 ss.cfAction = itor->second->cfAction;
1686 ss.cfReason = itor->second->cfReason;
1687 ss.number = itor->second->number;
1688 ss.enable = itor->second->enable;
1689 ss.clirAction = itor->second->clirAction;
1690 ss.facility = itor->second->facility;
1691 if (strcpy_s(ss.password, sizeof(ss.password), itor->second->password) != EOK) {
1692 TELEPHONY_LOGE("password strcpy_s fail.");
1693 return TELEPHONY_ERR_STRCPY_FAIL;
1694 }
1695 ss.classType = itor->second->classType;
1696 ss.action = itor->second->action;
1697 ss.flag = itor->second->flag;
1698 return TELEPHONY_SUCCESS;
1699 }
1700
CloseUnFinishedUssdResponse(const AppExecFwk::InnerEvent::Pointer & event)1701 void CellularCallHandler::CloseUnFinishedUssdResponse(const AppExecFwk::InnerEvent::Pointer &event)
1702 {
1703 auto result = event->GetSharedObject<RadioResponseInfo>();
1704 if (result == nullptr) {
1705 TELEPHONY_LOGE("[slot%{public}d] result is null", slotId_);
1706 return;
1707 }
1708 CellularCallSupplement supplement;
1709 supplement.EventCloseUnFinishedUssd(*result);
1710 }
1711
OnRilAdapterHostDied(const AppExecFwk::InnerEvent::Pointer & event)1712 void CellularCallHandler::OnRilAdapterHostDied(const AppExecFwk::InnerEvent::Pointer &event)
1713 {
1714 auto serviceInstance = DelayedSingleton<CellularCallService>::GetInstance();
1715 if (serviceInstance == nullptr) {
1716 TELEPHONY_LOGE("[slot%{public}d] serviceInstance is null", slotId_);
1717 return;
1718 }
1719 auto csControl = serviceInstance->GetCsControl(slotId_);
1720 if (csControl == nullptr) {
1721 TELEPHONY_LOGE("[slot%{public}d] cs_control is null", slotId_);
1722 } else if (csControl->ReportHangUpInfo(slotId_) != TELEPHONY_SUCCESS) {
1723 TELEPHONY_LOGE("[slot%{public}d] fail to disconnect cs calls", slotId_);
1724 } else {
1725 serviceInstance->SetCsControl(slotId_, nullptr);
1726 }
1727 auto imsControl = serviceInstance->GetImsControl(slotId_);
1728 if (imsControl == nullptr) {
1729 TELEPHONY_LOGE("[slot%{public}d] ims_control is null", slotId_);
1730 } else if (imsControl->ReportHangUpInfo(slotId_) != TELEPHONY_SUCCESS) {
1731 TELEPHONY_LOGE("[slot%{public}d] fail to disconnect ims calls", slotId_);
1732 } else {
1733 serviceInstance->SetImsControl(slotId_, nullptr);
1734 }
1735 auto satelliteControl = serviceInstance->GetSatelliteControl(slotId_);
1736 if (satelliteControl == nullptr) {
1737 TELEPHONY_LOGE("[slot%{public}d] satelliteControl is null", slotId_);
1738 } else if (satelliteControl->ReportHangUpInfo(slotId_) != TELEPHONY_SUCCESS) {
1739 TELEPHONY_LOGE("[slot%{public}d] fail to disconnect satellite calls", slotId_);
1740 } else {
1741 serviceInstance->SetSatelliteControl(slotId_, nullptr);
1742 }
1743 }
1744
1745 #ifdef CALL_MANAGER_AUTO_START_OPTIMIZE
StartCallManagerService()1746 void CellularCallHandler::StartCallManagerService()
1747 {
1748 auto serviceInstance = DelayedSingleton<CellularCallService>::GetInstance();
1749 if (serviceInstance == nullptr) {
1750 TELEPHONY_LOGE("[slot%{public}d] serviceInstance is null", slotId_);
1751 return;
1752 }
1753 serviceInstance->StartCallManagerService();
1754 }
1755
RadioStateChangeProcess(const AppExecFwk::InnerEvent::Pointer & event)1756 void CellularCallHandler::RadioStateChangeProcess(const AppExecFwk::InnerEvent::Pointer &event)
1757 {
1758 std::shared_ptr<Int32Parcel> object = event->GetSharedObject<Int32Parcel>();
1759 if (object == nullptr) {
1760 TELEPHONY_LOGE("[slot%{public}d] object is null", slotId_);
1761 return;
1762 }
1763 TELEPHONY_LOGI("[slot%{public}d] Radio changed with state: %{public}d", slotId_, object->data);
1764 if (object->data == CORE_SERVICE_POWER_ON) {
1765 StartCallManagerService();
1766 }
1767 }
1768
GetRadioStateProcess(const AppExecFwk::InnerEvent::Pointer & event)1769 void CellularCallHandler::GetRadioStateProcess(const AppExecFwk::InnerEvent::Pointer &event)
1770 {
1771 auto object = event->GetUniqueObject<RadioStateInfo>();
1772 if (object == nullptr) {
1773 TELEPHONY_LOGE("object is null");
1774 return;
1775 }
1776 TELEPHONY_LOGI("GetRadioStateProcess [slot%{public}d], state=%{public}d", slotId_, object->state);
1777 if (object->state == CORE_SERVICE_POWER_ON) {
1778 StartCallManagerService();
1779 }
1780 }
1781 #endif
1782
NvCfgFinishedIndication(const AppExecFwk::InnerEvent::Pointer & event)1783 void CellularCallHandler::NvCfgFinishedIndication(const AppExecFwk::InnerEvent::Pointer &event)
1784 {
1785 CellularCallConfig config;
1786 ModuleServiceUtils obtain;
1787 std::vector<int32_t> slotVector = obtain.GetSlotInfo();
1788 for (const auto &it : slotVector) {
1789 config.UpdateImsCapabilities(it, true);
1790 }
1791 }
1792 } // namespace Telephony
1793 } // namespace OHOS
1794