• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2021 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 "icc_file.h"
17 #include "if_system_ability_manager.h"
18 #include "inner_event.h"
19 #include "iservice_registry.h"
20 #include "system_ability_definition.h"
21 #include "telephony_state_registry_client.h"
22 #include "radio_event.h"
23 
24 using namespace std;
25 using namespace OHOS::AppExecFwk;
26 using namespace OHOS::EventFwk;
27 
28 namespace OHOS {
29 namespace Telephony {
30 std::unique_ptr<ObserverHandler> IccFile::filesFetchedObser_ = nullptr;
IccFile(const std::shared_ptr<AppExecFwk::EventRunner> & runner,std::shared_ptr<SimStateManager> simStateManager)31 IccFile::IccFile(
32     const std::shared_ptr<AppExecFwk::EventRunner> &runner, std::shared_ptr<SimStateManager> simStateManager)
33     : AppExecFwk::EventHandler(runner), stateManager_(simStateManager)
34 {
35     if (stateManager_ == nullptr) {
36         TELEPHONY_LOGE("IccFile::IccFile set NULL SIMStateManager!!");
37     }
38     if (filesFetchedObser_ == nullptr) {
39         filesFetchedObser_ = std::make_unique<ObserverHandler>();
40     }
41     if (filesFetchedObser_ == nullptr) {
42         TELEPHONY_LOGE("IccFile::IccFile filesFetchedObser_ create nullptr.");
43         return;
44     }
45 
46     lockedFilesFetchedObser_ = std::make_unique<ObserverHandler>();
47     if (lockedFilesFetchedObser_ == nullptr) {
48         TELEPHONY_LOGE("IccFile::IccFile lockedFilesFetchedObser_ create nullptr.");
49         return;
50     }
51     networkLockedFilesFetchedObser_ = std::make_unique<ObserverHandler>();
52     if (networkLockedFilesFetchedObser_ == nullptr) {
53         TELEPHONY_LOGE("IccFile::IccFile networkLockedFilesFetchedObser_ create nullptr.");
54         return;
55     }
56     imsiReadyObser_ = std::make_unique<ObserverHandler>();
57     if (imsiReadyObser_ == nullptr) {
58         TELEPHONY_LOGE("IccFile::IccFile imsiReadyObser_ create nullptr.");
59         return;
60     }
61     recordsEventsObser_ = std::make_unique<ObserverHandler>();
62     if (recordsEventsObser_ == nullptr) {
63         TELEPHONY_LOGE("IccFile::IccFile recordsEventsObser_ create nullptr.");
64         return;
65     }
66     networkSelectionModeAutomaticObser_ = std::make_unique<ObserverHandler>();
67     if (networkSelectionModeAutomaticObser_ == nullptr) {
68         TELEPHONY_LOGE("IccFile::IccFile networkSelectionModeAutomaticObser_ create nullptr.");
69         return;
70     }
71     spnUpdatedObser_ = std::make_unique<ObserverHandler>();
72     if (spnUpdatedObser_ == nullptr) {
73         TELEPHONY_LOGE("IccFile::IccFile spnUpdatedObser_ create nullptr.");
74         return;
75     }
76     recordsOverrideObser_ = std::make_unique<ObserverHandler>();
77     if (recordsOverrideObser_ == nullptr) {
78         TELEPHONY_LOGE("IccFile::IccFile recordsOverrideObser_ create nullptr.");
79         return;
80     }
81     TELEPHONY_LOGI("simmgr IccFile::IccFile finish");
82 }
83 
Init()84 void IccFile::Init()
85 {
86     if (stateManager_ != nullptr) {
87         stateManager_->RegisterCoreNotify(shared_from_this(), RadioEvent::RADIO_SIM_STATE_READY);
88         stateManager_->RegisterCoreNotify(shared_from_this(), RadioEvent::RADIO_SIM_STATE_LOCKED);
89         stateManager_->RegisterCoreNotify(shared_from_this(), RadioEvent::RADIO_SIM_STATE_SIMLOCK);
90     }
91 }
92 
StartLoad()93 void IccFile::StartLoad()
94 {
95     TELEPHONY_LOGI("simmgr IccFile::StarLoad() start");
96 }
97 
ObtainIMSI()98 std::string IccFile::ObtainIMSI()
99 {
100     if (imsi_.empty()) {
101         TELEPHONY_LOGI("IccFile::ObtainIMSI  is null:");
102     }
103     return imsi_;
104 }
105 
UpdateImsi(std::string imsi)106 void IccFile::UpdateImsi(std::string imsi)
107 {
108     imsi_ = imsi;
109 }
110 
ObtainIccId()111 std::string IccFile::ObtainIccId()
112 {
113     return iccId_;
114 }
115 
ObtainGid1()116 std::string IccFile::ObtainGid1()
117 {
118     return gid1_;
119 }
120 
ObtainGid2()121 std::string IccFile::ObtainGid2()
122 {
123     return gid2_;
124 }
125 
ObtainMsisdnNumber()126 std::string IccFile::ObtainMsisdnNumber()
127 {
128     return msisdn_;
129 }
130 
LoadedOrNot()131 bool IccFile::LoadedOrNot()
132 {
133     return loaded_;
134 }
135 
UpdateLoaded(bool loaded)136 void IccFile::UpdateLoaded(bool loaded)
137 {
138     loaded_ = loaded;
139 }
140 
ObtainSimOperator()141 std::string IccFile::ObtainSimOperator()
142 {
143     return operatorNumeric_;
144 }
145 
ObtainIsoCountryCode()146 std::string IccFile::ObtainIsoCountryCode()
147 {
148     return "";
149 }
150 
ObtainCallForwardStatus()151 int IccFile::ObtainCallForwardStatus()
152 {
153     return ICC_CALL_FORWARD_TYPE_UNKNOWN;
154 }
155 
UpdateMsisdnNumber(const std::string & alphaTag,const std::string & number,const AppExecFwk::InnerEvent::Pointer & onComplete)156 void IccFile::UpdateMsisdnNumber(
157     const std::string &alphaTag, const std::string &number, const AppExecFwk::InnerEvent::Pointer &onComplete)
158 {}
159 
ObtainFilesFetched()160 bool IccFile::ObtainFilesFetched()
161 {
162     return (fileToGet_ == 0) && fileQueried_;
163 }
164 
LockQueriedOrNot()165 bool IccFile::LockQueriedOrNot()
166 {
167     return (fileToGet_ == 0) && lockQueried_;
168 }
169 
ObtainDiallingNumberInfo()170 std::string IccFile::ObtainDiallingNumberInfo()
171 {
172     return "";
173 }
174 
ObtainNAI()175 std::string IccFile::ObtainNAI()
176 {
177     return "";
178 }
179 
ObtainHomeNameOfPnn()180 std::string IccFile::ObtainHomeNameOfPnn()
181 {
182     return pnnHomeName_;
183 }
184 
ObtainMsisdnAlphaStatus()185 std::string IccFile::ObtainMsisdnAlphaStatus()
186 {
187     return msisdnTag_;
188 }
189 
ObtainVoiceMailNumber()190 std::string IccFile::ObtainVoiceMailNumber()
191 {
192     return voiceMailNum_;
193 }
194 
ObtainSPN()195 std::string IccFile::ObtainSPN()
196 {
197     return spn_;
198 }
199 
ObtainEons(const std::string & plmn,int32_t lac,bool longNameRequired)200 std::string IccFile::ObtainEons(const std::string &plmn, int32_t lac, bool longNameRequired)
201 {
202     bool roaming = (plmn.compare(operatorNumeric_) == 0 ? false : true);
203     TELEPHONY_LOGI("ObtainEons roaming:%{public}d", roaming);
204     if (plmn.empty() || pnnFiles_.empty() || (oplFiles_.empty() && roaming)) {
205         TELEPHONY_LOGE("ObtainEons is empty");
206         return "";
207     }
208     int pnnIndex = 1;
209     for (std::shared_ptr<OperatorPlmnInfo> opl : oplFiles_) {
210         if (opl == nullptr) {
211             continue;
212         }
213         pnnIndex = -1;
214         TELEPHONY_LOGI(
215             "ObtainEons plmn:%{public}s, opl->plmnNumeric:%{public}s, lac:%{public}d, "
216             "opl->lacStart:%{public}d, opl->lacEnd:%{public}d, opl->pnnRecordId:%{public}d",
217             plmn.c_str(), opl->plmnNumeric.c_str(), lac, opl->lacStart, opl->lacEnd, opl->pnnRecordId);
218         if (plmn.compare(opl->plmnNumeric) == 0 &&
219             ((opl->lacStart == 0 && opl->lacEnd == 0xfffe) || (opl->lacStart <= lac && opl->lacEnd >= lac))) {
220             pnnIndex = opl->pnnRecordId;
221             break;
222         }
223     }
224     std::string eons = "";
225     if (pnnIndex >= 1 && pnnIndex <= static_cast<int>(pnnFiles_.size())) {
226         TELEPHONY_LOGI("ObtainEons longNameRequired:%{public}d, longName:%{public}s, shortName:%{public}s,",
227             longNameRequired, pnnFiles_.at(pnnIndex - 1)->longName.c_str(),
228             pnnFiles_.at(pnnIndex - 1)->shortName.c_str());
229         if (longNameRequired) {
230             eons = pnnFiles_.at(pnnIndex - 1)->longName;
231         } else {
232             eons = pnnFiles_.at(pnnIndex - 1)->shortName;
233         }
234     }
235     return eons;
236 }
237 
ObtainVoiceMailInfo()238 std::string IccFile::ObtainVoiceMailInfo()
239 {
240     return voiceMailTag_;
241 }
242 
ObtainIccLanguage()243 std::string IccFile::ObtainIccLanguage()
244 {
245     return iccLanguage_;
246 }
247 
ObtainUsimFunctionHandle()248 std::shared_ptr<UsimFunctionHandle> IccFile::ObtainUsimFunctionHandle()
249 {
250     return std::make_shared<UsimFunctionHandle>(nullptr, 0);
251 }
252 
ObtainSpNameFromEfSpn()253 std::string IccFile::ObtainSpNameFromEfSpn()
254 {
255     return "";
256 }
257 
ObtainLengthOfMnc()258 int IccFile::ObtainLengthOfMnc()
259 {
260     return lengthOfMnc_;
261 }
262 
ProcessEvent(const AppExecFwk::InnerEvent::Pointer & event)263 void IccFile::ProcessEvent(const AppExecFwk::InnerEvent::Pointer &event)
264 {
265     if (event == nullptr) {
266         TELEPHONY_LOGE("event is nullptr!");
267         return;
268     }
269     auto id = event->GetInnerEventId();
270     bool result = false;
271     TELEPHONY_LOGI("IccFile::ProcessEvent id %{public}d", id);
272     switch (id) {
273         case MSG_SIM_OBTAIN_ICC_FILE_DONE:
274             result = ProcessIccFileObtained(event);
275             ProcessFileLoaded(result);
276             break;
277         case MSG_ICC_REFRESH:
278             ProcessIccRefresh(MSG_ID_DEFAULT);
279             break;
280         default:
281             break;
282     }
283 }
284 
RegisterImsiLoaded(std::shared_ptr<AppExecFwk::EventHandler> eventHandler)285 void IccFile::RegisterImsiLoaded(std::shared_ptr<AppExecFwk::EventHandler> eventHandler)
286 {
287     int eventCode = RadioEvent::RADIO_IMSI_LOADED_READY;
288     if (imsiReadyObser_ != nullptr) {
289         imsiReadyObser_->RegObserver(eventCode, eventHandler);
290     }
291     if (!ObtainIMSI().empty()) {
292         if (eventHandler != nullptr) {
293             eventHandler->SendEvent(RadioEvent::RADIO_IMSI_LOADED_READY);
294         }
295     }
296 }
297 
UnregisterImsiLoaded(const std::shared_ptr<AppExecFwk::EventHandler> & handler)298 void IccFile::UnregisterImsiLoaded(const std::shared_ptr<AppExecFwk::EventHandler> &handler)
299 {
300     if (imsiReadyObser_ != nullptr) {
301         imsiReadyObser_->Remove(RadioEvent::RADIO_IMSI_LOADED_READY, handler);
302     }
303 }
304 
RegisterAllFilesLoaded(std::shared_ptr<AppExecFwk::EventHandler> eventHandler)305 void IccFile::RegisterAllFilesLoaded(std::shared_ptr<AppExecFwk::EventHandler> eventHandler)
306 {
307     int eventCode = RadioEvent::RADIO_SIM_RECORDS_LOADED;
308     if (filesFetchedObser_ != nullptr) {
309         filesFetchedObser_->RegObserver(eventCode, eventHandler);
310     }
311     TELEPHONY_LOGI("IccFile::RegisterAllFilesLoaded: registerd");
312     if (ObtainFilesFetched()) {
313         TELEPHONY_LOGI("IccFile::RegisterAllFilesLoaded: notify");
314         if (eventHandler != nullptr) {
315             eventHandler->SendEvent(RadioEvent::RADIO_SIM_RECORDS_LOADED, slotId_);
316         }
317         PublishSimFileEvent(EventFwk::CommonEventSupport::COMMON_EVENT_SIM_STATE_CHANGED,
318             static_cast<int32_t>(SimState::SIM_STATE_LOADED), "");
319     }
320 }
321 
UnregisterAllFilesLoaded(const std::shared_ptr<AppExecFwk::EventHandler> & handler)322 void IccFile::UnregisterAllFilesLoaded(const std::shared_ptr<AppExecFwk::EventHandler> &handler)
323 {
324     if (filesFetchedObser_ != nullptr) {
325         filesFetchedObser_->Remove(RadioEvent::RADIO_SIM_RECORDS_LOADED, handler);
326     }
327 }
328 
RegisterCoreNotify(const std::shared_ptr<AppExecFwk::EventHandler> & handler,int what)329 void IccFile::RegisterCoreNotify(const std::shared_ptr<AppExecFwk::EventHandler> &handler, int what)
330 {
331     switch (what) {
332         case RadioEvent::RADIO_SIM_RECORDS_LOADED:
333             RegisterAllFilesLoaded(handler);
334             break;
335         case RadioEvent::RADIO_IMSI_LOADED_READY:
336             RegisterImsiLoaded(handler);
337             break;
338         default:
339             TELEPHONY_LOGI("RegisterCoreNotify default");
340     }
341 }
342 
UnRegisterCoreNotify(const std::shared_ptr<AppExecFwk::EventHandler> & handler,int what)343 void IccFile::UnRegisterCoreNotify(const std::shared_ptr<AppExecFwk::EventHandler> &handler, int what)
344 {
345     switch (what) {
346         case RadioEvent::RADIO_SIM_RECORDS_LOADED:
347             UnregisterAllFilesLoaded(handler);
348             break;
349         case RadioEvent::RADIO_IMSI_LOADED_READY:
350             UnregisterImsiLoaded(handler);
351             break;
352         default:
353             TELEPHONY_LOGI("RegisterCoreNotify default");
354     }
355 }
356 
UpdateSPN(const std::string spn)357 void IccFile::UpdateSPN(const std::string spn)
358 {
359     if (spn_ != spn) {
360         spnUpdatedObser_->NotifyObserver(MSG_SIM_SPN_UPDATED);
361         spn_ = spn;
362     }
363 }
364 
BuildCallerInfo(int eventId)365 AppExecFwk::InnerEvent::Pointer IccFile::BuildCallerInfo(int eventId)
366 {
367     std::unique_ptr<FileToControllerMsg> object = std::make_unique<FileToControllerMsg>();
368     int eventParam = 0;
369     AppExecFwk::InnerEvent::Pointer event = AppExecFwk::InnerEvent::Get(eventId, object, eventParam);
370     if (event == nullptr) {
371         TELEPHONY_LOGE("event is nullptr!");
372         return AppExecFwk::InnerEvent::Pointer(nullptr, nullptr);
373     }
374     event->SetOwner(shared_from_this());
375     return event;
376 }
377 
BuildCallerInfo(int eventId,int arg1,int arg2)378 AppExecFwk::InnerEvent::Pointer IccFile::BuildCallerInfo(int eventId, int arg1, int arg2)
379 {
380     std::unique_ptr<FileToControllerMsg> object = std::make_unique<FileToControllerMsg>();
381     object->arg1 = arg1;
382     object->arg2 = arg2;
383     int eventParam = 0;
384     AppExecFwk::InnerEvent::Pointer event = AppExecFwk::InnerEvent::Get(eventId, object, eventParam);
385     if (event == nullptr) {
386         TELEPHONY_LOGE("event is nullptr!");
387         return AppExecFwk::InnerEvent::Pointer(nullptr, nullptr);
388     }
389     event->SetOwner(shared_from_this());
390     return event;
391 }
392 
BuildCallerInfo(int eventId,std::shared_ptr<void> loader)393 AppExecFwk::InnerEvent::Pointer IccFile::BuildCallerInfo(int eventId, std::shared_ptr<void> loader)
394 {
395     std::unique_ptr<FileToControllerMsg> object = std::make_unique<FileToControllerMsg>();
396     object->iccLoader = loader;
397     int eventParam = 0;
398     AppExecFwk::InnerEvent::Pointer event = AppExecFwk::InnerEvent::Get(eventId, object, eventParam);
399     if (event == nullptr) {
400         TELEPHONY_LOGE("event is nullptr!");
401         return AppExecFwk::InnerEvent::Pointer(nullptr, nullptr);
402     }
403     event->SetOwner(shared_from_this());
404     return event;
405 }
406 
PublishSimFileEvent(const std::string & event,int eventCode,const std::string & eventData)407 bool IccFile::PublishSimFileEvent(const std::string &event, int eventCode, const std::string &eventData)
408 {
409     Want want;
410     want.SetAction(event);
411     CommonEventData data;
412     data.SetWant(want);
413     data.SetCode(eventCode);
414     data.SetData(eventData);
415     CommonEventPublishInfo publishInfo;
416     publishInfo.SetOrdered(true);
417     bool publishResult = CommonEventManager::PublishCommonEvent(data, publishInfo, nullptr);
418     TELEPHONY_LOGI("IccFile::PublishSimEvent result : %{public}d", publishResult);
419     return publishResult;
420 }
421 
ProcessIccFileObtained(const AppExecFwk::InnerEvent::Pointer & event)422 bool IccFile::ProcessIccFileObtained(const AppExecFwk::InnerEvent::Pointer &event)
423 {
424     bool isFileProcessResponse = true;
425     std::shared_ptr<ControllerToFileMsg> fd = event->GetSharedObject<ControllerToFileMsg>();
426     std::shared_ptr<void> baseLoad = fd->iccLoader;
427     if (baseLoad != nullptr) {
428         std::shared_ptr<IccFileLoaded> destLoad = std::static_pointer_cast<IccFileLoaded>(baseLoad);
429         destLoad->ProcessParseFile(event);
430         TELEPHONY_LOGI("ProcessIccFileObtained item %{public}s", destLoad->ObtainElementaryFileName().c_str());
431     } else {
432         isFileProcessResponse = false;
433         TELEPHONY_LOGE("IccFile::ProcessIccFileObtained null base ponter");
434     }
435     return isFileProcessResponse;
436 }
437 
UpdateIccLanguage(const std::string & langLi,const std::string & langPl)438 void IccFile::UpdateIccLanguage(const std::string &langLi, const std::string &langPl)
439 {
440     iccLanguage_ = ObtainValidLanguage(langLi);
441     if (iccLanguage_.empty()) {
442         iccLanguage_ = ObtainValidLanguage(langPl);
443     }
444     TELEPHONY_LOGI("IccFile::UpdateIccLanguage end is %{public}s", iccLanguage_.c_str());
445 }
446 
ObtainValidLanguage(const std::string & langData)447 std::string IccFile::ObtainValidLanguage(const std::string &langData)
448 {
449     if (langData.empty()) {
450         TELEPHONY_LOGE("langData null data!!");
451         return "";
452     }
453     int langDataLen = 0;
454     std::shared_ptr<unsigned char> ucc = SIMUtils::HexStringConvertToBytes(langData, langDataLen);
455     unsigned char *data = ucc.get();
456 
457     std::string spnName((char *)data);
458     TELEPHONY_LOGI("ObtainValidLanguage all is %{public}s---%{public}d", spnName.c_str(), langDataLen);
459     std::string result = "";
460     for (int i = 0; (i + 1) < langDataLen; i += DATA_STEP) {
461         std::string langName((char *)data, i, DATA_STEP);
462         TELEPHONY_LOGI("ObtainValidLanguage item is %{public}d--%{public}s", i, langName.c_str());
463         if (!langName.empty()) {
464             result = langName;
465         }
466     }
467 
468     return result;
469 }
470 
~IccFile()471 IccFile::~IccFile() {}
472 
SetRilAndFileController(const std::shared_ptr<Telephony::ITelRilManager> & ril,const std::shared_ptr<IccFileController> & file,const std::shared_ptr<IccDiallingNumbersHandler> & handler)473 void IccFile::SetRilAndFileController(const std::shared_ptr<Telephony::ITelRilManager> &ril,
474     const std::shared_ptr<IccFileController> &file, const std::shared_ptr<IccDiallingNumbersHandler> &handler)
475 {
476     telRilManager_ = ril;
477     if (telRilManager_ == nullptr) {
478         TELEPHONY_LOGE("IccFile set NULL TelRilManager!!");
479     }
480 
481     fileController_ = file;
482     if (fileController_ == nullptr) {
483         TELEPHONY_LOGE("IccFile set NULL File Controller!!");
484     }
485     diallingNumberHandler_ = handler;
486     if (fileController_ == nullptr) {
487         TELEPHONY_LOGE("IccFile set NULL File Controller!!");
488     }
489 }
490 
CreateDiallingNumberPointer(int eventid,int efId,int index,std::shared_ptr<void> pobj)491 AppExecFwk::InnerEvent::Pointer IccFile::CreateDiallingNumberPointer(
492     int eventid, int efId, int index, std::shared_ptr<void> pobj)
493 {
494     std::unique_ptr<DiallingNumbersHandleHolder> holder = std::make_unique<DiallingNumbersHandleHolder>();
495     holder->fileID = efId;
496     holder->index = index;
497     holder->diallingNumber = pobj;
498     int eventParam = 0;
499     AppExecFwk::InnerEvent::Pointer event = AppExecFwk::InnerEvent::Get(eventid, holder, eventParam);
500     if (event == nullptr) {
501         TELEPHONY_LOGE("event is nullptr!");
502         return AppExecFwk::InnerEvent::Pointer(nullptr, nullptr);
503     }
504     event->SetOwner(shared_from_this());
505     return event;
506 }
507 
508 
NotifyRegistrySimState(CardType type,SimState state,LockReason reason)509 void IccFile::NotifyRegistrySimState(CardType type, SimState state, LockReason reason)
510 {
511     int32_t result =
512         DelayedRefSingleton<TelephonyStateRegistryClient>::GetInstance().UpdateSimState(slotId_, type, state, reason);
513     TELEPHONY_LOGI("NotifyRegistrySimState msgId is %{public}d ret %{public}d", state, result);
514 }
515 
HasSimCard()516 bool IccFile::HasSimCard()
517 {
518     return (stateManager_ != nullptr) ? stateManager_->HasSimCard() : false;
519 }
520 
ClearData()521 void IccFile::ClearData()
522 {
523     imsi_ = "";
524     iccId_ = "";
525     UpdateSPN("");
526     UpdateLoaded(false);
527     operatorNumeric_ = "";
528     voiceMailNum_ = "";
529     voiceMailTag_ = "";
530     indexOfMailbox_ = 1;
531     msisdn_ = "";
532     gid1_ = "";
533     gid2_ = "";
534     msisdnTag_ = "";
535     fileQueried_ = false;
536 }
UnInit()537 void IccFile::UnInit()
538 {
539     if (stateManager_ != nullptr) {
540         stateManager_->UnRegisterCoreNotify(shared_from_this(), RadioEvent::RADIO_SIM_STATE_READY);
541         stateManager_->UnRegisterCoreNotify(shared_from_this(), RadioEvent::RADIO_SIM_STATE_LOCKED);
542         stateManager_->UnRegisterCoreNotify(shared_from_this(), RadioEvent::RADIO_SIM_STATE_SIMLOCK);
543     }
544     ClearData();
545 }
546 
SaveCountryCode()547 void IccFile::SaveCountryCode()
548 {
549     std::string countryCode = ObtainIsoCountryCode();
550     std::string key = COUNTRY_CODE_KEY + std::to_string(slotId_);
551     SetParameter(key.c_str(), countryCode.c_str());
552 }
553 } // namespace Telephony
554 } // namespace OHOS
555