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 #include "dump_on_demand_load.h"
16 #include "hilog_wrapper.h"
17 namespace OHOS {
18 namespace HiviewDFX {
19 static sptr<IRemoteObject> remoteObjectPtr = nullptr;
20
OnDemandLoadCallback()21 OnDemandLoadCallback::OnDemandLoadCallback()
22 {
23 }
24
~OnDemandLoadCallback()25 OnDemandLoadCallback::~OnDemandLoadCallback()
26 {
27 }
28
OnLoadSystemAbilitySuccess(int32_t systemAbilityId,const sptr<IRemoteObject> & remoteObject)29 void OnDemandLoadCallback::OnLoadSystemAbilitySuccess(int32_t systemAbilityId, const sptr<IRemoteObject> &remoteObject)
30 {
31 DUMPER_HILOGD(MODULE_CLIENT,
32 "debug|OnLoadSystemAbilitySuccess systemAbilityId:%{public}d IRemoteObject result:%{public}s", systemAbilityId,
33 ((remoteObject != nullptr) ? "succeed" : "failed"));
34 remoteObjectPtr = remoteObject;
35 }
36
OnLoadSystemAbilityFail(int32_t systemAbilityId)37 void OnDemandLoadCallback::OnLoadSystemAbilityFail(int32_t systemAbilityId)
38 {
39 DUMPER_HILOGD(MODULE_CLIENT, "debug|OnLoadSystemAbilityFail systemAbilityId:%{public}d", systemAbilityId);
40 remoteObjectPtr = nullptr;
41 }
42
GetLoadSystemAbilityRemoteObj()43 sptr<IRemoteObject> OnDemandLoadCallback::GetLoadSystemAbilityRemoteObj()
44 {
45 return remoteObjectPtr;
46 }
47 } // namespace HiviewDFX
48 } // namespace OHOS
49