1 /*
2 * Copyright (c) 2021 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 "bundle_mgr_proxy.h"
17
18 #include "ipc_types.h"
19 #include "parcel.h"
20 #include "string_ex.h"
21
22 #include "appexecfwk_errors.h"
23 #include "bundle_constants.h"
24
25 namespace OHOS {
26 namespace AppExecFwk {
BundleMgrProxy(const sptr<IRemoteObject> & impl)27 BundleMgrProxy::BundleMgrProxy(const sptr<IRemoteObject> &impl) : IRemoteProxy<IBundleMgr>(impl)
28 {}
29
~BundleMgrProxy()30 BundleMgrProxy::~BundleMgrProxy()
31 {}
32
GetApplicationInfo(const std::string & appName,const ApplicationFlag flag,const int userId,ApplicationInfo & appInfo)33 bool BundleMgrProxy::GetApplicationInfo(
34 const std::string &appName, const ApplicationFlag flag, const int userId, ApplicationInfo &appInfo)
35 {
36 return true;
37 }
38
GetApplicationInfos(const ApplicationFlag flag,const int userId,std::vector<ApplicationInfo> & appInfos)39 bool BundleMgrProxy::GetApplicationInfos(
40 const ApplicationFlag flag, const int userId, std::vector<ApplicationInfo> &appInfos)
41 {
42 return true;
43 }
44
GetBundleInfo(const std::string & bundleName,const BundleFlag flag,BundleInfo & bundleInfo,int32_t userId)45 bool BundleMgrProxy::GetBundleInfo(
46 const std::string &bundleName, const BundleFlag flag, BundleInfo &bundleInfo, int32_t userId)
47 {
48 return true;
49 }
50
GetBundleInfos(const BundleFlag flag,std::vector<BundleInfo> & bundleInfos,int32_t userId)51 bool BundleMgrProxy::GetBundleInfos(
52 const BundleFlag flag, std::vector<BundleInfo> &bundleInfos, int32_t userId)
53 {
54 return true;
55 }
56
GetUidByBundleName(const std::string & bundleName,const int userId)57 int BundleMgrProxy::GetUidByBundleName(const std::string &bundleName, const int userId)
58 {
59 return 1;
60 }
61
GetAppIdByBundleName(const std::string & bundleName,const int userId)62 std::string BundleMgrProxy::GetAppIdByBundleName(const std::string &bundleName, const int userId)
63 {
64 return "appId";
65 }
66
GetBundleNameForUid(const int uid,std::string & bundleName)67 bool BundleMgrProxy::GetBundleNameForUid(const int uid, std::string &bundleName)
68 {
69 bundleName = "bundleName";
70 return true;
71 }
72
GetBundlesForUid(const int uid,std::vector<std::string> & bundleNames)73 bool BundleMgrProxy::GetBundlesForUid(const int uid, std::vector<std::string> &bundleNames)
74 {
75 return true;
76 }
77
GetNameForUid(const int uid,std::string & name)78 bool BundleMgrProxy::GetNameForUid(const int uid, std::string &name)
79 {
80 return true;
81 }
82
GetBundleGids(const std::string & bundleName,std::vector<int> & gids)83 bool BundleMgrProxy::GetBundleGids(const std::string &bundleName, std::vector<int> &gids)
84 {
85 return true;
86 }
87
GetAppType(const std::string & bundleName)88 std::string BundleMgrProxy::GetAppType(const std::string &bundleName)
89 {
90 return "Constants::EMPTY_STRING";
91 }
92
CheckIsSystemAppByUid(const int uid)93 bool BundleMgrProxy::CheckIsSystemAppByUid(const int uid)
94 {
95 return true;
96 }
97
GetBundleInfosByMetaData(const std::string & metaData,std::vector<BundleInfo> & bundleInfos)98 bool BundleMgrProxy::GetBundleInfosByMetaData(const std::string &metaData, std::vector<BundleInfo> &bundleInfos)
99 {
100 return true;
101 }
102
QueryAbilityInfo(const Want & want,AbilityInfo & abilityInfo)103 bool BundleMgrProxy::QueryAbilityInfo(const Want &want, AbilityInfo &abilityInfo)
104 {
105 return true;
106 }
107
QueryAbilityInfoByUri(const std::string & abilityUri,AbilityInfo & abilityInfo)108 bool BundleMgrProxy::QueryAbilityInfoByUri(const std::string &abilityUri, AbilityInfo &abilityInfo)
109 {
110 return true;
111 }
112
QueryKeepAliveBundleInfos(std::vector<BundleInfo> & bundleInfos)113 bool BundleMgrProxy::QueryKeepAliveBundleInfos(std::vector<BundleInfo> &bundleInfos)
114 {
115 return true;
116 }
117
GetAbilityLabel(const std::string & bundleName,const std::string & className)118 std::string BundleMgrProxy::GetAbilityLabel(const std::string &bundleName, const std::string &className)
119 {
120 return "reply.ReadString()";
121 }
122
GetBundleArchiveInfo(const std::string & hapFilePath,const BundleFlag flag,BundleInfo & bundleInfo)123 bool BundleMgrProxy::GetBundleArchiveInfo(const std::string &hapFilePath, const BundleFlag flag, BundleInfo &bundleInfo)
124 {
125 return true;
126 }
127
GetHapModuleInfo(const AbilityInfo & abilityInfo,HapModuleInfo & hapModuleInfo)128 bool BundleMgrProxy::GetHapModuleInfo(const AbilityInfo &abilityInfo, HapModuleInfo &hapModuleInfo)
129 {
130 return true;
131 }
132
GetLaunchWantForBundle(const std::string & bundleName,Want & want)133 bool BundleMgrProxy::GetLaunchWantForBundle(const std::string &bundleName, Want &want)
134 {
135 return true;
136 }
137
CheckPublicKeys(const std::string & firstBundleName,const std::string & secondBundleName)138 int BundleMgrProxy::CheckPublicKeys(const std::string &firstBundleName, const std::string &secondBundleName)
139 {
140 return 1;
141 }
142
CheckPermission(const std::string & bundleName,const std::string & permission)143 int BundleMgrProxy::CheckPermission(const std::string &bundleName, const std::string &permission)
144 {
145 return 1;
146 }
147
GetPermissionDef(const std::string & permissionName,PermissionDef & permissionDef)148 bool BundleMgrProxy::GetPermissionDef(const std::string &permissionName, PermissionDef &permissionDef)
149 {
150 return true;
151 }
152
GetAllPermissionGroupDefs(std::vector<PermissionDef> & permissionDefs)153 bool BundleMgrProxy::GetAllPermissionGroupDefs(std::vector<PermissionDef> &permissionDefs)
154 {
155 return true;
156 }
157
GetAppsGrantedPermissions(const std::vector<std::string> & permissions,std::vector<std::string> & appNames)158 bool BundleMgrProxy::GetAppsGrantedPermissions(
159 const std::vector<std::string> &permissions, std::vector<std::string> &appNames)
160 {
161 return true;
162 }
163
HasSystemCapability(const std::string & capName)164 bool BundleMgrProxy::HasSystemCapability(const std::string &capName)
165 {
166 return true;
167 }
168
GetSystemAvailableCapabilities(std::vector<std::string> & systemCaps)169 bool BundleMgrProxy::GetSystemAvailableCapabilities(std::vector<std::string> &systemCaps)
170 {
171 return true;
172 }
173
IsSafeMode()174 bool BundleMgrProxy::IsSafeMode()
175 {
176 return true;
177 }
178
CleanBundleDataFiles(const std::string & bundleName,const int userId)179 bool BundleMgrProxy::CleanBundleDataFiles(const std::string &bundleName, const int userId)
180 {
181 return true;
182 }
183
RegisterBundleStatusCallback(const sptr<IBundleStatusCallback> & bundleStatusCallback)184 bool BundleMgrProxy::RegisterBundleStatusCallback(const sptr<IBundleStatusCallback> &bundleStatusCallback)
185 {
186 return true;
187 }
188
ClearBundleStatusCallback(const sptr<IBundleStatusCallback> & bundleStatusCallback)189 bool BundleMgrProxy::ClearBundleStatusCallback(const sptr<IBundleStatusCallback> &bundleStatusCallback)
190 {
191 return true;
192 }
193
UnregisterBundleStatusCallback()194 bool BundleMgrProxy::UnregisterBundleStatusCallback()
195 {
196 return true;
197 }
198
DumpInfos(const DumpFlag flag,const std::string & bundleName,int32_t userId,std::string & result)199 bool BundleMgrProxy::DumpInfos(
200 const DumpFlag flag, const std::string &bundleName, int32_t userId, std::string &result)
201 {
202 return true;
203 }
204
IsApplicationEnabled(const std::string & bundleName)205 bool BundleMgrProxy::IsApplicationEnabled(const std::string &bundleName)
206 {
207 return true;
208 }
209
210
IsAbilityEnabled(const AbilityInfo & abilityInfo)211 bool BundleMgrProxy::IsAbilityEnabled(const AbilityInfo &abilityInfo)
212 {
213 return true;
214 }
215
GetAbilityIcon(const std::string & bundleName,const std::string & className)216 std::string BundleMgrProxy::GetAbilityIcon(const std::string &bundleName, const std::string &className)
217 {
218 return "AbilityIcon";
219 }
220
CanRequestPermission(const std::string & bundleName,const std::string & permissionName,const int userId)221 bool BundleMgrProxy::CanRequestPermission(
222 const std::string &bundleName, const std::string &permissionName, const int userId)
223 {
224 return true;
225 }
226
RequestPermissionFromUser(const std::string & bundleName,const std::string & permission,const int userId)227 bool BundleMgrProxy::RequestPermissionFromUser(
228 const std::string &bundleName, const std::string &permission, const int userId)
229 {
230 return true;
231 }
232
RegisterAllPermissionsChanged(const sptr<OnPermissionChangedCallback> & callback)233 bool BundleMgrProxy::RegisterAllPermissionsChanged(const sptr<OnPermissionChangedCallback> &callback)
234 {
235 return true;
236 }
237
RegisterPermissionsChanged(const std::vector<int> & uids,const sptr<OnPermissionChangedCallback> & callback)238 bool BundleMgrProxy::RegisterPermissionsChanged(
239 const std::vector<int> &uids, const sptr<OnPermissionChangedCallback> &callback)
240 {
241 return true;
242 }
243
UnregisterPermissionsChanged(const sptr<OnPermissionChangedCallback> & callback)244 bool BundleMgrProxy::UnregisterPermissionsChanged(const sptr<OnPermissionChangedCallback> &callback)
245 {
246 return true;
247 }
248
249 template<typename T>
GetParcelableInfo(IBundleMgr::Message code,MessageParcel & data,T & parcelableInfo)250 bool BundleMgrProxy::GetParcelableInfo(IBundleMgr::Message code, MessageParcel &data, T &parcelableInfo)
251 {
252 return true;
253 }
254
255 template<typename T>
GetParcelableInfos(IBundleMgr::Message code,MessageParcel & data,std::vector<T> & parcelableInfos)256 bool BundleMgrProxy::GetParcelableInfos(IBundleMgr::Message code, MessageParcel &data, std::vector<T> &parcelableInfos)
257 {
258 return true;
259 }
260
SendTransactCmd(IBundleMgr::Message code,MessageParcel & data,MessageParcel & reply)261 bool BundleMgrProxy::SendTransactCmd(IBundleMgr::Message code, MessageParcel &data, MessageParcel &reply)
262 {
263 return true;
264 }
265 } // namespace AppExecFwk
266 } // namespace OHOS
267