diff --git a/services/control/include/ims_control.h b/services/control/include/ims_control.h index adcd081301dfa247ad15edc2ffc7645a44c5c431..b94a1cc28987e04cec8e389ff71359f2c4b6feaa 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 8858dba5b574b4e6dbbdf19e61fa3e20b12ab585..7703afa72eaee1e4ef58f038d32d69ae87546501 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 6f469b1bc19254f0413d1dffe998c231bf59462e..09c00aef21322667610ced33e428200ee9309332 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 88f39b7c0d5ca65ec01c7a16ca1106a9d4981dbe..5a7450ea442c12531e2e0dd261fdd3362359d60b 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);