已合并
增加分布式slot蜂窝激活判决条件 #1310
yyxnju创建于 12 天前
增加分布式slot蜂窝激活判决条件 #1310
已合并
共 5 个文件变更+57-4
| @@ -99,6 +99,7 @@ private: | |||
| 99 | std::shared_ptr<CellularDataStateMachine> CreateCellularDataConnect(); | 99 | std::shared_ptr<CellularDataStateMachine> CreateCellularDataConnect(); |
| 100 | std::shared_ptr<CellularDataStateMachine> FindIdleCellularDataConnection() const; | 100 | std::shared_ptr<CellularDataStateMachine> FindIdleCellularDataConnection() const; |
| 101 | bool CheckCellularDataSlotId(sptr<ApnHolder> &apnHolder); | 101 | bool CheckCellularDataSlotId(sptr<ApnHolder> &apnHolder); |
| 102 | + bool IsCellularDataAllowedByExt(); | ||
| 102 | bool CheckAttachAndSimState(sptr<ApnHolder> &apnHolder); | 103 | bool CheckAttachAndSimState(sptr<ApnHolder> &apnHolder); |
| 103 | bool CheckRoamingState(sptr<ApnHolder> &apnHolder); | 104 | bool CheckRoamingState(sptr<ApnHolder> &apnHolder); |
| 104 | bool CheckApnState(sptr<ApnHolder> &apnHolder); | 105 | bool CheckApnState(sptr<ApnHolder> &apnHolder); |
| @@ -542,6 +542,28 @@ bool CellularDataHandler::CheckDataPermittedByDsds() | |||
| 542 | return true; | 542 | return true; |
| 543 | } | 543 | } |
| 544 | 544 | ||
| 545 | +bool CellularDataHandler::IsCellularDataAllowedByExt() | ||
| 546 | +{ | ||
| 547 | + // LCOV_EXCL_START | ||
| 548 | + | ||
| 549 | + if (TELEPHONY_EXT_WRAPPER.isVirtualModemSlot_ && | ||
| 550 | + TELEPHONY_EXT_WRAPPER.isVirtualModemSlot_(slotId_)) { | ||
| 551 | + if (TELEPHONY_EXT_WRAPPER.isDistributedCellularEnabledForSlot_ && | ||
| 552 | + TELEPHONY_EXT_WRAPPER.isDistributedCellularEnabledForSlot_(slotId_)) { | ||
| 553 | + return true; | ||
| 554 | + } | ||
| 555 | + } else { | ||
| 556 | + if (TELEPHONY_EXT_WRAPPER.isDualCellularCardAllowed_) { | ||
| 557 | + if (TELEPHONY_EXT_WRAPPER.isDualCellularCardAllowed_()) { | ||
| 558 | + return true; | ||
| 559 | + } | ||
| 560 | + } | ||
| 561 | + } | ||
| 562 | + | ||
| 563 | + return false; | ||
| 564 | + // LCOV_EXCL_STOP | ||
| 565 | +} | ||
| 566 | + | ||
| 545 | bool CellularDataHandler::CheckCellularDataSlotId(sptr<ApnHolder> &apnHolder) | 567 | bool CellularDataHandler::CheckCellularDataSlotId(sptr<ApnHolder> &apnHolder) |
| 546 | { | 568 | { |
| 547 | if (apnHolder == nullptr) { | 569 | if (apnHolder == nullptr) { |
| @@ -565,11 +587,11 @@ bool CellularDataHandler::CheckCellularDataSlotId(sptr<ApnHolder> &apnHolder) | |||
| 565 | TELEPHONY_LOGE("slot%{public}d, VSimEnabled & not mms type, ret false", slotId_); | 587 | TELEPHONY_LOGE("slot%{public}d, VSimEnabled & not mms type, ret false", slotId_); |
| 566 | return false; | 588 | return false; |
| 567 | } | 589 | } |
| 568 | - if (TELEPHONY_EXT_WRAPPER.isDualCellularCardAllowed_) { | 590 | + // LCOV_EXCL_START |
| 569 | - if (TELEPHONY_EXT_WRAPPER.isDualCellularCardAllowed_()) { | 591 | + if (IsCellularDataAllowedByExt()) { |
| 570 | - return true; | 592 | + return true; |
| 571 | - } | ||
| 572 | } | 593 | } |
| 594 | + // LCOV_EXCL_STOP | ||
| 573 | 595 | ||
| 574 | 596 | ||
| 575 | if (defSlotId != slotId_ && !apnType.compare(DATA_CONTEXT_ROLE_DEFAULT)) { | 597 | if (defSlotId != slotId_ && !apnType.compare(DATA_CONTEXT_ROLE_DEFAULT)) { |
| @@ -41,6 +41,7 @@ public: | |||
| 41 | /* add for vsim end */ | 41 | /* add for vsim end */ |
| 42 | typedef void (*SEND_DATA_SWITCH_CHANGE_INFO)(const char*, int32_t, bool); | 42 | typedef void (*SEND_DATA_SWITCH_CHANGE_INFO)(const char*, int32_t, bool); |
| 43 | typedef bool (*IS_DUAL_CELLULAR_CARD_ALLOWED)(); | 43 | typedef bool (*IS_DUAL_CELLULAR_CARD_ALLOWED)(); |
| 44 | + typedef bool (*IS_DISTRIBUTED_CELLULAR_ENABLED_FOR_SLOT)(int32_t); | ||
| 44 | typedef int64_t (*HANDLE_DEND_FAILCAUSE)(int32_t, int64_t); | 45 | typedef int64_t (*HANDLE_DEND_FAILCAUSE)(int32_t, int64_t); |
| 45 | typedef int32_t (*CONVERT_PDP_ERROR)(int32_t); | 46 | typedef int32_t (*CONVERT_PDP_ERROR)(int32_t); |
| 46 | typedef void (*RESTART_RADIO_IF_RQUIRED)(int32_t, int32_t); | 47 | typedef void (*RESTART_RADIO_IF_RQUIRED)(int32_t, int32_t); |
| @@ -65,6 +66,7 @@ public: | |||
| 65 | IS_VSIM_IN_DISABLE_PROCESS isVSimInDisableProcess_ = nullptr; | 66 | IS_VSIM_IN_DISABLE_PROCESS isVSimInDisableProcess_ = nullptr; |
| 66 | SEND_DATA_SWITCH_CHANGE_INFO sendDataSwitchChangeInfo_ = nullptr; | 67 | SEND_DATA_SWITCH_CHANGE_INFO sendDataSwitchChangeInfo_ = nullptr; |
| 67 | IS_DUAL_CELLULAR_CARD_ALLOWED isDualCellularCardAllowed_ = nullptr; | 68 | IS_DUAL_CELLULAR_CARD_ALLOWED isDualCellularCardAllowed_ = nullptr; |
| 69 | + IS_DISTRIBUTED_CELLULAR_ENABLED_FOR_SLOT isDistributedCellularEnabledForSlot_ = nullptr; | ||
| 68 | GET_USER_DATA_ROAMING_EXPEND getUserDataRoamingExpend_ = nullptr; | 70 | GET_USER_DATA_ROAMING_EXPEND getUserDataRoamingExpend_ = nullptr; |
| 69 | SEND_APN_NEED_RETRY_INFO sendApnNeedRetryInfo_ = nullptr; | 71 | SEND_APN_NEED_RETRY_INFO sendApnNeedRetryInfo_ = nullptr; |
| 70 | HANDLE_DEND_FAILCAUSE handleDendFailcause_ = nullptr; | 72 | HANDLE_DEND_FAILCAUSE handleDendFailcause_ = nullptr; |
| @@ -91,6 +93,7 @@ private: | |||
| 91 | void InitTelephonyExtWrapperForVSim(); | 93 | void InitTelephonyExtWrapperForVSim(); |
| 92 | void InitSendDataSwitchChangeInfo(); | 94 | void InitSendDataSwitchChangeInfo(); |
| 93 | void InitIsDualCellularCardAllowed(); | 95 | void InitIsDualCellularCardAllowed(); |
| 96 | + void InitIsDistributedCellularEnabledForSlot(); | ||
| 94 | void InitHandleDendFailcause(); | 97 | void InitHandleDendFailcause(); |
| 95 | void InitConvertPdpError(); | 98 | void InitConvertPdpError(); |
| 96 | void InitRestartRadioIfRequired(); | 99 | void InitRestartRadioIfRequired(); |
| @@ -64,6 +64,7 @@ void TelephonyExtWrapper::InitTelephonyExtWrapperForCellularData() | |||
| 64 | InitTelephonyExtForCustomization(); | 64 | InitTelephonyExtForCustomization(); |
| 65 | InitSendDataSwitchChangeInfo(); | 65 | InitSendDataSwitchChangeInfo(); |
| 66 | InitIsDualCellularCardAllowed(); | 66 | InitIsDualCellularCardAllowed(); |
| 67 | + InitIsDistributedCellularEnabledForSlot(); | ||
| 67 | InitHandleDendFailcause(); | 68 | InitHandleDendFailcause(); |
| 68 | InitConvertPdpError(); | 69 | InitConvertPdpError(); |
| 69 | InitRestartRadioIfRequired(); | 70 | InitRestartRadioIfRequired(); |
| @@ -155,6 +156,20 @@ void TelephonyExtWrapper::InitIsDualCellularCardAllowed() | |||
| 155 | TELEPHONY_LOGD("telephony ext wrapper init IsDualCellularCardAllowed success"); | 156 | TELEPHONY_LOGD("telephony ext wrapper init IsDualCellularCardAllowed success"); |
| 156 | } | 157 | } |
| 157 | 158 | ||
| 159 | +void TelephonyExtWrapper::InitIsDistributedCellularEnabledForSlot() | ||
| 160 | +{ | ||
| 161 | + // LCOV_EXCL_START | ||
| 162 | + isDistributedCellularEnabledForSlot_ = (IS_DISTRIBUTED_CELLULAR_ENABLED_FOR_SLOT)dlsym( | ||
| 163 | + telephonyExtWrapperHandle_, "IsDistributedCellularEnabledForSlot"); | ||
| 164 | + if (isDistributedCellularEnabledForSlot_ == nullptr) { | ||
| 165 | + TELEPHONY_LOGE("telephony ext wrapper symbol IsDistributedCellularEnabledForSlot failed,\ | ||
| 166 | + error: %{public}s", dlerror()); | ||
| 167 | + return; | ||
| 168 | + } | ||
| 169 | + TELEPHONY_LOGD("telephony ext wrapper init IsDistributedCellularEnabledForSlot success"); | ||
| 170 | + // LCOV_EXCL_STOP | ||
| 171 | +} | ||
| 172 | + | ||
| 158 | void TelephonyExtWrapper::InitHandleDendFailcause() | 173 | void TelephonyExtWrapper::InitHandleDendFailcause() |
| 159 | { | 174 | { |
| 160 | handleDendFailcause_ = (HANDLE_DEND_FAILCAUSE)dlsym(telephonyExtWrapperHandle_, "HandleDendFailcause"); | 175 | handleDendFailcause_ = (HANDLE_DEND_FAILCAUSE)dlsym(telephonyExtWrapperHandle_, "HandleDendFailcause"); |
| @@ -622,5 +622,17 @@ HWTEST_F(CellularDataHandlerBranchTest, CheckAttachAndSimState_001, Function | M | |||
| 622 | cellularDataHandler_->CheckAttachAndSimState(apnHolder); | 622 | cellularDataHandler_->CheckAttachAndSimState(apnHolder); |
| 623 | EXPECT_FALSE(cellularDataHandler_->HasInnerEvent(CellularDataEventCode::MSG_RESUME_DATA_PERMITTED_TIMEOUT)); | 623 | EXPECT_FALSE(cellularDataHandler_->HasInnerEvent(CellularDataEventCode::MSG_RESUME_DATA_PERMITTED_TIMEOUT)); |
| 624 | } | 624 | } |
| 625 | + | ||
| 626 | +HWTEST_F(CellularDataHandlerBranchTest, IsCellularDataAllowedByExt_001, Function | MediumTest | Level3) | ||
| 627 | +{ | ||
| 628 | + auto cellularDataHandler = std::make_shared<CellularDataHandler>(0); | ||
| 629 | + cellularDataHandler->Init(); | ||
| 630 | + EXPECT_FALSE(cellularDataHandler->IsCellularDataAllowedByExt()); | ||
| 631 | + | ||
| 632 | + cellularDataHandler.reset(); | ||
| 633 | + cellularDataHandler = std::make_shared<CellularDataHandler>(2); | ||
| 634 | + cellularDataHandler->Init(); | ||
| 635 | + EXPECT_FALSE(cellularDataHandler->IsCellularDataAllowedByExt()); | ||
| 636 | +} | ||
| 625 | } // namespace Telephony | 637 | } // namespace Telephony |
| 626 | } // namespace OHOS | 638 | } // namespace OHOS |