1 /*
2  * Copyright (c) 2022 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 "module_update_load_callback.h"
16 
17 #include "module_update_kits_impl.h"
18 #include "log/log.h"
19 #include "system_ability_definition.h"
20 
21 namespace OHOS {
22 namespace SysInstaller {
23 using namespace Updater;
24 
OnLoadSystemAbilitySuccess(int32_t systemAbilityId,const sptr<IRemoteObject> & remoteObject)25 void ModuleUpdateLoadCallback::OnLoadSystemAbilitySuccess(int32_t systemAbilityId,
26     const sptr<IRemoteObject> &remoteObject)
27 {
28     LOG(INFO) << "OnLoadSystemAbilitySuccess systemAbilityId: " << systemAbilityId << " IRmoteObject result:" <<
29         ((remoteObject != nullptr) ? "true" : "false");
30     if (systemAbilityId != MODULE_UPDATE_SERVICE_ID) {
31         LOG(ERROR) << "start aystemabilityId is not sinkSAId!";
32         return;
33     }
34     if (remoteObject == nullptr) {
35         LOG(ERROR) << "remoteObject is null.";
36         return;
37     }
38     ModuleUpdateKits::GetInstance().LoadServiceSuccess();
39 }
40 
OnLoadSystemAbilityFail(int32_t systemAbilityId)41 void ModuleUpdateLoadCallback::OnLoadSystemAbilityFail(int32_t systemAbilityId)
42 {
43     LOG(INFO) << "OnLoadSystemAbilityFail systemAbilityId:" << systemAbilityId;
44     if (systemAbilityId != MODULE_UPDATE_SERVICE_ID) {
45         LOG(ERROR) << "start aystemabilityId is not sinkSAId!";
46         return;
47     }
48     ModuleUpdateKits::GetInstance().LoadServiceFail();
49 }
50 } // SysInstaller
51 } // OHOS