1 /* 2 * Copyright (C) 2021 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #include "cellular_call_callback.h" 17 18 #include "system_ability_definition.h" 19 #include "iservice_registry.h" 20 #include "telephony_log_wrapper.h" 21 22 namespace OHOS { 23 namespace Telephony { 24 CellularCallCallback::CellularCallCallback() = default; 25 26 CellularCallCallback::~CellularCallCallback() = default; 27 ClearCellularCallList(int32_t slotId)28void CellularCallCallback::ClearCellularCallList(int32_t slotId) 29 { 30 auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); 31 if (systemAbilityMgr == nullptr) { 32 TELEPHONY_LOGE("ClearCellularCallList return, Get ISystemAbilityManager failed."); 33 return; 34 } 35 auto remote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); 36 if (remote == nullptr) { 37 TELEPHONY_LOGE("ClearCellularCallList return, CellularCallService Remote service not exists."); 38 return; 39 } 40 TELEPHONY_LOGI("HangUpAllConnection for slotId[%{public}d]", slotId); 41 iface_cast<CellularCallInterface>(remote)->HangUpAllConnection(slotId); 42 } 43 } // namespace Telephony 44 } // namespace OHOS 45