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 "call_ability_callback_death_recipient.h" 17 18 #include "telephony_log_wrapper.h" 19 #include "i_call_ability_callback.h" 20 #include "call_ability_report_proxy.h" 21 22 namespace OHOS { 23 namespace Telephony { CallAbilityCallbackDeathRecipient()24CallAbilityCallbackDeathRecipient::CallAbilityCallbackDeathRecipient() 25 { 26 TELEPHONY_LOGI("create CallAbilityCallbackDeathRecipient instance"); 27 } 28 ~CallAbilityCallbackDeathRecipient()29CallAbilityCallbackDeathRecipient::~CallAbilityCallbackDeathRecipient() 30 { 31 TELEPHONY_LOGI("destory CallAbilityCallbackDeathRecipient instance"); 32 } 33 OnRemoteDied(const OHOS::wptr<OHOS::IRemoteObject> & object)34void CallAbilityCallbackDeathRecipient::OnRemoteDied(const OHOS::wptr<OHOS::IRemoteObject> &object) 35 { 36 TELEPHONY_LOGI("callback service died, remove the proxy object"); 37 sptr<ICallAbilityCallback> callback = iface_cast<ICallAbilityCallback>(object.promote()); 38 if (callback == nullptr) { 39 TELEPHONY_LOGE("callback is nullptr"); 40 return; 41 } 42 auto report = DelayedSingleton<CallAbilityReportProxy>::GetInstance(); 43 if (report == nullptr) { 44 TELEPHONY_LOGE("report is nullptr"); 45 return; 46 } 47 report->UnRegisterCallBack(object.promote()); 48 } 49 } // namespace Telephony 50 } // namespace OHOS