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
16 #include "device_info_load.h"
17
18 #include "device_info_kits.h"
19 #include "system_ability_definition.h"
20
21 namespace OHOS {
22 namespace device_info {
DeviceInfoLoad()23 DeviceInfoLoad::DeviceInfoLoad()
24 {
25 }
26
OnLoadSystemAbilitySuccess(int32_t systemAbilityId,const sptr<IRemoteObject> & remoteObject)27 void DeviceInfoLoad::OnLoadSystemAbilitySuccess(int32_t systemAbilityId,
28 const sptr<IRemoteObject>& remoteObject)
29 {
30 DINFO_CHECK(systemAbilityId == SYSPARAM_DEVICE_SERVICE_ID, return,
31 "start systemabilityId is not deviceinfo! %d", systemAbilityId);
32 if (remoteObject == nullptr) {
33 DINFO_LOGI("OnLoadSystemAbilitySuccess but remote is null %d", systemAbilityId);
34 DeviceInfoKits::GetInstance().FinishStartSAFailed();
35 return;
36 }
37
38 DINFO_LOGI("OnLoadSystemAbilitySuccess start systemAbilityId: %d success!", systemAbilityId);
39 DeviceInfoKits::GetInstance().FinishStartSASuccess(remoteObject);
40 }
41
OnLoadSystemAbilityFail(int32_t systemAbilityId)42 void DeviceInfoLoad::OnLoadSystemAbilityFail(int32_t systemAbilityId)
43 {
44 DINFO_CHECK(systemAbilityId == SYSPARAM_DEVICE_SERVICE_ID, return,
45 "start systemabilityId is not deviceinfo! %d", systemAbilityId);
46
47 DINFO_LOGI("OnLoadSystemAbilityFail systemAbilityId: %d failed.", systemAbilityId);
48
49 DeviceInfoKits::GetInstance().FinishStartSAFailed();
50 }
51 } // namespace device_info
52 } // namespace OHOS
53