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