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 <gtest/gtest.h>
17 #include "iservice_registry.h"
18 #include "system_ability_definition.h"
19 #include "system_ability_manager_proxy.h"
20
21 namespace OHOS {
22
GetInstance()23 SystemAbilityManagerClient& SystemAbilityManagerClient::GetInstance()
24 {
25 static auto instance = new SystemAbilityManagerClient();
26 return *instance;
27 }
28
GetSystemAbilityManager()29 sptr<ISystemAbilityManager> SystemAbilityManagerClient::GetSystemAbilityManager()
30 {
31 GTEST_LOG_(INFO) << "GetSystemAbilityManager: return nullptr";
32 return nullptr;
33 }
34
GetSystemAbility(int32_t systemAbilityId)35 sptr<IRemoteObject> SystemAbilityManagerProxy::GetSystemAbility(int32_t systemAbilityId)
36 {
37 GTEST_LOG_(INFO) << "GetSystemAbility(" << systemAbilityId << "): return nullptr";
38 return nullptr;
39 }
40
GetSystemAbility(int32_t systemAbilityId,const std::string & deviceId)41 sptr<IRemoteObject> SystemAbilityManagerProxy::GetSystemAbility(int32_t systemAbilityId,
42 const std::string& deviceId)
43 {
44 return GetSystemAbility(systemAbilityId);
45 }
46
CheckSystemAbilityWrapper(int32_t code,MessageParcel & data)47 sptr<IRemoteObject> SystemAbilityManagerProxy::CheckSystemAbilityWrapper(int32_t code, MessageParcel& data)
48 {
49 return nullptr;
50 }
51
CheckSystemAbility(int32_t systemAbilityId)52 sptr<IRemoteObject> SystemAbilityManagerProxy::CheckSystemAbility(int32_t systemAbilityId)
53 {
54 return nullptr;
55 }
56
CheckSystemAbility(int32_t systemAbilityId,const std::string & deviceId)57 sptr<IRemoteObject> SystemAbilityManagerProxy::CheckSystemAbility(int32_t systemAbilityId, const std::string& deviceId)
58 {
59 return nullptr;
60 }
61
CheckSystemAbility(int32_t systemAbilityId,bool & isExist)62 sptr<IRemoteObject> SystemAbilityManagerProxy::CheckSystemAbility(int32_t systemAbilityId, bool& isExist)
63 {
64 return nullptr;
65 }
66
AddOnDemandSystemAbilityInfo(int32_t systemAbilityId,const std::u16string & localAbilityManagerName)67 int32_t SystemAbilityManagerProxy::AddOnDemandSystemAbilityInfo(int32_t systemAbilityId,
68 const std::u16string& localAbilityManagerName)
69 {
70 return ERR_INVALID_VALUE;
71 }
72
RemoveSystemAbilityWrapper(int32_t code,MessageParcel & data)73 int32_t SystemAbilityManagerProxy::RemoveSystemAbilityWrapper(int32_t code, MessageParcel& data)
74 {
75 return ERR_INVALID_VALUE;
76 }
77
RemoveSystemAbility(int32_t systemAbilityId)78 int32_t SystemAbilityManagerProxy::RemoveSystemAbility(int32_t systemAbilityId)
79 {
80 return ERR_INVALID_VALUE;
81 }
82
ListSystemAbilities(unsigned int dumpFlags)83 std::vector<std::u16string> SystemAbilityManagerProxy::ListSystemAbilities(unsigned int dumpFlags)
84 {
85 std::vector<std::u16string> saNames;
86
87 return saNames;
88 }
89
SubscribeSystemAbility(int32_t systemAbilityId,const sptr<ISystemAbilityStatusChange> & listener)90 int32_t SystemAbilityManagerProxy::SubscribeSystemAbility(int32_t systemAbilityId,
91 const sptr<ISystemAbilityStatusChange>& listener)
92 {
93 return ERR_INVALID_VALUE;
94 }
95
UnSubscribeSystemAbility(int32_t systemAbilityId,const sptr<ISystemAbilityStatusChange> & listener)96 int32_t SystemAbilityManagerProxy::UnSubscribeSystemAbility(int32_t systemAbilityId,
97 const sptr<ISystemAbilityStatusChange>& listener)
98 {
99 return ERR_INVALID_VALUE;
100 }
101
LoadSystemAbility(int32_t systemAbilityId,const sptr<ISystemAbilityLoadCallback> & callback)102 int32_t SystemAbilityManagerProxy::LoadSystemAbility(int32_t systemAbilityId,
103 const sptr<ISystemAbilityLoadCallback>& callback)
104 {
105 return ERR_INVALID_VALUE;
106 }
107
UnloadSystemAbility(int32_t systemAbilityId)108 int32_t SystemAbilityManagerProxy::UnloadSystemAbility(int32_t systemAbilityId)
109 {
110 return ERR_INVALID_VALUE;
111 }
112
CancelUnloadSystemAbility(int32_t systemAbilityId)113 int32_t SystemAbilityManagerProxy::CancelUnloadSystemAbility(int32_t systemAbilityId)
114 {
115 return ERR_INVALID_VALUE;
116 }
117
LoadSystemAbility(int32_t systemAbilityId,const std::string & deviceId,const sptr<ISystemAbilityLoadCallback> & callback)118 int32_t SystemAbilityManagerProxy::LoadSystemAbility(int32_t systemAbilityId, const std::string& deviceId,
119 const sptr<ISystemAbilityLoadCallback>& callback)
120 {
121 return ERR_INVALID_VALUE;
122 }
123
AddSystemAbility(int32_t systemAbilityId,const sptr<IRemoteObject> & ability,const SAExtraProp & extraProp)124 int32_t SystemAbilityManagerProxy::AddSystemAbility(int32_t systemAbilityId, const sptr<IRemoteObject>& ability,
125 const SAExtraProp& extraProp)
126 {
127 return ERR_INVALID_VALUE;
128 }
129
AddSystemAbilityWrapper(int32_t code,MessageParcel & data)130 int32_t SystemAbilityManagerProxy::AddSystemAbilityWrapper(int32_t code, MessageParcel& data)
131 {
132 return ERR_INVALID_VALUE;
133 }
134
AddSystemProcess(const std::u16string & procName,const sptr<IRemoteObject> & procObject)135 int32_t SystemAbilityManagerProxy::AddSystemProcess(
136 const std::u16string& procName, const sptr<IRemoteObject>& procObject)
137 {
138 return ERR_INVALID_VALUE;
139 }
140
GetRunningSystemProcess(std::list<SystemProcessInfo> & systemProcessInfos)141 int32_t SystemAbilityManagerProxy::GetRunningSystemProcess(std::list<SystemProcessInfo>& systemProcessInfos)
142 {
143 return ERR_INVALID_VALUE;
144 }
145
SubscribeSystemProcess(const sptr<ISystemProcessStatusChange> & listener)146 int32_t SystemAbilityManagerProxy::SubscribeSystemProcess(const sptr<ISystemProcessStatusChange>& listener)
147 {
148 return ERR_INVALID_VALUE;
149 }
150
UnSubscribeSystemProcess(const sptr<ISystemProcessStatusChange> & listener)151 int32_t SystemAbilityManagerProxy::UnSubscribeSystemProcess(const sptr<ISystemProcessStatusChange>& listener)
152 {
153 return ERR_INVALID_VALUE;
154 }
155
GetOnDemandReasonExtraData(int64_t extraDataId,MessageParcel & extraDataParcel)156 int32_t SystemAbilityManagerProxy::GetOnDemandReasonExtraData(int64_t extraDataId, MessageParcel& extraDataParcel)
157 {
158 return ERR_INVALID_VALUE;
159 }
160
GetOnDemandPolicy(int32_t systemAbilityId,OnDemandPolicyType type,std::vector<SystemAbilityOnDemandEvent> & abilityOnDemandEvents)161 int32_t SystemAbilityManagerProxy::GetOnDemandPolicy(int32_t systemAbilityId, OnDemandPolicyType type,
162 std::vector<SystemAbilityOnDemandEvent>& abilityOnDemandEvents)
163 {
164 return ERR_INVALID_VALUE;
165 }
166
UpdateOnDemandPolicy(int32_t systemAbilityId,OnDemandPolicyType type,const std::vector<SystemAbilityOnDemandEvent> & sabilityOnDemandEvents)167 int32_t SystemAbilityManagerProxy::UpdateOnDemandPolicy(int32_t systemAbilityId, OnDemandPolicyType type,
168 const std::vector<SystemAbilityOnDemandEvent>& sabilityOnDemandEvents)
169 {
170 return ERR_INVALID_VALUE;
171 }
172 }