From 3c6be33c49061670f782c79c49e48a9ae1218c95 Mon Sep 17 00:00:00 2001 From: jxw Date: Mon, 11 Aug 2025 17:05:09 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9B=9E=E9=80=80establish=20apn?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: jxw --- .../js/napi/src/cellular_data_service.cpp | 28 ------------------- frameworks/native/cellular_data_client.cpp | 10 ------- interfaces/innerkits/cellular_data_client.h | 2 -- .../cellular_data_ipc_interface_code.h | 1 - services/include/cellular_data_controller.h | 1 - services/include/cellular_data_service.h | 1 - services/src/cellular_data_controller.cpp | 11 -------- test/cellular_data_client_test.cpp | 11 -------- test/zero_branch_test.cpp | 2 -- 9 files changed, 67 deletions(-) diff --git a/frameworks/js/napi/src/cellular_data_service.cpp b/frameworks/js/napi/src/cellular_data_service.cpp index d570cd67..122f9379 100644 --- a/frameworks/js/napi/src/cellular_data_service.cpp +++ b/frameworks/js/napi/src/cellular_data_service.cpp @@ -757,34 +757,6 @@ std::shared_ptr CellularDataService::GetCellularDataCont return item->second; } -int32_t CellularDataService::EstablishAllApnsIfConnectable(const int32_t slotId) -{ - if (!TelephonyPermission::CheckPermission(Permission::SET_TELEPHONY_STATE)) { - TELEPHONY_LOGE("Permission denied!"); - return TELEPHONY_ERR_PERMISSION_ERR; - } - - std::shared_ptr cellularDataController = GetCellularDataController(slotId); - if (cellularDataController == nullptr) { - TELEPHONY_LOGE("slot%{public}d cellularDataControllers is null", slotId); - return CELLULAR_DATA_INVALID_PARAM; - } - - bool hasSim = false; - CoreManagerInner::GetInstance().HasSimCard(slotId, hasSim); - if (!hasSim) { - TELEPHONY_LOGE("slot%{public}d has no sim", slotId); - return TELEPHONY_ERR_NO_SIM_CARD; - } - if (!CoreManagerInner::GetInstance().IsSimActive(slotId)) { - TELEPHONY_LOGE("slot%{public}d sim not active", slotId); - return TELEPHONY_ERR_SLOTID_INVALID; - } - - bool result = cellularDataController->EstablishAllApnsIfConnectable(); - return result ? TELEPHONY_ERR_SUCCESS : TELEPHONY_ERR_FAIL; -} - int32_t CellularDataService::ReleaseCellularDataConnection(int32_t slotId) { if (!TelephonyPermission::CheckPermission(Permission::SET_TELEPHONY_STATE)) { diff --git a/frameworks/native/cellular_data_client.cpp b/frameworks/native/cellular_data_client.cpp index 1465c95c..6c612928 100644 --- a/frameworks/native/cellular_data_client.cpp +++ b/frameworks/native/cellular_data_client.cpp @@ -452,16 +452,6 @@ bool CellularDataClient::IsCellularDataSysAbilityExist(sptr &obje return true; } -int32_t CellularDataClient::EstablishAllApnsIfConnectable(int32_t slotId) -{ - sptr proxy = GetProxy(); - if (proxy == nullptr) { - TELEPHONY_LOGE("proxy is null"); - return TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL; - } - return proxy->EstablishAllApnsIfConnectable(slotId); -} - int32_t CellularDataClient::ReleaseCellularDataConnection(int32_t slotId) { sptr proxy = GetProxy(); diff --git a/interfaces/innerkits/cellular_data_client.h b/interfaces/innerkits/cellular_data_client.h index d5f3ff30..3179746e 100644 --- a/interfaces/innerkits/cellular_data_client.h +++ b/interfaces/innerkits/cellular_data_client.h @@ -209,8 +209,6 @@ public: */ int32_t InitCellularDataController(int32_t slotId); - int32_t EstablishAllApnsIfConnectable(int32_t slotId); - /** * @brief Release cellular data connection. * diff --git a/interfaces/innerkits/cellular_data_ipc_interface_code.h b/interfaces/innerkits/cellular_data_ipc_interface_code.h index bededf75..f60323d5 100644 --- a/interfaces/innerkits/cellular_data_ipc_interface_code.h +++ b/interfaces/innerkits/cellular_data_ipc_interface_code.h @@ -43,7 +43,6 @@ enum class CellularDataInterfaceCode { ENABLE_INTELLIGENCE_SWITCH, INIT_CELLULAR_DATA_CONTROLLER, GET_INTELLIGENCE_SWITCH_STATE, - ESTABLISH_ALL_APNS_IF_CONNECTABLE, RELEASE_CELLULAR_DATA_CONNECTION, GET_CELLULAR_DATA_SUPPLIERID, CORRECT_NET_SUPPLIER_NO_AVAILABLE, diff --git a/services/include/cellular_data_controller.h b/services/include/cellular_data_controller.h index d8429e70..7c8e8cb2 100644 --- a/services/include/cellular_data_controller.h +++ b/services/include/cellular_data_controller.h @@ -54,7 +54,6 @@ public: void IsNeedDoRecovery(bool needDoRecovery) const; bool ChangeConnectionForDsds(bool enable) const; int32_t GetIntelligenceSwitchState(bool &switchState); - bool EstablishAllApnsIfConnectable() const; bool AddUid(const NetRequest &request); bool RemoveUid(const NetRequest &request); bool ReleaseCellularDataConnection() const; diff --git a/services/include/cellular_data_service.h b/services/include/cellular_data_service.h index c18af7b7..22c31e68 100644 --- a/services/include/cellular_data_service.h +++ b/services/include/cellular_data_service.h @@ -87,7 +87,6 @@ public: int32_t EnableIntelligenceSwitch(bool enable) override; int32_t InitCellularDataController(int32_t slotId) override; int32_t GetIntelligenceSwitchState(bool &switchState) override; - int32_t EstablishAllApnsIfConnectable(int32_t slotId) override; int32_t ReleaseCellularDataConnection(int32_t slotId) override; int32_t GetCellularDataSupplierId(int32_t slotId, uint64_t capability, uint32_t &supplierId) override; int32_t CorrectNetSupplierNoAvailable(int32_t slotId) override; diff --git a/services/src/cellular_data_controller.cpp b/services/src/cellular_data_controller.cpp index a12aaffb..29d59918 100644 --- a/services/src/cellular_data_controller.cpp +++ b/services/src/cellular_data_controller.cpp @@ -461,17 +461,6 @@ void CellularDataController::IsNeedDoRecovery(bool needDoRecovery) const cellularDataHandler_->IsNeedDoRecovery(needDoRecovery); } -bool CellularDataController::EstablishAllApnsIfConnectable() const -{ - if (cellularDataHandler_ == nullptr) { - TELEPHONY_LOGE("Slot%{public}d: cellularDataHandler is null", slotId_); - return false; - } - TELEPHONY_LOGI("EstablishAllApnsIfConnectable slot%{public}d", slotId_); - cellularDataHandler_->EstablishAllApnsIfConnectable(); - return true; -} - bool CellularDataController::ReleaseCellularDataConnection() const { if (cellularDataHandler_ == nullptr) { diff --git a/test/cellular_data_client_test.cpp b/test/cellular_data_client_test.cpp index 7327d02c..8ab7406c 100644 --- a/test/cellular_data_client_test.cpp +++ b/test/cellular_data_client_test.cpp @@ -178,17 +178,6 @@ HWTEST_F(CellularDataClientTest, SetDefaultCellularDataSlotId_002, TestSize.Leve EXPECT_NE(result, 0); } -/** - * @tc.number EstablishAllApnsIfConnectable_001 - * @tc.name test function branch - * @tc.desc Function test - */ -HWTEST_F(CellularDataClientTest, EstablishAllApnsIfConnectable_001, TestSize.Level0) -{ - int32_t result = CellularDataClient::GetInstance().EstablishAllApnsIfConnectable(0); - EXPECT_EQ(result, TELEPHONY_ERR_PERMISSION_ERR); -} - /** * @tc.number ReleaseCellularDataConnection_001 * @tc.name test function branch diff --git a/test/zero_branch_test.cpp b/test/zero_branch_test.cpp index ab31cdd1..0a130abd 100644 --- a/test/zero_branch_test.cpp +++ b/test/zero_branch_test.cpp @@ -1051,7 +1051,6 @@ HWTEST_F(BranchTest, Telephony_CellularDataController_001, Function | MediumTest ASSERT_FALSE(controller.ClearAllConnections(reason)); ASSERT_FALSE(controller.ChangeConnectionForDsds(false)); controller.UnRegisterEvents(); - ASSERT_FALSE(controller.EstablishAllApnsIfConnectable()); ASSERT_FALSE(controller.HandleApnChanged()); ASSERT_FALSE(controller.GetCellularDataFlowType()); } @@ -1104,7 +1103,6 @@ HWTEST_F(BranchTest, Telephony_CellularDataController_002, Function | MediumTest controller.HasInternetCapability(0); DisConnectionReason reason = DisConnectionReason::REASON_NORMAL; ASSERT_TRUE(controller.ClearAllConnections(reason)); - ASSERT_TRUE(controller.EstablishAllApnsIfConnectable()); controller.ChangeConnectionForDsds(false); ASSERT_FALSE(controller.GetCellularDataFlowType()); controller.UnRegisterEvents(); -- Gitee