12dc7c57fSopenharmony_ci/*
22dc7c57fSopenharmony_ci * Copyright (c) 2021-2022 Huawei Device Co., Ltd.
32dc7c57fSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
42dc7c57fSopenharmony_ci * you may not use this file except in compliance with the License.
52dc7c57fSopenharmony_ci * You may obtain a copy of the License at
62dc7c57fSopenharmony_ci *
72dc7c57fSopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
82dc7c57fSopenharmony_ci *
92dc7c57fSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
102dc7c57fSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
112dc7c57fSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
122dc7c57fSopenharmony_ci * See the License for the specific language governing permissions and
132dc7c57fSopenharmony_ci * limitations under the License.
142dc7c57fSopenharmony_ci */
152dc7c57fSopenharmony_ci
162dc7c57fSopenharmony_ci#include "bms_death_recipient.h"
172dc7c57fSopenharmony_ci#include "bundle_manager_helper.h"
182dc7c57fSopenharmony_ci#include "event_log_wrapper.h"
192dc7c57fSopenharmony_ci#include "singleton.h"
202dc7c57fSopenharmony_ci
212dc7c57fSopenharmony_cinamespace OHOS {
222dc7c57fSopenharmony_cinamespace EventFwk {
232dc7c57fSopenharmony_civoid BMSDeathRecipient::OnRemoteDied(const wptr<IRemoteObject> &wptrDeath)
242dc7c57fSopenharmony_ci{
252dc7c57fSopenharmony_ci    EVENT_LOGI("bundle manager service died, remove the proxy object");
262dc7c57fSopenharmony_ci
272dc7c57fSopenharmony_ci    if (wptrDeath == nullptr) {
282dc7c57fSopenharmony_ci        EVENT_LOGE("wptrDeath is null");
292dc7c57fSopenharmony_ci        return;
302dc7c57fSopenharmony_ci    }
312dc7c57fSopenharmony_ci
322dc7c57fSopenharmony_ci    sptr<IRemoteObject> object = wptrDeath.promote();
332dc7c57fSopenharmony_ci    if (!object) {
342dc7c57fSopenharmony_ci        EVENT_LOGE("object is null");
352dc7c57fSopenharmony_ci        return;
362dc7c57fSopenharmony_ci    }
372dc7c57fSopenharmony_ci
382dc7c57fSopenharmony_ci    DelayedSingleton<BundleManagerHelper>::GetInstance()->ClearBundleManagerHelper();
392dc7c57fSopenharmony_ci}
402dc7c57fSopenharmony_ci}  // namespace EventFwk
412dc7c57fSopenharmony_ci}  // namespace OHOS