网络状态增强3

Signed-off-by: cutePikachu <1439925662@qq.com>
This commit is contained in:
cutePikachu 2024-05-25 16:15:28 +08:00
parent 554d334683
commit 292b77a414
2 changed files with 17 additions and 13 deletions

View File

@ -69,6 +69,7 @@ private:
bool imsRegStatus_ = false;
int32_t slotId_ = 0;
std::unique_ptr<ImsServiceStatus> imsServiceStatus_ = nullptr;
bool updateDelay_ = false;
};
} // namespace Telephony
} // namespace OHOS

View File

@ -304,12 +304,12 @@ void NetworkSearchState::NotifyPsRegStatusChange()
return;
}
if (networkState_->GetPsRegStatus() == RegServiceState::REG_STATE_IN_SERVICE &&
networkStateOld_->GetPsRegStatus() != RegServiceState::REG_STATE_IN_SERVICE) {
if (updateDelay_ || (networkState_->GetPsRegStatus() == RegServiceState::REG_STATE_IN_SERVICE &&
networkStateOld_->GetPsRegStatus() != RegServiceState::REG_STATE_IN_SERVICE)) {
networkSearchManager->NotifyPsConnectionAttachedChanged(slotId_);
}
if (networkState_->GetPsRegStatus() != RegServiceState::REG_STATE_IN_SERVICE &&
networkStateOld_->GetPsRegStatus() == RegServiceState::REG_STATE_IN_SERVICE) {
if (updateDelay_ || (networkState_->GetPsRegStatus() != RegServiceState::REG_STATE_IN_SERVICE &&
networkStateOld_->GetPsRegStatus() == RegServiceState::REG_STATE_IN_SERVICE)) {
networkSearchManager->NotifyPsConnectionDetachedChanged(slotId_);
}
}
@ -326,12 +326,12 @@ void NetworkSearchState::NotifyPsRoamingStatusChange()
TELEPHONY_LOGE("NotifyPsRoamingStatusChange networkState_ is null slotId:%{public}d", slotId_);
return;
}
if (networkState_->GetPsRoamingStatus() > RoamingType::ROAMING_STATE_UNKNOWN &&
networkStateOld_->GetPsRoamingStatus() == RoamingType::ROAMING_STATE_UNKNOWN) {
if (updateDelay_ || (networkState_->GetPsRoamingStatus() > RoamingType::ROAMING_STATE_UNKNOWN &&
networkStateOld_->GetPsRoamingStatus() == RoamingType::ROAMING_STATE_UNKNOWN)) {
networkSearchManager->NotifyPsRoamingOpenChanged(slotId_);
}
if (networkStateOld_->GetPsRoamingStatus() > RoamingType::ROAMING_STATE_UNKNOWN &&
networkState_->GetPsRoamingStatus() == RoamingType::ROAMING_STATE_UNKNOWN) {
if (updateDelay_ || (networkStateOld_->GetPsRoamingStatus() > RoamingType::ROAMING_STATE_UNKNOWN &&
networkState_->GetPsRoamingStatus() == RoamingType::ROAMING_STATE_UNKNOWN)) {
networkSearchManager->NotifyPsRoamingCloseChanged(slotId_);
}
}
@ -349,7 +349,7 @@ void NetworkSearchState::NotifyPsRadioTechChange()
return;
}
if (networkState_->GetPsRadioTech() != networkStateOld_->GetPsRadioTech()) {
if (updateDelay_ || networkState_->GetPsRadioTech() != networkStateOld_->GetPsRadioTech()) {
networkSearchManager->UpdatePhone(slotId_, networkState_->GetCsRadioTech(), networkState_->GetPsRadioTech());
networkSearchManager->SendUpdateCellLocationRequest(slotId_);
networkSearchManager->NotifyPsRatChanged(slotId_);
@ -368,7 +368,7 @@ void NetworkSearchState::NotifyEmergencyChange()
TELEPHONY_LOGE("NotifyEmergencyChange networkState_ is null slotId:%{public}d", slotId_);
return;
}
if (networkState_->IsEmergency() != networkStateOld_->IsEmergency()) {
if (updateDelay_ || (networkState_->IsEmergency() != networkStateOld_->IsEmergency())) {
if (networkState_->IsEmergency()) {
networkSearchManager->NotifyEmergencyOpenChanged(slotId_);
} else {
@ -390,7 +390,7 @@ void NetworkSearchState::NotifyNrStateChange()
return;
}
if (networkState_->GetNrState() != networkStateOld_->GetNrState()) {
if (updateDelay_ || (networkState_->GetNrState() != networkStateOld_->GetNrState())) {
networkSearchManager->NotifyNrStateChanged(slotId_);
}
}
@ -422,7 +422,7 @@ void NetworkSearchState::NotifyStateChange()
TELEPHONY_EXT_WRAPPER.updateNetworkStateExt_(slotId_, networkState_);
}
if (!(*networkState_ == *networkStateOld_)) {
if (updateDelay_ || !(*networkState_ == *networkStateOld_)) {
TELEPHONY_LOGI(
"NetworkSearchState::StateCheck isNetworkStateChange notify to app... slotId:%{public}d", slotId_);
sptr<NetworkState> ns = new NetworkState;
@ -437,6 +437,9 @@ void NetworkSearchState::NotifyStateChange()
if (TELEPHONY_EXT_WRAPPER.processStateChangeExt_ != nullptr) {
bool needDelay = TELEPHONY_EXT_WRAPPER.processStateChangeExt_(slotId_, ns);
if (needDelay) {
networkState_->Marshalling(data);
networkStateOld_->ReadFromParcel(data);
updateDelay_ = true;
return;
}
}
@ -474,7 +477,7 @@ void NetworkSearchState::CsRadioTechChange()
return;
}
if (networkState_->GetCsRadioTech() != networkStateOld_->GetCsRadioTech()) {
if (updateDelay_ || networkState_->GetCsRadioTech() != networkStateOld_->GetCsRadioTech()) {
networkSearchManager->UpdatePhone(slotId_, networkState_->GetCsRadioTech(), networkState_->GetPsRadioTech());
}
}