• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2021-2022 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 #include "radio_protocol_controller.h"
16 
17 #include "radio_event.h"
18 #include "telephony_log_wrapper.h"
19 
20 namespace OHOS {
21 namespace Telephony {
22 static const int64_t COMMUNICATION_TIMEOUT = 45 * 1000; // Set the timeout millisecond for radio protocol communication
23 static const int64_t SET_ACTIVE_OUT_TIME = 10 * 1000;
24 ffrt::mutex RadioProtocolController::ctx_;
25 ffrt::condition_variable RadioProtocolController::cv_;
26 
RadioProtocolController(std::weak_ptr<Telephony::ITelRilManager> telRilManager)27 RadioProtocolController::RadioProtocolController(std::weak_ptr<Telephony::ITelRilManager> telRilManager)
28     : TelEventHandler("RadioProtocolController"), telRilManager_(telRilManager)
29 {}
30 
Init()31 void RadioProtocolController::Init()
32 {
33     auto telRilManager = telRilManager_.lock();
34     if (telRilManager == nullptr) {
35         TELEPHONY_LOGE("telRilManager is nullptr");
36         return;
37     }
38 
39     slotCount_ = SIM_SLOT_COUNT;
40     InitMemberFunc();
41     // make sure communication is in the initial state
42     CleanUpCommunication();
43     std::unique_lock<ffrt::mutex> radioProtocolLock(radioProtocolMutex_);
44     for (int32_t i = 0; i < slotCount_; i++) {
45         RadioProtocol protocol;
46         protocol.slotId = i;
47         protocol.sessionId = 0;
48         protocol.phase = RadioProtocolPhase::RADIO_PROTOCOL_PHASE_INITIAL;
49         protocol.technology = 0xFFFFFFFF;
50         protocol.modemId = 0;
51         protocol.status = RadioProtocolStatus::RADIO_PROTOCOL_STATUS_NONE;
52         radioProtocol_.emplace_back(protocol);
53         telRilManager->RegisterCoreNotify(i, shared_from_this(), RADIO_SIM_RADIO_PROTOCOL_NOTIFY, nullptr);
54     }
55 }
56 
GetRadioProtocolTech(int32_t slotId)57 int32_t RadioProtocolController::GetRadioProtocolTech(int32_t slotId)
58 {
59     std::unique_lock<ffrt::mutex> radioProtocolLock(radioProtocolMutex_);
60     if (slotId < 0 || slotId >= static_cast<int32_t>(radioProtocol_.size())) {
61         return 0;
62     }
63     return static_cast<int32_t>(radioProtocol_[slotId].technology);
64 }
65 
GetRadioProtocolModemId(int32_t slotId)66 int32_t RadioProtocolController::GetRadioProtocolModemId(int32_t slotId)
67 {
68     std::unique_lock<ffrt::mutex> radioProtocolLock(radioProtocolMutex_);
69     if (slotId < 0 || slotId >= static_cast<int32_t>(radioProtocol_.size())) {
70         return 0;
71     }
72     return static_cast<int32_t>(radioProtocol_[slotId].modemId);
73 }
74 
GetRadioProtocol(int32_t slotId)75 void RadioProtocolController::GetRadioProtocol(int32_t slotId)
76 {
77     auto telRilManager = telRilManager_.lock();
78     if (telRilManager == nullptr) {
79         TELEPHONY_LOGE("telRilManager is nullptr");
80         return;
81     }
82     AppExecFwk::InnerEvent::Pointer event = AppExecFwk::InnerEvent::Get(RADIO_SIM_GET_RADIO_PROTOCOL);
83     if (event == nullptr) {
84         TELEPHONY_LOGE("event is nullptr");
85         return;
86     }
87     event->SetOwner(shared_from_this());
88     telRilManager->GetRadioProtocol(slotId, event);
89 }
90 
SetRadioProtocol(int32_t slotId)91 bool RadioProtocolController::SetRadioProtocol(int32_t slotId)
92 {
93     std::unique_lock<ffrt::mutex> radioProtocolLock(radioProtocolMutex_);
94     if (isCommunicating_) {
95         TELEPHONY_LOGE("protocol is communicating, can not set now");
96         return false;
97     }
98 
99     communicationResponseResult_ = false;
100     CleanUpCommunication();
101     ExecuteCheckCommunication();
102     while (isCommunicating_) {
103         TELEPHONY_LOGI("wait for the communication to finish");
104         radioProtocolCv_.wait(radioProtocolLock);
105     }
106     return communicationResponseResult_;
107 }
108 
InitMemberFunc()109 void RadioProtocolController::InitMemberFunc()
110 {
111     memberFuncMap_[MSG_SIM_TIME_OUT_ACTIVE] =
112         [this](const AppExecFwk::InnerEvent::Pointer &event) { ProcessActiveSimTimeOutDone(event); };
113     memberFuncMap_[MSG_SIM_SET_ACTIVE] =
114         [this](const AppExecFwk::InnerEvent::Pointer &event) { ProcessActiveSimToRilResponse(event); };
115     memberFuncMap_[RADIO_SIM_GET_RADIO_PROTOCOL] =
116         [this](const AppExecFwk::InnerEvent::Pointer &event) { ProcessGetRadioProtocol(event); };
117     memberFuncMap_[RADIO_SIM_CHECK_RADIO_PROTOCOL] =
118         [this](const AppExecFwk::InnerEvent::Pointer &event) { ProcessCheckRadioProtocol(event); };
119     memberFuncMap_[RADIO_SIM_UPDATE_RADIO_PROTOCOL] =
120         [this](const AppExecFwk::InnerEvent::Pointer &event) { ProcessUpdateRadioProtocol(event); };
121     memberFuncMap_[RADIO_SIM_RADIO_PROTOCOL_NOTIFY] =
122         [this](const AppExecFwk::InnerEvent::Pointer &event) { ProcessRadioProtocolNotify(event); };
123     memberFuncMap_[RADIO_SIM_SET_RADIO_PROTOCOL_COMPLETE] =
124         [this](const AppExecFwk::InnerEvent::Pointer &event) { ProcessSetRadioProtocolComplete(event); };
125     memberFuncMap_[RADIO_SIM_SET_RADIO_PROTOCOL_TIMEOUT] =
126         [this](const AppExecFwk::InnerEvent::Pointer &event) { ProcessSetRadioProtocolTimeout(event); };
127 }
128 
ProcessEvent(const AppExecFwk::InnerEvent::Pointer & event)129 void RadioProtocolController::ProcessEvent(const AppExecFwk::InnerEvent::Pointer &event)
130 {
131     if (event == nullptr) {
132         TELEPHONY_LOGE("event is nullptr");
133         return;
134     }
135     auto id = event->GetInnerEventId();
136     TELEPHONY_LOGD("id = %{public}d", id);
137     auto itFunc = memberFuncMap_.find(id);
138     if (itFunc != memberFuncMap_.end()) {
139         auto memberFunc = itFunc->second;
140         if (memberFunc == nullptr) {
141             TELEPHONY_LOGE("memberFunc is nullptr");
142             return;
143         }
144         memberFunc(event);
145     }
146 }
147 
ProcessGetRadioProtocol(const AppExecFwk::InnerEvent::Pointer & event)148 void RadioProtocolController::ProcessGetRadioProtocol(const AppExecFwk::InnerEvent::Pointer &event)
149 {
150     if (event == nullptr) {
151         TELEPHONY_LOGE("event is nullptr");
152         return;
153     }
154     std::shared_ptr<RadioProtocol> radioProtocol = event->GetSharedObject<RadioProtocol>();
155     if (radioProtocol == nullptr) {
156         TELEPHONY_LOGE("radioProtocol is nullptr");
157         return;
158     }
159     UpdateRadioProtocol(radioProtocol);
160 }
161 
ProcessCheckRadioProtocol(const AppExecFwk::InnerEvent::Pointer & event)162 void RadioProtocolController::ProcessCheckRadioProtocol(const AppExecFwk::InnerEvent::Pointer &event)
163 {
164     if (!ProcessResponseInfoOfEvent(event)) {
165         TELEPHONY_LOGE("failed due to invalid sessionId");
166         return;
167     }
168 
169     if (--communicatingSlotCount_ != 0) {
170         TELEPHONY_LOGI("wait for all sim to complete check");
171         return;
172     }
173 
174     if (communicationFailed_) {
175         ExecuteCompleteCommunication();
176     } else {
177         ExecuteUpdateCommunication();
178     }
179 }
180 
ProcessUpdateRadioProtocol(const AppExecFwk::InnerEvent::Pointer & event)181 void RadioProtocolController::ProcessUpdateRadioProtocol(const AppExecFwk::InnerEvent::Pointer &event)
182 {
183     if (!ProcessResponseInfoOfEvent(event)) {
184         TELEPHONY_LOGE("failed due to invalid sessionId");
185         return;
186     }
187 }
188 
ProcessRadioProtocolNotify(const AppExecFwk::InnerEvent::Pointer & event)189 void RadioProtocolController::ProcessRadioProtocolNotify(const AppExecFwk::InnerEvent::Pointer &event)
190 {
191     if (event == nullptr) {
192         TELEPHONY_LOGE("event is nullptr");
193         return;
194     }
195     std::shared_ptr<RadioProtocol> radioProtocol = event->GetSharedObject<RadioProtocol>();
196     if (radioProtocol == nullptr || radioProtocol->sessionId != sessionId_) {
197         TELEPHONY_LOGE("failed due to invalid sessionId");
198         return;
199     }
200 
201     if (radioProtocol->status == RadioProtocolStatus::RADIO_PROTOCOL_STATUS_FAIL) {
202         TELEPHONY_LOGE("update failed");
203         communicationFailed_ = true;
204     } else {
205         UpdateRadioProtocol(radioProtocol);
206     }
207     if (--communicatingSlotCount_ != 0) {
208         TELEPHONY_LOGI("wait for all sim to complete update");
209         return;
210     }
211 
212     ExecuteCompleteCommunication();
213 }
214 
ProcessSetRadioProtocolComplete(const AppExecFwk::InnerEvent::Pointer & event)215 void RadioProtocolController::ProcessSetRadioProtocolComplete(const AppExecFwk::InnerEvent::Pointer &event)
216 {
217     if (event == nullptr) {
218         TELEPHONY_LOGE("event is nullptr");
219         return;
220     }
221     if (!ProcessResponseInfoOfEvent(event)) {
222         TELEPHONY_LOGE("failed due to invalid sessionId");
223         return;
224     }
225 
226     if (--communicatingSlotCount_ != 0) {
227         TELEPHONY_LOGI("wait for all sim to complete");
228         return;
229     }
230 
231     ProcessCommunicationResponse(!communicationFailed_);
232     CleanUpCommunication();
233 }
234 
ProcessSetRadioProtocolTimeout(const AppExecFwk::InnerEvent::Pointer & event)235 void RadioProtocolController::ProcessSetRadioProtocolTimeout(const AppExecFwk::InnerEvent::Pointer &event)
236 {
237     TELEPHONY_LOGI("ProcessSetRadioProtocolTimeout");
238     if (event == nullptr) {
239         TELEPHONY_LOGE("event is nullptr");
240         return;
241     }
242     auto sessionId = event->GetParam();
243     if (sessionId != sessionId_) {
244         TELEPHONY_LOGE("failed due to invalid sessionId");
245         return;
246     }
247     ProcessCommunicationResponse(false);
248     CleanUpCommunication();
249     sessionId_++;
250     communicatingSlotCount_ = 0;
251     communicationFailed_ = true;
252     ExecuteCompleteCommunication();
253 }
254 
ExecuteCheckCommunication()255 void RadioProtocolController::ExecuteCheckCommunication()
256 {
257     TELEPHONY_LOGI("ExecuteCheckCommunication");
258     sessionId_++;
259     isCommunicating_ = true;
260     SendEvent(RADIO_SIM_SET_RADIO_PROTOCOL_TIMEOUT, sessionId_, COMMUNICATION_TIMEOUT);
261     BuildRadioProtocolForCommunication(RadioProtocolPhase::RADIO_PROTOCOL_PHASE_CHECK,
262         RadioProtocolStatus::RADIO_PROTOCOL_STATUS_NONE);
263     ResetNextCommunicationSlotCount();
264     SendRadioProtocolEvent(oldRadioProtocol_, RADIO_SIM_CHECK_RADIO_PROTOCOL);
265 }
266 
ExecuteUpdateCommunication()267 void RadioProtocolController::ExecuteUpdateCommunication()
268 {
269     std::unique_lock<ffrt::mutex> radioProtocolLock(radioProtocolMutex_);
270     BuildRadioProtocolForCommunication(RadioProtocolPhase::RADIO_PROTOCOL_PHASE_UPDATE,
271         RadioProtocolStatus::RADIO_PROTOCOL_STATUS_NONE);
272     ResetNextCommunicationSlotCount();
273     SendRadioProtocolEvent(newRadioProtocol_, RADIO_SIM_UPDATE_RADIO_PROTOCOL);
274 }
275 
ExecuteCompleteCommunication()276 void RadioProtocolController::ExecuteCompleteCommunication()
277 {
278     std::unique_lock<ffrt::mutex> radioProtocolLock(radioProtocolMutex_);
279     TELEPHONY_LOGI("failed:%{public}d", communicationFailed_);
280     BuildRadioProtocolForCommunication(RadioProtocolPhase::RADIO_PROTOCOL_PHASE_COMPLETE,
281         communicationFailed_ ? RadioProtocolStatus::RADIO_PROTOCOL_STATUS_FAIL :
282         RadioProtocolStatus::RADIO_PROTOCOL_STATUS_SUCCESS);
283     ResetNextCommunicationSlotCount();
284     SendRadioProtocolEvent(communicationFailed_ ? oldRadioProtocol_ : newRadioProtocol_,
285         RADIO_SIM_SET_RADIO_PROTOCOL_COMPLETE);
286 }
287 
ResetNextCommunicationSlotCount()288 void RadioProtocolController::ResetNextCommunicationSlotCount()
289 {
290     communicatingSlotCount_ = slotCount_;
291 }
292 
BuildRadioProtocolForCommunication(RadioProtocolPhase phase,RadioProtocolStatus status)293 void RadioProtocolController::BuildRadioProtocolForCommunication(RadioProtocolPhase phase, RadioProtocolStatus status)
294 {
295     switch (phase) {
296         case RadioProtocolPhase::RADIO_PROTOCOL_PHASE_CHECK: {
297             if (slotCount_ > static_cast<int32_t>(radioProtocol_.size()) || slotCount_ < 0) {
298                 TELEPHONY_LOGE("error, size = %{public}zu, slotCount_ = %{public}d", radioProtocol_.size(), slotCount_);
299                 break;
300             }
301             for (int32_t i = 0; i < slotCount_; i++) {
302                 RadioProtocol radioProtocol;
303                 radioProtocol.slotId = i;
304                 radioProtocol.sessionId = sessionId_;
305                 radioProtocol.phase = phase;
306                 radioProtocol.technology = radioProtocol_[i].technology;
307                 radioProtocol.modemId = radioProtocol_[i].modemId;
308                 radioProtocol.status = status;
309                 oldRadioProtocol_.emplace_back(radioProtocol);
310                 newRadioProtocol_.emplace_back(radioProtocol);
311             }
312             // Switch the tech and modemId of main and non-main card
313             for (int32_t i = 0; i < slotCount_; i++) {
314                 newRadioProtocol_[i].technology = radioProtocol_[slotCount_ - 1 - i].technology;
315                 newRadioProtocol_[i].modemId = radioProtocol_[slotCount_ - 1 - i].modemId;
316             }
317             break;
318         }
319         case RadioProtocolPhase::RADIO_PROTOCOL_PHASE_UPDATE:
320         case RadioProtocolPhase::RADIO_PROTOCOL_PHASE_NOTIFY:
321         case RadioProtocolPhase::RADIO_PROTOCOL_PHASE_COMPLETE: {
322             if (slotCount_ < 0 || static_cast<int32_t>(oldRadioProtocol_.size()) < slotCount_ ||
323                 static_cast<int32_t>(newRadioProtocol_.size()) < slotCount_) {
324                 TELEPHONY_LOGE("error, old size = %{public}zu, new size = %{public}zu, slotCount_ = %{public}d",
325                     oldRadioProtocol_.size(), newRadioProtocol_.size(), slotCount_);
326                 break;
327             }
328             for (int32_t i = 0; i < slotCount_; i++) {
329                 oldRadioProtocol_[i].sessionId = sessionId_;
330                 oldRadioProtocol_[i].phase = phase;
331                 oldRadioProtocol_[i].status = status;
332                 newRadioProtocol_[i].sessionId = sessionId_;
333                 newRadioProtocol_[i].phase = phase;
334                 newRadioProtocol_[i].status = status;
335             }
336             break;
337         }
338         default:
339             TELEPHONY_LOGE("BuildRadioProtocolForCommunication invalid phase");
340             break;
341     }
342 }
343 
SendRadioProtocolEvent(std::vector<RadioProtocol> radioProtocol,uint32_t eventId)344 void RadioProtocolController::SendRadioProtocolEvent(std::vector<RadioProtocol> radioProtocol, uint32_t eventId)
345 {
346     auto telRilManager = telRilManager_.lock();
347     if (telRilManager == nullptr || radioProtocol.empty()) {
348         TELEPHONY_LOGE("SendRadioProtocol telRilManager or radioProtocol is nullptr");
349         ProcessCommunicationResponse(false);
350         CleanUpCommunication();
351         return;
352     }
353     if (slotCount_ > static_cast<int32_t>(radioProtocol.size()) || slotCount_ < 0) {
354         TELEPHONY_LOGE("error, size = %{public}zu, slotCount_ = %{public}d", radioProtocol_.size(), slotCount_);
355         ProcessCommunicationResponse(false);
356         CleanUpCommunication();
357         return;
358     }
359     for (int32_t i = 0; i < slotCount_; i++) {
360         AppExecFwk::InnerEvent::Pointer event = AppExecFwk::InnerEvent::Get(eventId);
361         if (event == nullptr) {
362             TELEPHONY_LOGE("SendRadioProtocol event is nullptr");
363             ProcessCommunicationResponse(false);
364             CleanUpCommunication();
365             return;
366         }
367         event->SetOwner(shared_from_this());
368         telRilManager->SetRadioProtocol(i, radioProtocol[i], event);
369     }
370 }
371 
UpdateRadioProtocol(std::shared_ptr<RadioProtocol> radioProtocol)372 void RadioProtocolController::UpdateRadioProtocol(std::shared_ptr<RadioProtocol> radioProtocol)
373 {
374     std::unique_lock<ffrt::mutex> radioProtocolLock(radioProtocolMutex_);
375     int32_t slotId = radioProtocol->slotId;
376     if ((slotId >= DEFAULT_SIM_SLOT_ID) && (slotId < SIM_SLOT_COUNT)) {
377         radioProtocol_[slotId].sessionId = radioProtocol->sessionId;
378         radioProtocol_[slotId].phase = radioProtocol->phase;
379         radioProtocol_[slotId].technology = radioProtocol->technology;
380         radioProtocol_[slotId].modemId = radioProtocol->modemId;
381         radioProtocol_[slotId].status = radioProtocol->status;
382     }
383 }
384 
ProcessResponseInfoOfEvent(const AppExecFwk::InnerEvent::Pointer & event)385 bool RadioProtocolController::ProcessResponseInfoOfEvent(const AppExecFwk::InnerEvent::Pointer &event)
386 {
387     if (event == nullptr) {
388         TELEPHONY_LOGE("event is nullptr");
389         return false;
390     }
391     std::shared_ptr<RadioResponseInfo> responseInfo = event->GetSharedObject<RadioResponseInfo>();
392     if (responseInfo != nullptr && responseInfo->error != ErrType::NONE) {
393         TELEPHONY_LOGE("error:%{public}d", responseInfo->error);
394         communicationFailed_ = true;
395         return true;
396     }
397 
398     std::shared_ptr<RadioProtocol> radioProtocol = event->GetSharedObject<RadioProtocol>();
399     return radioProtocol != nullptr && radioProtocol->sessionId == sessionId_;
400 }
401 
CleanUpCommunication()402 void RadioProtocolController::CleanUpCommunication()
403 {
404     TELEPHONY_LOGI("CleanUpCommunication");
405     RemoveEvent(RADIO_SIM_SET_RADIO_PROTOCOL_TIMEOUT);
406     communicationFailed_ = false;
407     std::vector<RadioProtocol>().swap(oldRadioProtocol_);
408     std::vector<RadioProtocol>().swap(newRadioProtocol_);
409 }
410 
ProcessCommunicationResponse(bool result)411 void RadioProtocolController::ProcessCommunicationResponse(bool result)
412 {
413     communicationResponseResult_ = result;
414     isCommunicating_ = false;
415     radioProtocolCv_.notify_all();
416 }
417 
UnRegisterEvents()418 void RadioProtocolController::UnRegisterEvents()
419 {
420     auto telRilManager = telRilManager_.lock();
421     if (telRilManager == nullptr) {
422         TELEPHONY_LOGE("UnRegisterEvents telRilManager is nullptr");
423         return;
424     }
425     for (int32_t i = 0; i < slotCount_; i++) {
426         telRilManager->UnRegisterCoreNotify(i, shared_from_this(), RADIO_SIM_RADIO_PROTOCOL_NOTIFY);
427     }
428 }
429 
RadioProtocolControllerWait()430 void RadioProtocolController::RadioProtocolControllerWait()
431 {
432     responseReady_ = false;
433 }
434 
RadioProtocolControllerContinue()435 void RadioProtocolController::RadioProtocolControllerContinue()
436 {
437     std::unique_lock<ffrt::mutex> lck(ctx_);
438     responseReady_ = true;
439     cv_.notify_all();
440 }
441 
RadioProtocolControllerPoll()442 bool RadioProtocolController::RadioProtocolControllerPoll()
443 {
444     return responseReady_;
445 }
446 
ProcessActiveSimTimeOutDone(const AppExecFwk::InnerEvent::Pointer & event)447 void RadioProtocolController::ProcessActiveSimTimeOutDone(const AppExecFwk::InnerEvent::Pointer &event)
448 {
449     TELEPHONY_LOGI("ProcessActiveSimTimeOutDone");
450     RadioProtocolControllerContinue();
451 }
452 
SetActiveSimToRil(int32_t slotId,int32_t type,int32_t enable)453 bool RadioProtocolController::SetActiveSimToRil(int32_t slotId, int32_t type, int32_t enable)
454 {
455     TELEPHONY_LOGI("SetActiveSim(), enable=%{public}d", enable);
456     auto telRilManager = telRilManager_.lock();
457     if (telRilManager == nullptr) {
458         TELEPHONY_LOGE("SetActiveSim nullptr");
459         return false;
460     }
461     auto event = AppExecFwk::InnerEvent::Get(MSG_SIM_SET_ACTIVE);
462     if (event == nullptr) {
463         TELEPHONY_LOGE("event is nullptr!");
464         return false;
465     }
466     activeResponse_ = 1;
467     event->SetOwner(shared_from_this());
468     RemoveEvent(MSG_SIM_TIME_OUT_ACTIVE);
469     SendEvent(MSG_SIM_TIME_OUT_ACTIVE, SET_ACTIVE_OUT_TIME, Priority::LOW);
470     telRilManager->SetActiveSim(slotId, type, enable, event);
471     return true;
472 }
473 
ProcessActiveSimToRilResponse(const AppExecFwk::InnerEvent::Pointer & event)474 void RadioProtocolController::ProcessActiveSimToRilResponse(const AppExecFwk::InnerEvent::Pointer &event)
475 {
476     if (event == nullptr) {
477         TELEPHONY_LOGE("event is nullptr");
478         return;
479     }
480     TELEPHONY_LOGI("ProcessActiveSimToRilResponse");
481     int32_t result = 0;
482     std::shared_ptr<ErrType> param = event->GetSharedObject<ErrType>();
483     std::shared_ptr<RadioResponseInfo> response = event->GetSharedObject<RadioResponseInfo>();
484     if ((param == nullptr) && (response == nullptr)) {
485         TELEPHONY_LOGE("Get response fail");
486         RadioProtocolControllerContinue();
487         return;
488     }
489     if (param != nullptr) {
490         result = static_cast<int32_t>(*param);
491     } else {
492         result = static_cast<int32_t>(response->error);
493     }
494     TELEPHONY_LOGI("activeResponse = %{public}d", result);
495     activeResponse_ = result;
496     RadioProtocolControllerContinue();
497 }
498 
GetActiveSimToRilResult()499 int32_t RadioProtocolController::GetActiveSimToRilResult()
500 {
501     TELEPHONY_LOGI("Get active sim result");
502     RemoveEvent(MSG_SIM_TIME_OUT_ACTIVE);
503     return activeResponse_;
504 }
505 } // namespace Telephony
506 } // namespace OHOS
507