1 /*
2 * Copyright (c) 2023 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 "app_log_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 APP_LOGE("OnLoadSystemAbilitySuccess, not matched systemAbilityId: %{public}d", systemAbilityId);
28 return;
29 }
30 if (remoteObject == nullptr) {
31 APP_LOGE("OnLoadSystemAbilitySuccess, remoteObject is null, systemAbilityId: %{public}d", systemAbilityId);
32 return;
33 }
34 APP_LOGI("OnLoadSystemAbilitySuccess, systemAbilityId: %{public}d", systemAbilityId);
35 ServiceRouterMgrHelper::GetInstance().FinishStartSASuccess(remoteObject);
36 }
37
OnLoadSystemAbilityFail(int32_t systemAbilityId)38 void ServiceRouterLoadCallback::OnLoadSystemAbilityFail(int32_t systemAbilityId)
39 {
40 APP_LOGE("OnLoadSystemAbilitySuccess systemAbilityId: %{public}d", systemAbilityId);
41 ServiceRouterMgrHelper::GetInstance().FinishStartSAFail();
42 }
43 } // namespace AbilityRuntime
44 } // namespace OHOS
45