已合并
切换默认卡不去激活共享网络 #1306
yyxnju创建于 11 天前
切换默认卡不去激活共享网络 #1306
已合并
共 2 个文件变更+26-1
| @@ -1618,9 +1618,14 @@ void CellularDataHandler::HandleDefaultDataSubscriptionChanged() | |||
| 1618 | } | 1618 | } |
| 1619 | CoreManagerInner &coreInner = CoreManagerInner::GetInstance(); | 1619 | CoreManagerInner &coreInner = CoreManagerInner::GetInstance(); |
| 1620 | const int32_t defSlotId = coreInner.GetDefaultCellularDataSlotId(); | 1620 | const int32_t defSlotId = coreInner.GetDefaultCellularDataSlotId(); |
| 1621 | + bool isVirtualModemSlot = false; | ||
| 1622 | + | ||
| 1623 | + isVirtualModemSlot = | ||
| 1624 | + TELEPHONY_EXT_WRAPPER.isVirtualModemSlot_ && TELEPHONY_EXT_WRAPPER.isVirtualModemSlot_(slotId_); | ||
| 1625 | + | ||
| 1621 | if (defSlotId == slotId_) { | 1626 | if (defSlotId == slotId_) { |
| 1622 | SendEvent(CellularDataEventCode::MSG_ESTABLISH_ALL_APNS_IF_CONNECTABLE); | 1627 | SendEvent(CellularDataEventCode::MSG_ESTABLISH_ALL_APNS_IF_CONNECTABLE); |
| 1623 | - } else { | 1628 | + } else if (!isVirtualModemSlot) { |
| 1624 | ClearAllConnections(DisConnectionReason::REASON_CLEAR_CONNECTION); | 1629 | ClearAllConnections(DisConnectionReason::REASON_CLEAR_CONNECTION); |
| 1625 | } | 1630 | } |
| 1626 | } | 1631 | } |
| @@ -3078,5 +3078,25 @@ HWTEST_F(BranchTest, SetDataPermittedForMms_VSim_001, Function | MediumTest | Le | |||
| 3078 | TELEPHONY_EXT_WRAPPER.isVSimEnabled_ = original; | 3078 | TELEPHONY_EXT_WRAPPER.isVSimEnabled_ = original; |
| 3079 | 3079 | ||
| 3080 | } | 3080 | } |
| 3081 | + | ||
| 3082 | +bool MockIsVirtualModemSlot(int32_t slotId) | ||
| 3083 | +{ | ||
| 3084 | + return true; | ||
| 3085 | +} | ||
| 3086 | + | ||
| 3087 | +HWTEST_F(BranchTest, HandleDefaultDataSubscriptionChanged_Distributed_001, Function | MediumTest | Level3) | ||
| 3088 | +{ | ||
| 3089 | + auto cellularDataHandler = std::make_shared<CellularDataHandler>(100); | ||
| 3090 | + cellularDataHandler->Init(); | ||
| 3091 | + | ||
| 3092 | + auto isVirtualModemSlotFun = TELEPHONY_EXT_WRAPPER.isVirtualModemSlot_; | ||
| 3093 | + TELEPHONY_EXT_WRAPPER.isVirtualModemSlot_ = nullptr; | ||
| 3094 | + cellularDataHandler->HandleDefaultDataSubscriptionChanged(); | ||
| 3095 | + TELEPHONY_EXT_WRAPPER.isVirtualModemSlot_ = MockIsVirtualModemSlot; | ||
| 3096 | + cellularDataHandler->HandleDefaultDataSubscriptionChanged(); | ||
| 3097 | + EXPECT_EQ(cellularDataHandler->slotId_, CELLDATA_SLOT_ID_0); | ||
| 3098 | + TELEPHONY_EXT_WRAPPER.isVirtualModemSlot_ = isVirtualModemSlotFun; | ||
| 3099 | + | ||
| 3100 | +} | ||
| 3081 | } // namespace Telephony | 3101 | } // namespace Telephony |
| 3082 | } // namespace OHOS | 3102 | } // namespace OHOS |