From 9128066a15fc71a474c209528e8845cf45eb0624 Mon Sep 17 00:00:00 2001 From: n00810144 Date: Tue, 3 Sep 2024 21:28:56 +0800 Subject: [PATCH] =?UTF-8?q?restart=20modem=20=EF=BC=88cherry=20picked=20co?= =?UTF-8?q?mmit=20from=20Signed-off-b?= =?UTF-8?q?y:=20n00810144=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- services/control/include/satellite_control.h | 4 +-- services/control/src/satellite_control.cpp | 8 ++--- .../manager/src/cellular_call_handler.cpp | 8 +++++ .../manager/src/cellular_call_service.cpp | 6 ++++ test/fuzztest/BUILD.gn | 2 +- .../BUILD.gn | 8 ++--- .../corpus/init | 36 +++++++++---------- .../project.xml | 0 .../reporthangupinfo_fuzzer.cpp} | 4 +-- .../reporthangupinfo_fuzzer.h} | 8 ++--- .../satellitetest/zero_branch_test.cpp | 4 +-- 11 files changed, 51 insertions(+), 37 deletions(-) rename test/fuzztest/{reporthungupinfo_fuzzer => reporthangupinfo_fuzzer}/BUILD.gn (94%) rename test/fuzztest/{reporthungupinfo_fuzzer => reporthangupinfo_fuzzer}/corpus/init (97%) rename test/fuzztest/{reporthungupinfo_fuzzer => reporthangupinfo_fuzzer}/project.xml (100%) rename test/fuzztest/{reporthungupinfo_fuzzer/reporthungupinfo_fuzzer.cpp => reporthangupinfo_fuzzer/reporthangupinfo_fuzzer.cpp} (97%) rename test/fuzztest/{reporthungupinfo_fuzzer/reporthungupinfo_fuzzer.h => reporthangupinfo_fuzzer/reporthangupinfo_fuzzer.h} (79%) diff --git a/services/control/include/satellite_control.h b/services/control/include/satellite_control.h index 28208c5a..3fe363bb 100644 --- a/services/control/include/satellite_control.h +++ b/services/control/include/satellite_control.h @@ -153,14 +153,14 @@ public: int32_t ExecutePostDial(int32_t slotId, int64_t callId); int32_t PostDialProceed(const CellularCallInfo &callInfo, const bool proceed); -private: /** * Report being hung up data * * @return Error Code: Returns TELEPHONY_SUCCESS on success, others on failure. */ - int32_t ReportHungUpInfo(int32_t slotId); + int32_t ReportHangUpInfo(int32_t slotId); +private: /** * Report Incoming info * diff --git a/services/control/src/satellite_control.cpp b/services/control/src/satellite_control.cpp index ff604dfb..ec5c97a8 100644 --- a/services/control/src/satellite_control.cpp +++ b/services/control/src/satellite_control.cpp @@ -179,7 +179,7 @@ int32_t SatelliteControl::Reject(const CellularCallInfo &callInfo) int32_t SatelliteControl::ReportSatelliteCallsData(int32_t slotId, const SatelliteCurrentCallList &callInfoList) { if (callInfoList.callSize <= 0 && !connectionMap_.empty()) { - return ReportHungUpInfo(slotId); + return ReportHangUpInfo(slotId); } else if (callInfoList.callSize > 0 && connectionMap_.empty()) { return ReportIncomingInfo(slotId, callInfoList); } else if (callInfoList.callSize > 0 && !connectionMap_.empty()) { @@ -297,9 +297,9 @@ int32_t SatelliteControl::ReportIncomingInfo(int32_t slotId, const SatelliteCurr return TELEPHONY_SUCCESS; } -int32_t SatelliteControl::ReportHungUpInfo(int32_t slotId) +int32_t SatelliteControl::ReportHangUpInfo(int32_t slotId) { - TELEPHONY_LOGD("ReportHungUpInfo entry"); + TELEPHONY_LOGD("ReportHangUpInfo entry"); CallsReportInfo callsReportInfo; for (auto &it : connectionMap_) { CallReportInfo callReportInfo = it.second.GetCallReportInfo(); @@ -309,7 +309,7 @@ int32_t SatelliteControl::ReportHungUpInfo(int32_t slotId) GetCallFailReason(slotId, connectionMap_); } if (DelayedSingleton::GetInstance() == nullptr) { - TELEPHONY_LOGE("ReportHungUpInfo return, GetInstance() is nullptr."); + TELEPHONY_LOGE("ReportHangUpInfo return, GetInstance() is nullptr."); return TELEPHONY_ERR_LOCAL_PTR_NULL; } callsReportInfo.slotId = slotId; diff --git a/services/manager/src/cellular_call_handler.cpp b/services/manager/src/cellular_call_handler.cpp index 31df4e84..8fae6349 100755 --- a/services/manager/src/cellular_call_handler.cpp +++ b/services/manager/src/cellular_call_handler.cpp @@ -1730,6 +1730,14 @@ void CellularCallHandler::OnRilAdapterHostDied(const AppExecFwk::InnerEvent::Poi } else { serviceInstance->SetImsControl(slotId_, nullptr); } + auto satelliteControl = serviceInstance->GetSatelliteControl(slotId_); + if (satelliteControl == nullptr) { + TELEPHONY_LOGE("[slot%{public}d] satelliteControl is null", slotId_); + } else if (satelliteControl->ReportHangUpInfo(slotId_) != TELEPHONY_SUCCESS) { + TELEPHONY_LOGE("[slot%{public}d] fail to disconnect satellite calls", slotId_); + } else { + serviceInstance->SetSatelliteControl(slotId_, nullptr); + } } #ifdef CALL_MANAGER_AUTO_START_OPTIMIZE diff --git a/services/manager/src/cellular_call_service.cpp b/services/manager/src/cellular_call_service.cpp index 269866df..e4454d80 100755 --- a/services/manager/src/cellular_call_service.cpp +++ b/services/manager/src/cellular_call_service.cpp @@ -753,6 +753,9 @@ int32_t CellularCallService::SetReadyToCall(int32_t slotId, int32_t callType, bo if (GetImsControl(slotId) != nullptr) { GetImsControl(slotId)->SetReadyToCall(slotId, isReadyToCall); } + if (GetSatelliteControl(slotId) != nullptr) { + GetSatelliteControl(slotId)->SetReadyToCall(slotId, isReadyToCall); + } return TELEPHONY_SUCCESS; } @@ -764,6 +767,9 @@ int32_t CellularCallService::HangUpAllConnection(int32_t slotId) if (GetImsControl(slotId)) { GetImsControl(slotId)->HangUpAllConnection(slotId); } + if (GetSatelliteControl(slotId)) { + GetSatelliteControl(slotId)->HangUpAllConnection(slotId); + } return TELEPHONY_SUCCESS; } diff --git a/test/fuzztest/BUILD.gn b/test/fuzztest/BUILD.gn index 056fbae5..e7a2fb11 100644 --- a/test/fuzztest/BUILD.gn +++ b/test/fuzztest/BUILD.gn @@ -27,7 +27,7 @@ group("fuzztest") { deps += [ "registercallmanagercallback_fuzzer:fuzztest" ] deps += [ "imscallback_fuzzer:fuzztest" ] deps += [ "imsclient_fuzzer:fuzztest" ] - deps += [ "reporthungupinfo_fuzzer:fuzztest" ] + deps += [ "reporthangupinfo_fuzzer:fuzztest" ] deps += [ "separateconference_fuzzer:fuzztest" ] deps += [ "setorupdatecallreportinfo_fuzzer:fuzztest" ] deps += [ "satellitecallrequest_fuzzer:fuzztest" ] diff --git a/test/fuzztest/reporthungupinfo_fuzzer/BUILD.gn b/test/fuzztest/reporthangupinfo_fuzzer/BUILD.gn similarity index 94% rename from test/fuzztest/reporthungupinfo_fuzzer/BUILD.gn rename to test/fuzztest/reporthangupinfo_fuzzer/BUILD.gn index 90fa85e0..56e63354 100644 --- a/test/fuzztest/reporthungupinfo_fuzzer/BUILD.gn +++ b/test/fuzztest/reporthangupinfo_fuzzer/BUILD.gn @@ -18,11 +18,11 @@ import("//build/test.gni") CELLULAR_CALL_PATH = "../../.." ##############################fuzztest########################################## -ohos_fuzztest("ReportHungUpInfoFuzzTest") { +ohos_fuzztest("ReportHangUpInfoFuzzTest") { module_output_path = "cellular_call/cellular_call" module_out_path = module_output_path fuzz_config_file = - "${CELLULAR_CALL_PATH}/test/fuzztest/reporthungupinfo_fuzzer" + "${CELLULAR_CALL_PATH}/test/fuzztest/reporthangupinfo_fuzzer" include_dirs = [ "${CELLULAR_CALL_PATH}/test/fuzztest/common_fuzzer", @@ -76,7 +76,7 @@ ohos_fuzztest("ReportHungUpInfoFuzzTest") { ] sources = [ "${CELLULAR_CALL_PATH}/test/fuzztest/common_fuzzer/addcellularcalltoken_fuzzer.cpp", - "reporthungupinfo_fuzzer.cpp", + "reporthangupinfo_fuzzer.cpp", ] } @@ -86,7 +86,7 @@ group("fuzztest") { deps = [] deps += [ # deps file - ":ReportHungUpInfoFuzzTest", + ":ReportHangUpInfoFuzzTest", ] } ############################################################################### diff --git a/test/fuzztest/reporthungupinfo_fuzzer/corpus/init b/test/fuzztest/reporthangupinfo_fuzzer/corpus/init similarity index 97% rename from test/fuzztest/reporthungupinfo_fuzzer/corpus/init rename to test/fuzztest/reporthangupinfo_fuzzer/corpus/init index bcc283a9..07b0a5e3 100644 --- a/test/fuzztest/reporthungupinfo_fuzzer/corpus/init +++ b/test/fuzztest/reporthangupinfo_fuzzer/corpus/init @@ -1,19 +1,19 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * corpus is necessary - */ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * corpus is necessary + */ FUZZ \ No newline at end of file diff --git a/test/fuzztest/reporthungupinfo_fuzzer/project.xml b/test/fuzztest/reporthangupinfo_fuzzer/project.xml similarity index 100% rename from test/fuzztest/reporthungupinfo_fuzzer/project.xml rename to test/fuzztest/reporthangupinfo_fuzzer/project.xml diff --git a/test/fuzztest/reporthungupinfo_fuzzer/reporthungupinfo_fuzzer.cpp b/test/fuzztest/reporthangupinfo_fuzzer/reporthangupinfo_fuzzer.cpp similarity index 97% rename from test/fuzztest/reporthungupinfo_fuzzer/reporthungupinfo_fuzzer.cpp rename to test/fuzztest/reporthangupinfo_fuzzer/reporthangupinfo_fuzzer.cpp index d56a80bc..7f81bfad 100644 --- a/test/fuzztest/reporthungupinfo_fuzzer/reporthungupinfo_fuzzer.cpp +++ b/test/fuzztest/reporthangupinfo_fuzzer/reporthangupinfo_fuzzer.cpp @@ -13,7 +13,7 @@ * limitations under the License. */ -#include "reporthungupinfo_fuzzer.h" +#include "reporthangupinfo_fuzzer.h" #include #include @@ -80,7 +80,7 @@ void DoSomethingInterestingWithMyAPI(const uint8_t *data, size_t size) satelliteControl->HoldCall(slotId); satelliteControl->UnHoldCall(slotId); satelliteControl->SwitchCall(slotId); - satelliteControl->ReportHungUpInfo(slotId); + satelliteControl->ReportHangUpInfo(slotId); return; } } // namespace OHOS diff --git a/test/fuzztest/reporthungupinfo_fuzzer/reporthungupinfo_fuzzer.h b/test/fuzztest/reporthangupinfo_fuzzer/reporthangupinfo_fuzzer.h similarity index 79% rename from test/fuzztest/reporthungupinfo_fuzzer/reporthungupinfo_fuzzer.h rename to test/fuzztest/reporthangupinfo_fuzzer/reporthangupinfo_fuzzer.h index aa2051d6..bef4d2e7 100644 --- a/test/fuzztest/reporthungupinfo_fuzzer/reporthungupinfo_fuzzer.h +++ b/test/fuzztest/reporthangupinfo_fuzzer/reporthangupinfo_fuzzer.h @@ -13,9 +13,9 @@ * limitations under the License. */ -#ifndef REPORTHUNGUPINFO_FUZZER_H -#define REPORTHUNGUPINFO_FUZZER_H +#ifndef REPORTHANGUPINFO_FUZZER_H +#define REPORTHANGUPINFO_FUZZER_H -#define FUZZ_PROJECT_NAME "reporthungupinfo_fuzzer" +#define FUZZ_PROJECT_NAME "reporthangupinfo_fuzzer" -#endif // REPORTHUNGUPINFO_FUZZER_H +#endif // REPORTHANGUPINFO_FUZZER_H diff --git a/test/unittest/satellitetest/zero_branch_test.cpp b/test/unittest/satellitetest/zero_branch_test.cpp index 5d6b1616..01a47438 100644 --- a/test/unittest/satellitetest/zero_branch_test.cpp +++ b/test/unittest/satellitetest/zero_branch_test.cpp @@ -114,7 +114,7 @@ HWTEST_F(BranchTest, Telephony_CellularCallSatelliteControl_001, Function | Medi CallInfoList callInfoList; satelliteControl.ReportCallsData(SIM1_SLOTID, callInfoList); SatelliteCurrentCallList satellitecallInfoList; - satelliteControl.ReportHungUpInfo(SIM1_SLOTID); + satelliteControl.ReportHangUpInfo(SIM1_SLOTID); satelliteControl.ReportIncomingInfo(SIM1_SLOTID, satellitecallInfoList); satelliteControl.ReportUpdateInfo(SIM1_SLOTID, satellitecallInfoList); SatelliteCurrentCall CallInfo; @@ -144,7 +144,7 @@ HWTEST_F(BranchTest, Telephony_CellularCallSatelliteControl_002, Function | Medi CallsReportInfo callsReportInfo; auto connectionMap = satelliteControl.GetConnectionMap(); satelliteControl.connectionMap_.insert(std::make_pair(1, CellularCallConnectionSatellite())); - satelliteControl.ReportHungUpInfo(SIM1_SLOTID); + satelliteControl.ReportHangUpInfo(SIM1_SLOTID); satelliteControl.DeleteConnection(callsReportInfo, satellitecallInfoList); satelliteControl.ExecutePostDial(SIM1_SLOTID, 0); ASSERT_NE(satelliteControl.PostDialProceed(cellularCallInfo, true), TELEPHONY_SUCCESS); -- Gitee