1 /*
2  * Copyright (c) 2023-2024 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 "service_router_load_callback.h"
16 
17 #include "hilog_tag_wrapper.h"
18 #include "service_router_mgr_helper.h"
19 #include "system_ability_definition.h"
20 
21 namespace OHOS {
22 namespace AbilityRuntime {
OnLoadSystemAbilitySuccess(int32_t systemAbilityId,const sptr<IRemoteObject> & remoteObject)23 void ServiceRouterLoadCallback::OnLoadSystemAbilitySuccess(int32_t systemAbilityId,
24     const sptr<IRemoteObject> &remoteObject)
25 {
26     if (systemAbilityId != OHOS::SERVICE_ROUTER_MGR_SERVICE_ID) {
27         TAG_LOGE(AAFwkTag::SER_ROUTER,
28             "Not matched systemAbilityId: %{public}d", systemAbilityId);
29         return;
30     }
31     if (remoteObject == nullptr) {
32         TAG_LOGE(AAFwkTag::SER_ROUTER,
33             "null remoteObject, systemAbilityId: %{public}d", systemAbilityId);
34         return;
35     }
36     TAG_LOGI(AAFwkTag::SER_ROUTER, "SystemAbilityId: %{public}d", systemAbilityId);
37     ServiceRouterMgrHelper::GetInstance().FinishStartSASuccess(remoteObject);
38 }
39 
OnLoadSystemAbilityFail(int32_t systemAbilityId)40 void ServiceRouterLoadCallback::OnLoadSystemAbilityFail(int32_t systemAbilityId)
41 {
42     TAG_LOGE(AAFwkTag::SER_ROUTER, "SystemAbilityId: %{public}d", systemAbilityId);
43     ServiceRouterMgrHelper::GetInstance().FinishStartSAFail();
44 }
45 } // namespace AbilityRuntime
46 } // namespace OHOS
47