From b55f19c9bc86c1868211f9a4b7e8e026739498f6 Mon Sep 17 00:00:00 2001 From: z30048402 Date: Sat, 15 Mar 2025 10:23:25 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=9A=E8=AF=9D=E6=8C=82=E6=96=AD=E5=8E=9F?= =?UTF-8?q?=E5=9B=A0=E5=80=BC=E6=9F=A5=E8=AF=A2=E6=B5=81=E7=A8=8B=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: z30048402 --- services/control/include/ims_control.h | 8 +++- services/control/src/ims_control.cpp | 20 +++++----- .../manager/include/cellular_call_handler.h | 1 + .../manager/src/cellular_call_handler.cpp | 39 ++++++++++++------- 4 files changed, 44 insertions(+), 24 deletions(-) diff --git a/services/control/include/ims_control.h b/services/control/include/ims_control.h index adcd081..b94a1cc 100755 --- a/services/control/include/ims_control.h +++ b/services/control/include/ims_control.h @@ -164,7 +164,7 @@ public: * @param CallInfoList * @returns Error Code: Returns TELEPHONY_NO_ERROR on success, others on failure. */ - int32_t ReportImsCallsData(int32_t slotId, const ImsCurrentCallList &callInfoList, bool isNeedQuery = true); + int32_t ReportImsCallsData(int32_t slotId, const ImsCurrentCallList &callInfoList); /** * IMSControl ReportCallsData. @@ -201,6 +201,12 @@ public: void UpdateCallDisconnectReason(int32_t callId, RilDisconnectedReason reason); + /** + * Check whether the hang-up cause value needs to be queried. + * @return return true when hang-up cause needs to be queried. + */ + bool HandleEndCallReason(int32_t slotId, const ImsCurrentCallList ¤tCallList); + #ifdef BASE_POWER_IMPROVEMENT_FEATURE CellularCallInfo GetPendingEmcCallInfo(); bool isPendingEmcFlag(); diff --git a/services/control/src/ims_control.cpp b/services/control/src/ims_control.cpp index 8858dba..7703afa 100755 --- a/services/control/src/ims_control.cpp +++ b/services/control/src/ims_control.cpp @@ -398,22 +398,14 @@ ImsConnectionMap IMSControl::GetConnectionMap() return connectionMap_; } -int32_t IMSControl::ReportImsCallsData(int32_t slotId, const ImsCurrentCallList &callInfoList, bool isNeedQuery) +int32_t IMSControl::ReportImsCallsData(int32_t slotId, const ImsCurrentCallList &callInfoList) { std::lock_guard lock(connectionMapMutex_); if (callInfoList.callSize <= 0) { - if (isNeedQuery) { - GetCallFailReason(slotId, connectionMap_); - return TELEPHONY_SUCCESS; - } return ReportHangUpInfo(slotId); } else if (callInfoList.callSize > 0 && connectionMap_.empty()) { return ReportIncomingInfo(slotId, callInfoList); } else if (callInfoList.callSize > 0 && !connectionMap_.empty()) { - if (isNeedQuery) { - GetCallFailReason(slotId, connectionMap_); - return TELEPHONY_SUCCESS; - } return ReportUpdateInfo(slotId, callInfoList); } return TELEPHONY_ERROR; @@ -779,6 +771,16 @@ void IMSControl::UpdateCallDisconnectReason(int32_t callId, RilDisconnectedReaso } } +bool IMSControl::HandleEndCallReason(int32_t slotId, const ImsCurrentCallList ¤tCallList) +{ + std::lock_guard lock(connectionMapMutex_); + if (HasEndCallWithoutReason(currentCallList)) { + GetCallFailReason(slotId, connectionMap_); + return true; + } + return false; +} + #ifdef BASE_POWER_IMPROVEMENT_FEATURE CellularCallInfo IMSControl::GetPendingEmcCallInfo() { diff --git a/services/manager/include/cellular_call_handler.h b/services/manager/include/cellular_call_handler.h index 6f469b1..09c00ae 100755 --- a/services/manager/include/cellular_call_handler.h +++ b/services/manager/include/cellular_call_handler.h @@ -251,6 +251,7 @@ private: void HandleCallDisconnectReason(RilDisconnectedReason reason); void UpdateImsConfiguration(); void GetImsSwitchStatusRequest(); + void HandleEmptyCallList(const std::shared_ptr &imsControl, const ImsCurrentCall &imsCallInfo); /** * If radio state change get call manager service diff --git a/services/manager/src/cellular_call_handler.cpp b/services/manager/src/cellular_call_handler.cpp index 88f39b7..5a7450e 100755 --- a/services/manager/src/cellular_call_handler.cpp +++ b/services/manager/src/cellular_call_handler.cpp @@ -410,17 +410,7 @@ void CellularCallHandler::ReportImsCallsData(const ImsCurrentCallList &imsCallIn auto imsControl = serviceInstance->GetImsControl(slotId_); currentCallList_ = imsCallInfoList; if (imsCallInfoList.callSize == 0) { - if (imsControl == nullptr) { - TELEPHONY_LOGE("[slot%{public}d] ims_control is null", slotId_); - return; - } - bool hasEndCallWithoutReason = imsControl->HasEndCallWithoutReason(imsCallInfoList); - if (imsControl->ReportImsCallsData(slotId_, imsCallInfoList, hasEndCallWithoutReason) != TELEPHONY_SUCCESS) { - CellularCallIncomingFinishTrace(imsCallInfo.state); - } - if (!hasEndCallWithoutReason) { - serviceInstance->SetImsControl(slotId_, nullptr); - } + HandleEmptyCallList(imsControl, imsCallInfo); return; } if (srvccState_ == SrvccState::STARTED) { @@ -438,12 +428,33 @@ void CellularCallHandler::ReportImsCallsData(const ImsCurrentCallList &imsCallIn CellularCallIncomingFinishTrace(imsCallInfo.state); return; } - bool hasEndCallWithoutReason = imsControl->HasEndCallWithoutReason(imsCallInfoList); - if (imsControl->ReportImsCallsData(slotId_, imsCallInfoList, hasEndCallWithoutReason) != TELEPHONY_SUCCESS) { + if (imsControl->HandleEndCallReason(slotId_, imsCallInfoList)) { + return; + } + if (imsControl->ReportImsCallsData(slotId_, imsCallInfoList) != TELEPHONY_SUCCESS) { CellularCallIncomingFinishTrace(imsCallInfo.state); } } +void CellularCallHandler::HandleEmptyCallList(const std::shared_ptr &imsControl, + const ImsCurrentCall &imsCallInfo) +{ + if (imsControl == nullptr) { + TELEPHONY_LOGE("[slot%{public}d] ims_control is null", slotId_); + return; + } + if (imsControl->HandleEndCallReason(slotId_, currentCallList_)) { + return; + } + if (imsControl->ReportImsCallsData(slotId_, currentCallList_) != TELEPHONY_SUCCESS) { + CellularCallIncomingFinishTrace(imsCallInfo.state); + } + auto serviceInstance = DelayedSingleton::GetInstance(); + if (serviceInstance != nullptr) { + serviceInstance->SetImsControl(slotId_, nullptr); + } +} + void CellularCallHandler::GetCsCallsDataResponse(const AppExecFwk::InnerEvent::Pointer &event) { // Returns list of current calls of ME. If command succeeds but no calls are available, @@ -2007,7 +2018,7 @@ void CellularCallHandler::HandleCallDisconnectReason(RilDisconnectedReason reaso return; } imsControl->UpdateDisconnectedReason(currentCallList_, reason); - imsControl->ReportImsCallsData(slotId_, currentCallList_, false); + imsControl->ReportImsCallsData(slotId_, currentCallList_); if (currentCallList_.callSize == 0) { TELEPHONY_LOGW("all calls disconnected, set ims control to nullptr."); serviceInstance->SetImsControl(slotId_, nullptr); -- Gitee