mirror of
https://gitee.com/openharmony/telephony_core_service
synced 2024-11-27 02:00:45 +00:00
commit
8659d87fe3
@ -65,6 +65,10 @@ public:
|
||||
int32_t GetRadioProtocolTech(int32_t slotId);
|
||||
void GetRadioProtocol(int32_t slotId);
|
||||
bool InitShowName(int slotId);
|
||||
void ReCheckPrimary();
|
||||
|
||||
public:
|
||||
int32_t unInitModemSlotId_ = INVALID_VALUE;
|
||||
|
||||
private:
|
||||
bool IsValidData(int32_t slotId);
|
||||
@ -97,6 +101,7 @@ private:
|
||||
size_t GetLocalCacheSize();
|
||||
int32_t GetTargetSimId(int32_t slotId, int &simId);
|
||||
int32_t GetTargetIccId(int32_t slotId, std::string &iccId);
|
||||
bool IsAllModemInitDone();
|
||||
|
||||
private:
|
||||
int32_t maxCount_ = 0;
|
||||
|
@ -136,6 +136,9 @@ public:
|
||||
int32_t slotId, int32_t state, const std::string &operName, const std::string &operKey);
|
||||
int32_t GetSendSimMatchedOperatorInfoResponse();
|
||||
|
||||
public:
|
||||
bool modemInitDone_ = false;
|
||||
|
||||
private:
|
||||
void SyncCmdResponse();
|
||||
void ObtainIccStatus(int32_t slotId);
|
||||
|
@ -53,6 +53,7 @@ public:
|
||||
int32_t slotId, AuthType authType, const std::string &authData, SimAuthenticationResponse &response);
|
||||
int32_t SendSimMatchedOperatorInfo(
|
||||
int32_t slotId, int32_t state, const std::string &operName, const std::string &operKey);
|
||||
bool IfModemInitDone();
|
||||
|
||||
public:
|
||||
static bool responseReady_;
|
||||
|
@ -147,13 +147,26 @@ bool MultiSimController::InitPrimary()
|
||||
TELEPHONY_LOGI("no need to init");
|
||||
return false;
|
||||
}
|
||||
if (!IsAllModemInitDone()) {
|
||||
TELEPHONY_LOGI("wait for the other modem init");
|
||||
return false;
|
||||
}
|
||||
unInitModemSlotId_ = INVALID_VALUE;
|
||||
if (IsAllCardsReady() && !IsAllCardsLoaded()) {
|
||||
TELEPHONY_LOGI("wait for ohter card");
|
||||
TELEPHONY_LOGI("wait for the other card ready");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void MultiSimController::ReCheckPrimary()
|
||||
{
|
||||
if (InitPrimary()) {
|
||||
TELEPHONY_LOGI("ReCheckPrimary start");
|
||||
CheckIfNeedSwitchMainSlotId();
|
||||
}
|
||||
}
|
||||
|
||||
bool MultiSimController::IsAllCardsReady()
|
||||
{
|
||||
for (int32_t i = 0; i < maxCount_; i++) {
|
||||
@ -165,6 +178,18 @@ bool MultiSimController::IsAllCardsReady()
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MultiSimController::IsAllModemInitDone()
|
||||
{
|
||||
for (int32_t i = 0; i < maxCount_; i++) {
|
||||
if (simStateManager_[i] != nullptr && !(simStateManager_[i]->IfModemInitDone())) {
|
||||
TELEPHONY_LOGI("single modem init done");
|
||||
unInitModemSlotId_ = i;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MultiSimController::IsAllCardsLoaded()
|
||||
{
|
||||
if (localCacheInfo_.empty()) {
|
||||
@ -457,8 +482,10 @@ void MultiSimController::CheckIfNeedSwitchMainSlotId()
|
||||
{
|
||||
TELEPHONY_LOGD("start");
|
||||
if (IsSimActive(lastPrimarySlotId_)) {
|
||||
SavePrimarySlotIdInfo(lastPrimarySlotId_);
|
||||
TELEPHONY_LOGI("main slotId active, no need to switch main card");
|
||||
if (!IsAllCardsReady()) {
|
||||
SavePrimarySlotIdInfo(lastPrimarySlotId_);
|
||||
}
|
||||
} else {
|
||||
int32_t firstActivedSlotId = GetFirstActivedSlotId();
|
||||
if (!IsValidSlotId(firstActivedSlotId)) {
|
||||
@ -747,8 +774,13 @@ int32_t MultiSimController::SetPrimarySlotId(int32_t slotId)
|
||||
PublishSetPrimaryEvent(true);
|
||||
return TELEPHONY_ERR_LOCAL_PTR_NULL;
|
||||
}
|
||||
PublishSetPrimaryEvent(true);
|
||||
SavePrimarySlotIdInfo(slotId);
|
||||
PublishSetPrimaryEvent(true);
|
||||
for (int32_t i = 0; i < maxCount_; i++) {
|
||||
if (!(localCacheInfo_[i].iccId.empty())) {
|
||||
InitActive(i);
|
||||
}
|
||||
}
|
||||
return TELEPHONY_ERR_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -116,6 +116,10 @@ void MultiSimMonitor::RefreshData(int32_t slotId)
|
||||
controller_->GetListFromDataBase();
|
||||
simFileManager->ClearData();
|
||||
}
|
||||
if (controller_->unInitModemSlotId_ == slotId) {
|
||||
TELEPHONY_LOGI("need to recheck primary");
|
||||
controller_->ReCheckPrimary();
|
||||
}
|
||||
NotifySimAccountChanged();
|
||||
}
|
||||
|
||||
|
@ -475,6 +475,7 @@ void SimStateHandle::GetSimCardData(int32_t slotId, const AppExecFwk::InnerEvent
|
||||
if (param != nullptr) {
|
||||
iccState.simType_ = param->simType;
|
||||
iccState.simStatus_ = param->simState;
|
||||
modemInitDone_ = true;
|
||||
TELEPHONY_LOGI("SimStateHandle::GetSimCardData(), simType_ = %{public}d, simStatus_ = %{public}d",
|
||||
iccState.simType_, iccState.simStatus_);
|
||||
} else {
|
||||
@ -888,7 +889,7 @@ bool SimStateHandle::IsRadioStateUnavailable(const AppExecFwk::InnerEvent::Point
|
||||
return false;
|
||||
}
|
||||
int32_t radioState = object->data;
|
||||
if (radioState == ModemPowerState::CORE_SERVICE_POWER_NOT_AVAILABLE && HasSimCard()) {
|
||||
if (radioState == ModemPowerState::CORE_SERVICE_POWER_NOT_AVAILABLE) {
|
||||
TELEPHONY_LOGI("received radio unavailable");
|
||||
IccState iccState;
|
||||
iccState.simType_ = ICC_UNKNOWN_TYPE;
|
||||
|
@ -97,6 +97,14 @@ SimState SimStateManager::GetSimState()
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool SimStateManager::IfModemInitDone()
|
||||
{
|
||||
if (simStateHandle_ != nullptr) {
|
||||
return simStateHandle_->modemInitDone_;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
CardType SimStateManager::GetCardType()
|
||||
{
|
||||
CardType ret = CardType::UNKNOWN_CARD;
|
||||
|
@ -415,6 +415,8 @@ HWTEST_F(CoreServiceBranchTest, Telephony_MultiSimController_003, Function | Med
|
||||
multiSimController->PublishSetPrimaryEvent(true);
|
||||
multiSimController->EncryptIccId("");
|
||||
multiSimController->CheckIfNeedSwitchMainSlotId();
|
||||
multiSimController->IsAllModemInitDone();
|
||||
multiSimController->ReCheckPrimary();
|
||||
int simId = 0;
|
||||
multiSimController->GetTargetDefaultSimId(INVALID_SLOTID, simId);
|
||||
multiSimController->GetTargetSimId(INVALID_SLOTID, simId);
|
||||
|
Loading…
Reference in New Issue
Block a user