mirror of
https://gitee.com/openharmony/telephony_core_service
synced 2024-11-24 08:29:47 +00:00
commit
69169280ad
@ -38,7 +38,7 @@ namespace Telephony {
|
||||
class IccFile : public AppExecFwk::EventHandler {
|
||||
public:
|
||||
IccFile(const std::shared_ptr<AppExecFwk::EventRunner> &runner, std::shared_ptr<SimStateManager> simStateManager);
|
||||
virtual void Init();
|
||||
void Init();
|
||||
virtual void StartLoad();
|
||||
std::string ObtainIMSI();
|
||||
void UpdateImsi(std::string imsi);
|
||||
@ -80,7 +80,8 @@ public:
|
||||
};
|
||||
virtual bool UpdateVoiceMail(const std::string &mailName, const std::string &mailNumber) = 0;
|
||||
bool HasSimCard();
|
||||
virtual void UnInit();
|
||||
void UnInit();
|
||||
void ClearData();
|
||||
void SetId(int id)
|
||||
{
|
||||
slotId_ = id;
|
||||
|
@ -22,9 +22,7 @@ namespace OHOS {
|
||||
namespace Telephony {
|
||||
class IsimFile : public IccFile {
|
||||
public:
|
||||
IsimFile(
|
||||
const std::shared_ptr<AppExecFwk::EventRunner> &runner, std::shared_ptr<SimStateManager> simStateManager);
|
||||
void Init();
|
||||
IsimFile(const std::shared_ptr<AppExecFwk::EventRunner> &runner, std::shared_ptr<SimStateManager> simStateManager);
|
||||
void StartLoad();
|
||||
void ProcessEvent(const AppExecFwk::InnerEvent::Pointer &event);
|
||||
~IsimFile();
|
||||
|
@ -22,9 +22,7 @@ namespace OHOS {
|
||||
namespace Telephony {
|
||||
class RuimFile : public IccFile {
|
||||
public:
|
||||
RuimFile(
|
||||
const std::shared_ptr<AppExecFwk::EventRunner> &runner, std::shared_ptr<SimStateManager> simStateManager);
|
||||
void Init();
|
||||
RuimFile(const std::shared_ptr<AppExecFwk::EventRunner> &runner, std::shared_ptr<SimStateManager> simStateManager);
|
||||
void StartLoad();
|
||||
std::string ObtainSimOperator();
|
||||
std::string ObtainIsoCountryCode();
|
||||
@ -42,7 +40,6 @@ public:
|
||||
bool ObtainCsimSpnDisplayCondition();
|
||||
int ObtainSpnCondition(bool roaming, const std::string &operatorNum);
|
||||
bool UpdateVoiceMail(const std::string &mailName, const std::string &mailNumber);
|
||||
void UnInit();
|
||||
|
||||
protected:
|
||||
void ProcessIccRefresh(int msgId);
|
||||
|
@ -22,9 +22,7 @@ namespace OHOS {
|
||||
namespace Telephony {
|
||||
class SimFile : public IccFile {
|
||||
public:
|
||||
SimFile(
|
||||
const std::shared_ptr<AppExecFwk::EventRunner> &runner, std::shared_ptr<SimStateManager> simStateManager);
|
||||
void Init();
|
||||
SimFile(const std::shared_ptr<AppExecFwk::EventRunner> &runner, std::shared_ptr<SimStateManager> simStateManager);
|
||||
void StartLoad();
|
||||
std::string ObtainMsisdnNumber();
|
||||
std::string ObtainSimOperator();
|
||||
@ -38,7 +36,6 @@ public:
|
||||
~SimFile() = default;
|
||||
bool ProcessIccReady(const AppExecFwk::InnerEvent::Pointer &event);
|
||||
bool UpdateVoiceMail(const std::string &mailName, const std::string &mailNumber);
|
||||
void UnInit();
|
||||
|
||||
protected:
|
||||
enum SpnStatus {
|
||||
|
@ -40,6 +40,7 @@ public:
|
||||
std::shared_ptr<Telephony::SimStateManager> state);
|
||||
virtual ~SimFileManager();
|
||||
void Init(int slotId);
|
||||
void ClearData();
|
||||
std::u16string GetSimOperatorNumeric();
|
||||
std::u16string GetISOCountryCodeForSim();
|
||||
std::u16string GetSimSpn();
|
||||
|
@ -81,7 +81,14 @@ IccFile::IccFile(
|
||||
TELEPHONY_LOGI("simmgr IccFile::IccFile finish");
|
||||
}
|
||||
|
||||
void IccFile::Init() {}
|
||||
void IccFile::Init()
|
||||
{
|
||||
if (stateManager_ != nullptr) {
|
||||
stateManager_->RegisterCoreNotify(shared_from_this(), RadioEvent::RADIO_SIM_STATE_READY);
|
||||
stateManager_->RegisterCoreNotify(shared_from_this(), RadioEvent::RADIO_SIM_STATE_LOCKED);
|
||||
stateManager_->RegisterCoreNotify(shared_from_this(), RadioEvent::RADIO_SIM_STATE_SIMLOCK);
|
||||
}
|
||||
}
|
||||
|
||||
void IccFile::StartLoad()
|
||||
{
|
||||
@ -507,7 +514,7 @@ bool IccFile::HasSimCard()
|
||||
return (stateManager_ != nullptr) ? stateManager_->HasSimCard() : false;
|
||||
}
|
||||
|
||||
void IccFile::UnInit()
|
||||
void IccFile::ClearData()
|
||||
{
|
||||
imsi_ = "";
|
||||
iccId_ = "";
|
||||
@ -521,6 +528,16 @@ void IccFile::UnInit()
|
||||
gid1_ = "";
|
||||
gid2_ = "";
|
||||
msisdnTag_ = "";
|
||||
fileQueried_ = false;
|
||||
}
|
||||
void IccFile::UnInit()
|
||||
{
|
||||
if (stateManager_ != nullptr) {
|
||||
stateManager_->UnRegisterCoreNotify(shared_from_this(), RadioEvent::RADIO_SIM_STATE_READY);
|
||||
stateManager_->UnRegisterCoreNotify(shared_from_this(), RadioEvent::RADIO_SIM_STATE_LOCKED);
|
||||
stateManager_->UnRegisterCoreNotify(shared_from_this(), RadioEvent::RADIO_SIM_STATE_SIMLOCK);
|
||||
}
|
||||
ClearData();
|
||||
}
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
||||
|
@ -33,17 +33,6 @@ IsimFile::IsimFile(
|
||||
InitMemberFunc();
|
||||
}
|
||||
|
||||
void IsimFile::Init()
|
||||
{
|
||||
TELEPHONY_LOGI("IsimFile:::Init():start");
|
||||
IccFile::Init();
|
||||
if (stateManager_ != nullptr) {
|
||||
stateManager_->RegisterCoreNotify(shared_from_this(), RadioEvent::RADIO_SIM_STATE_READY);
|
||||
stateManager_->RegisterCoreNotify(shared_from_this(), RadioEvent::RADIO_SIM_STATE_LOCKED);
|
||||
stateManager_->RegisterCoreNotify(shared_from_this(), RadioEvent::RADIO_SIM_STATE_SIMLOCK);
|
||||
}
|
||||
}
|
||||
|
||||
void IsimFile::StartLoad()
|
||||
{
|
||||
TELEPHONY_LOGI("IsimFile::StartLoad() start");
|
||||
@ -224,6 +213,7 @@ std::string IsimFile::ObtainIsoCountryCode()
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
IsimFile::~IsimFile() {}
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
||||
|
@ -104,14 +104,14 @@ void MultiSimMonitor::RefreshData(int32_t slotId)
|
||||
TELEPHONY_LOGE("MultiSimMonitor::RefreshData slotId is invalid");
|
||||
return;
|
||||
}
|
||||
if (controller_ == nullptr || simStateManager_[slotId] == nullptr) {
|
||||
if (controller_ == nullptr || simStateManager_[slotId] == nullptr || simFileManager_[slotId] == nullptr) {
|
||||
TELEPHONY_LOGE("MultiSimMonitor::RefreshData controller_ or simStateManager_ is nullptr");
|
||||
return;
|
||||
}
|
||||
if (simStateManager_[slotId]->GetSimState() == SimState::SIM_STATE_NOT_PRESENT) {
|
||||
TELEPHONY_LOGI("MultiSimMonitor::RefreshData clear data when sim is absent");
|
||||
controller_->ForgetAllData(slotId);
|
||||
controller_->GetListFromDataBase();
|
||||
simFileManager_[slotId]->ClearData();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -34,17 +34,6 @@ RuimFile::RuimFile(
|
||||
InitMemberFunc();
|
||||
}
|
||||
|
||||
void RuimFile::Init()
|
||||
{
|
||||
TELEPHONY_LOGI("RuimFile:::Init():start");
|
||||
IccFile::Init();
|
||||
if (stateManager_ != nullptr) {
|
||||
stateManager_->RegisterCoreNotify(shared_from_this(), RadioEvent::RADIO_SIM_STATE_READY);
|
||||
stateManager_->RegisterCoreNotify(shared_from_this(), RadioEvent::RADIO_SIM_STATE_LOCKED);
|
||||
stateManager_->RegisterCoreNotify(shared_from_this(), RadioEvent::RADIO_SIM_STATE_SIMLOCK);
|
||||
}
|
||||
}
|
||||
|
||||
void RuimFile::StartLoad()
|
||||
{
|
||||
TELEPHONY_LOGI("RuimFile::StartLoad() start");
|
||||
@ -132,7 +121,7 @@ void RuimFile::OnAllFilesFetched()
|
||||
{
|
||||
UpdateLoaded(true);
|
||||
filesFetchedObser_->NotifyObserver(RadioEvent::RADIO_SIM_RECORDS_LOADED, slotId_);
|
||||
NotifyRegistrySimState(CardType::SINGLE_MODE_RUIM_CARD, SimState::SIM_STATE_LOADED, LockReason::SIM_NONE);
|
||||
PublishSimFileEvent(EventFwk::CommonEventSupport::COMMON_EVENT_SIM_STATE_CHANGED, ICC_STATE_LOADED, "");
|
||||
}
|
||||
|
||||
bool RuimFile::ProcessIccReady(const AppExecFwk::InnerEvent::Pointer &event)
|
||||
@ -354,16 +343,6 @@ bool RuimFile::UpdateVoiceMail(const std::string &mailName, const std::string &m
|
||||
return false;
|
||||
}
|
||||
|
||||
void RuimFile::UnInit()
|
||||
{
|
||||
if (stateManager_ != nullptr) {
|
||||
stateManager_->UnRegisterCoreNotify(shared_from_this(), RadioEvent::RADIO_SIM_STATE_READY);
|
||||
stateManager_->UnRegisterCoreNotify(shared_from_this(), RadioEvent::RADIO_SIM_STATE_LOCKED);
|
||||
stateManager_->UnRegisterCoreNotify(shared_from_this(), RadioEvent::RADIO_SIM_STATE_SIMLOCK);
|
||||
}
|
||||
IccFile::UnInit();
|
||||
}
|
||||
|
||||
RuimFile::~RuimFile() {}
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
||||
|
@ -38,17 +38,6 @@ SimFile::SimFile(
|
||||
InitMemberFunc();
|
||||
}
|
||||
|
||||
void SimFile::Init()
|
||||
{
|
||||
TELEPHONY_LOGI("SimFile:::Init():start");
|
||||
IccFile::Init();
|
||||
if (stateManager_ != nullptr) {
|
||||
stateManager_->RegisterCoreNotify(shared_from_this(), RadioEvent::RADIO_SIM_STATE_READY);
|
||||
stateManager_->RegisterCoreNotify(shared_from_this(), RadioEvent::RADIO_SIM_STATE_LOCKED);
|
||||
stateManager_->RegisterCoreNotify(shared_from_this(), RadioEvent::RADIO_SIM_STATE_SIMLOCK);
|
||||
}
|
||||
}
|
||||
|
||||
void SimFile::StartLoad()
|
||||
{
|
||||
TELEPHONY_LOGI("SimFile::StartLoad() start");
|
||||
@ -166,7 +155,7 @@ void SimFile::OnAllFilesFetched()
|
||||
if (filesFetchedObser_ != nullptr) {
|
||||
filesFetchedObser_->NotifyObserver(RadioEvent::RADIO_SIM_RECORDS_LOADED, slotId_);
|
||||
}
|
||||
NotifyRegistrySimState(CardType::SINGLE_MODE_USIM_CARD, SimState::SIM_STATE_LOADED, LockReason::SIM_NONE);
|
||||
PublishSimFileEvent(EventFwk::CommonEventSupport::COMMON_EVENT_SIM_STATE_CHANGED, ICC_STATE_LOADED, "");
|
||||
}
|
||||
|
||||
bool SimFile::ProcessIccReady(const AppExecFwk::InnerEvent::Pointer &event)
|
||||
@ -1282,15 +1271,5 @@ bool SimFile::CphsVoiceMailAvailable()
|
||||
}
|
||||
return available;
|
||||
}
|
||||
|
||||
void SimFile::UnInit()
|
||||
{
|
||||
if (stateManager_ != nullptr) {
|
||||
stateManager_->UnRegisterCoreNotify(shared_from_this(), RadioEvent::RADIO_SIM_STATE_READY);
|
||||
stateManager_->UnRegisterCoreNotify(shared_from_this(), RadioEvent::RADIO_SIM_STATE_LOCKED);
|
||||
stateManager_->UnRegisterCoreNotify(shared_from_this(), RadioEvent::RADIO_SIM_STATE_SIMLOCK);
|
||||
}
|
||||
IccFile::UnInit();
|
||||
}
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
||||
} // namespace OHOS
|
||||
|
@ -600,5 +600,14 @@ std::u16string SimFileManager::GetSimIst()
|
||||
TELEPHONY_LOGI("SimFileManager::GetSimIst result:%{public}s ", (result.empty() ? "false" : "true"));
|
||||
return Str8ToStr16(result);
|
||||
}
|
||||
|
||||
void SimFileManager::ClearData()
|
||||
{
|
||||
if (simFile_ == nullptr) {
|
||||
TELEPHONY_LOGE("SimFileManager::ClearData simFile nullptr");
|
||||
return;
|
||||
}
|
||||
simFile_->ClearData();
|
||||
}
|
||||
} // namespace Telephony
|
||||
} // namespace OHOS
|
Loading…
Reference in New Issue
Block a user