1 /*
2  * Copyright (c) 2021-2024 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 #ifndef FOUNDATION_APPEXECFWK_INTERFACES_INNERKITS_APPEXECFWK_CORE_INCLUDE_BUNDLEMGR_BUNDLE_MGR_PROXY_H
17 #define FOUNDATION_APPEXECFWK_INTERFACES_INNERKITS_APPEXECFWK_CORE_INCLUDE_BUNDLEMGR_BUNDLE_MGR_PROXY_H
18 
19 #include <string>
20 #include <vector>
21 
22 #include "bundle_event_callback_interface.h"
23 #include "bundle_framework_core_ipc_interface_code.h"
24 #include "bundle_mgr_interface.h"
25 #include "bundle_status_callback_interface.h"
26 #include "clean_cache_callback_interface.h"
27 #include "element_name.h"
28 #include "iremote_proxy.h"
29 #include "preinstalled_application_info.h"
30 
31 namespace OHOS {
32 namespace AppExecFwk {
33 
34 class BundleMgrProxy : public IRemoteProxy<IBundleMgr> {
35 public:
36     explicit BundleMgrProxy(const sptr<IRemoteObject> &impl);
37     virtual ~BundleMgrProxy() override;
38     /**
39      * @brief Obtains the ApplicationInfo based on a given bundle name through the proxy object.
40      * @param appName Indicates the application bundle name to be queried.
41      * @param flag Indicates the flag used to specify information contained
42      *             in the ApplicationInfo object that will be returned.
43      * @param userId Indicates the user ID.
44      * @param appInfo Indicates the obtained ApplicationInfo object.
45      * @return Returns true if the application is successfully obtained; returns false otherwise.
46      */
47     virtual bool GetApplicationInfo(
48         const std::string &appName, const ApplicationFlag flag, const int userId, ApplicationInfo &appInfo) override;
49     /**
50      * @brief Obtains the ApplicationInfo based on a given bundle name through the proxy object.
51      * @param appName Indicates the application bundle name to be queried.
52      * @param flags Indicates the flag used to specify information contained
53      *             in the ApplicationInfo object that will be returned.
54      * @param userId Indicates the user ID.
55      * @param appInfo Indicates the obtained ApplicationInfo object.
56      * @return Returns true if the application is successfully obtained; returns false otherwise.
57      */
58     virtual bool GetApplicationInfo(
59         const std::string &appName, int32_t flags, int32_t userId, ApplicationInfo &appInfo) override;
60     /**
61      * @brief Obtains the ApplicationInfo based on a given bundle name through the proxy object.
62      * @param appName Indicates the application bundle name to be queried.
63      * @param flags Indicates the flag used to specify information contained
64      *             in the ApplicationInfo object that will be returned.
65      * @param userId Indicates the user ID.
66      * @param appInfo Indicates the obtained ApplicationInfo object.
67      * @return Returns ERR_OK if the application is successfully obtained; returns error code otherwise.
68      */
69     virtual ErrCode GetApplicationInfoV9(
70         const std::string &appName, int32_t flags, int32_t userId, ApplicationInfo &appInfo) override;
71     /**
72      * @brief Obtains information about all installed applications of a specified user through the proxy object.
73      * @param flag Indicates the flag used to specify information contained
74      *             in the ApplicationInfo objects that will be returned.
75      * @param userId Indicates the user ID.
76      * @param appInfos Indicates all of the obtained ApplicationInfo objects.
77      * @return Returns true if the application is successfully obtained; returns false otherwise.
78      */
79     virtual bool GetApplicationInfos(
80         const ApplicationFlag flag, int userId, std::vector<ApplicationInfo> &appInfos) override;
81     /**
82      * @brief Obtains information about all installed applications of a specified user through the proxy object.
83      * @param flags Indicates the flag used to specify information contained
84      *             in the ApplicationInfo objects that will be returned.
85      * @param userId Indicates the user ID.
86      * @param appInfos Indicates all of the obtained ApplicationInfo objects.
87      * @return Returns true if the application is successfully obtained; returns false otherwise.
88      */
89     virtual bool GetApplicationInfos(
90         int32_t flags, int32_t userId, std::vector<ApplicationInfo> &appInfos) override;
91     /**
92      * @brief Obtains information about all installed applications of a specified user through the proxy object.
93      * @param flags Indicates the flag used to specify information contained
94      *             in the ApplicationInfo objects that will be returned.
95      * @param userId Indicates the user ID.
96      * @param appInfos Indicates all of the obtained ApplicationInfo objects.
97      * @return Returns ERR_OK if the application is successfully obtained; returns error code otherwise.
98      */
99     virtual ErrCode GetApplicationInfosV9(
100         int32_t flags, int32_t userId, std::vector<ApplicationInfo> &appInfos) override;
101     /**
102      * @brief Obtains the BundleInfo based on a given bundle name through the proxy object.
103      * @param bundleName Indicates the application bundle name to be queried.
104      * @param flag Indicates the information contained in the BundleInfo object to be returned.
105      * @param bundleInfo Indicates the obtained BundleInfo object.
106      * @param userId Indicates the user ID.
107      * @return Returns true if the BundleInfo is successfully obtained; returns false otherwise.
108      */
109     virtual bool GetBundleInfo(const std::string &bundleName, const BundleFlag flag,
110         BundleInfo &bundleInfo, int32_t userId = Constants::UNSPECIFIED_USERID) override;
111     /**
112      * @brief Obtains the BundleInfo based on a given bundle name through the proxy object.
113      * @param bundleName Indicates the application bundle name to be queried.
114      * @param flags Indicates the information contained in the BundleInfo object to be returned.
115      * @param bundleInfo Indicates the obtained BundleInfo object.
116      * @param userId Indicates the user ID.
117      * @return Returns true if the BundleInfo is successfully obtained; returns false otherwise.
118      */
119     virtual bool GetBundleInfo(const std::string &bundleName, int32_t flags,
120         BundleInfo &bundleInfo, int32_t userId = Constants::UNSPECIFIED_USERID) override;
121     /**
122      * @brief Obtains the BundleInfo based on a given bundle name through the proxy object.
123      * @param bundleName Indicates the application bundle name to be queried.
124      * @param flags Indicates the information contained in the BundleInfo object to be returned.
125      * @param bundleInfo Indicates the obtained BundleInfo object.
126      * @param userId Indicates the user ID.
127      * @return Returns ERR_OK if the BundleInfo is successfully obtained; returns error code otherwise.
128      */
129     virtual ErrCode GetBundleInfoV9(const std::string &bundleName, int32_t flags,
130         BundleInfo &bundleInfo, int32_t userId) override;
131     /**
132      * @brief Obtains the BundleInfos by the given want list through the proxy object.
133      * @param wants Indicates the imformation of the abilities to be queried.
134      * @param flags Indicates the information contained in the BundleInfo object to be returned.
135      * @param bundleInfos Indicates the obtained BundleInfo list object.
136      * @param userId Indicates the user ID.
137      * @return Returns ERR_OK if the BundleInfo is successfully obtained; returns error code otherwise.
138      */
139     virtual ErrCode BatchGetBundleInfo(const std::vector<Want> &wants, int32_t flags,
140         std::vector<BundleInfo> &bundleInfos, int32_t userId) override;
141     /**
142      * @brief Obtains the BundleInfos based on a given bundle name list through the proxy object.
143      * @param bundleNames Indicates the application bundle name list to be queried.
144      * @param flags Indicates the information contained in the BundleInfo object to be returned.
145      * @param bundleInfos Indicates the obtained BundleInfo list object.
146      * @param userId Indicates the user ID.
147      * @return Returns ERR_OK if the BundleInfo is successfully obtained; returns error code otherwise.
148      */
149     virtual ErrCode BatchGetBundleInfo(const std::vector<std::string> &bundleNames, int32_t flags,
150         std::vector<BundleInfo> &bundleInfos, int32_t userId) override;
151     /**
152      * @brief Obtains the BundleInfo based on calling uid.
153      * @param bundleName Indicates the application bundle name to be queried.
154      * @param flags Indicates the information contained in the BundleInfo object to be returned.
155      * @param bundleInfo Indicates the obtained BundleInfo object.
156      * @param userId Indicates the user ID.
157      * @return Returns ERR_OK if the BundleInfo is successfully obtained; returns error code otherwise.
158      */
159     virtual ErrCode GetBundleInfoForSelf(int32_t flags, BundleInfo &bundleInfo) override;
160     /**
161      * @brief Obtains the BundleInfo based on a given bundle name, which the calling app depends on.
162      * @param sharedBundleName Indicates the bundle name to be queried.
163      * @param sharedBundleInfo Indicates the obtained BundleInfo object.
164      * @param flag Indicates the flag, GetDependentBundleInfoFlag.
165      * @return Returns ERR_OK if the BundleInfo is successfully obtained; returns error code otherwise.
166      */
167     virtual ErrCode GetDependentBundleInfo(const std::string &sharedBundleName, BundleInfo &sharedBundleInfo,
168         GetDependentBundleInfoFlag flag = GetDependentBundleInfoFlag::GET_APP_CROSS_HSP_BUNDLE_INFO) override;
169     /**
170      * @brief Obtains the BundlePackInfo based on a given bundle name.
171      * @param bundleName Indicates the application bundle name to be queried.
172      * @param flags Indicates the information contained in the BundleInfo object to be returned.
173      * @param BundlePackInfo Indicates the obtained BundlePackInfo object.
174      * @param userId Indicates the user ID.
175      * @return Returns ERR_OK if the BundlePackInfo is successfully obtained; returns other ErrCode otherwise.
176      */
177     virtual ErrCode GetBundlePackInfo(const std::string &bundleName, const BundlePackFlag flags,
178         BundlePackInfo &bundlePackInfo, int32_t userId = Constants::UNSPECIFIED_USERID) override;
179     /**
180      * @brief Obtains the BundlePackInfo based on a given bundle name.
181      * @param bundleName Indicates the application bundle name to be queried.
182      * @param flags Indicates the information contained in the BundleInfo object to be returned.
183      * @param BundlePackInfo Indicates the obtained BundlePackInfo object.
184      * @param userId Indicates the user ID.
185      * @return Returns ERR_OK if the BundlePackInfo is successfully obtained; returns other ErrCode otherwise.
186      */
187     virtual ErrCode GetBundlePackInfo(const std::string &bundleName, int32_t flags,
188         BundlePackInfo &bundlePackInfo, int32_t userId = Constants::UNSPECIFIED_USERID) override;
189     /**
190      * @brief Obtains BundleInfo of all bundles available in the system through the proxy object.
191      * @param flag Indicates the flag used to specify information contained in the BundleInfo that will be returned.
192      * @param bundleInfos Indicates all of the obtained BundleInfo objects.
193      * @param userId Indicates the user ID.
194      * @return Returns true if the BundleInfos is successfully obtained; returns false otherwise.
195      */
196     virtual bool GetBundleInfos(const BundleFlag flag, std::vector<BundleInfo> &bundleInfos,
197         int32_t userId = Constants::UNSPECIFIED_USERID) override;
198     /**
199      * @brief Obtains BundleInfo of all bundles available in the system through the proxy object.
200      * @param flags Indicates the flag used to specify information contained in the BundleInfo that will be returned.
201      * @param bundleInfos Indicates all of the obtained BundleInfo objects.
202      * @param userId Indicates the user ID.
203      * @return Returns true if the BundleInfos is successfully obtained; returns false otherwise.
204      */
205     virtual bool GetBundleInfos(int32_t flags, std::vector<BundleInfo> &bundleInfos,
206         int32_t userId = Constants::UNSPECIFIED_USERID) override;
207     /**
208      * @brief Obtains BundleInfo of all bundles available in the system through the proxy object.
209      * @param flags Indicates the flag used to specify information contained in the BundleInfo that will be returned.
210      * @param bundleInfos Indicates all of the obtained BundleInfo objects.
211      * @param userId Indicates the user ID.
212      * @return Returns ERR_OK if the BundleInfos is successfully obtained; returns error code otherwise.
213      */
214     virtual ErrCode GetBundleInfosV9(int32_t flags, std::vector<BundleInfo> &bundleInfos, int32_t userId) override;
215     /**
216      * @brief Obtains the application UID based on the given bundle name and user ID through the proxy object.
217      * @param bundleName Indicates the bundle name of the application.
218      * @param userId Indicates the user ID.
219      * @return Returns the uid if successfully obtained; returns -1 otherwise.
220      */
221     virtual int GetUidByBundleName(const std::string &bundleName, const int userId) override;
222     /**
223      * @brief Obtains the application UID based on the given bundle name and user ID through the proxy object.
224      * @param bundleName Indicates the bundle name of the application.
225      * @param userId Indicates the user ID.
226      * @param userId Indicates the app Index.
227      * @return Returns the uid if successfully obtained; returns -1 otherwise.
228      */
229     virtual int32_t GetUidByBundleName(const std::string &bundleName, const int32_t userId, int32_t appIndex) override;
230     /**
231      * @brief Obtains the debug application UID based on the given bundle name and user ID through the proxy object.
232      * @param bundleName Indicates the bundle name of the application.
233      * @param userId Indicates the user ID.
234      * @return Returns the uid if successfully obtained; returns -1 otherwise.
235      */
236     virtual int GetUidByDebugBundleName(const std::string &bundleName, const int userId) override;
237 
238     /**
239      * @brief Obtains the application ID based on the given bundle name and user ID.
240      * @param bundleName Indicates the bundle name of the application.
241      * @param userId Indicates the user ID.
242      * @return Returns the application ID if successfully obtained; returns empty string otherwise.
243      */
244     virtual std::string GetAppIdByBundleName(const std::string &bundleName, const int userId) override;
245     /**
246      * @brief Obtains the bundle name of a specified application based on the given UID through the proxy object.
247      * @param uid Indicates the uid.
248      * @param bundleName Indicates the obtained bundle name.
249      * @return Returns true if the bundle name is successfully obtained; returns false otherwise.
250      */
251     virtual bool GetBundleNameForUid(const int uid, std::string &bundleName) override;
252     /**
253      * @brief Obtains all bundle names of a specified application based on the given application UID the proxy object.
254      * @param uid Indicates the uid.
255      * @param bundleNames Indicates the obtained bundle names.
256      * @return Returns true if the bundle names is successfully obtained; returns false otherwise.
257      */
258     virtual bool GetBundlesForUid(const int uid, std::vector<std::string> &bundleNames) override;
259     /**
260      * @brief Obtains the formal name associated with the given UID.
261      * @param uid Indicates the uid.
262      * @param name Indicates the obtained formal name.
263      * @return Returns ERR_OK if execute success; returns errCode otherwise.
264      */
265     virtual ErrCode GetNameForUid(const int uid, std::string &name) override;
266     /**
267      * @brief Obtains the formal name associated with the given UID.
268      * @param uid Indicates the uid.
269      * @param name Indicates the obtained formal bundleName.
270      * @param name Indicates the obtained appIndex.
271      * @return Returns ERR_OK if execute success; returns errCode otherwise.
272      */
273     virtual ErrCode GetNameAndIndexForUid(const int32_t uid, std::string &bundleName, int32_t &appIndex) override;
274     /**
275      * @brief Obtains an array of all group IDs associated with a specified bundle through the proxy object.
276      * @param bundleName Indicates the bundle name.
277      * @param gids Indicates the group IDs associated with the specified bundle.
278      * @return Returns true if the gids is successfully obtained; returns false otherwise.
279      */
280     virtual bool GetBundleGids(const std::string &bundleName, std::vector<int> &gids) override;
281     /**
282      * @brief Obtains an array of all group IDs associated with the given bundle name and UID.
283      * @param bundleName Indicates the bundle name.
284      * @param uid Indicates the uid.
285      * @param gids Indicates the group IDs associated with the specified bundle.
286      * @return Returns true if the gids is successfully obtained; returns false otherwise.
287      */
288     virtual bool GetBundleGidsByUid(const std::string &bundleName, const int &uid, std::vector<int> &gids) override;
289     /**
290      * @brief Obtains the type of a specified application based on the given bundle name through the proxy object.
291      * @param bundleName Indicates the bundle name.
292      * @return Returns "system" if the bundle is a system application; returns "third-party" otherwise.
293      */
294     virtual std::string GetAppType(const std::string &bundleName) override;
295     /**
296      * @brief Check whether the app is system app by it's UID through the proxy object.
297      * @param uid Indicates the uid.
298      * @return Returns true if the bundle is a system application; returns false otherwise.
299      */
300     virtual bool CheckIsSystemAppByUid(const int uid) override;
301     /**
302      * @brief Obtains the BundleInfo of application bundles based on the specified metaData through the proxy object.
303      * @param metaData Indicates the metadata to get in the bundle.
304      * @param bundleInfos Indicates all of the obtained BundleInfo objects.
305      * @return Returns true if the BundleInfos is successfully obtained; returns false otherwise.
306      */
307     virtual bool GetBundleInfosByMetaData(const std::string &metaData, std::vector<BundleInfo> &bundleInfos) override;
308     /**
309      * @brief Query the AbilityInfo by the given Want through the proxy object.
310      * @param want Indicates the information of the ability.
311      * @param abilityInfo Indicates the obtained AbilityInfo object.
312      * @return Returns true if the AbilityInfo is successfully obtained; returns false otherwise.
313      */
314     virtual bool QueryAbilityInfo(const Want &want, AbilityInfo &abilityInfo) override;
315     /**
316      * @brief Query the AbilityInfo by the given Want.
317      * @param want Indicates the information of the ability.
318      * @param flags Indicates the information contained in the AbilityInfo object to be returned.
319      * @param userId Indicates the user ID.
320      * @param abilityInfo Indicates the obtained AbilityInfo object.
321      * @param callBack Indicates the callback to be invoked for return ability manager service the operation result.
322      * @return Returns true if the AbilityInfo is successfully obtained; returns false otherwise.
323      */
324     virtual bool QueryAbilityInfo(const Want &want, int32_t flags, int32_t userId,
325         AbilityInfo &abilityInfo, const sptr<IRemoteObject> &callBack) override;
326     /**
327      * @brief Silent install by the given Want.
328      * @param want Indicates the information of the want.
329      * @param userId Indicates the user ID.
330      * @param callBack Indicates the callback to be invoked for return the operation result.
331      * @return Returns true if silent install successfully; returns false otherwise.
332      */
333     virtual bool SilentInstall(const Want &want, int32_t userId, const sptr<IRemoteObject> &callBack) override;
334     /**
335      * @brief Upgrade atomic service
336      * @param want Indicates the information of the ability.
337      * @param userId Indicates the user ID.
338      */
339     virtual void UpgradeAtomicService(const Want &want, int32_t userId) override;
340     /**
341      * @brief Query the AbilityInfo by the given Want.
342      * @param want Indicates the information of the ability.
343      * @param flags Indicates the information contained in the AbilityInfo object to be returned.
344      * @param userId Indicates the user ID.
345      * @param abilityInfo Indicates the obtained AbilityInfo object.
346      * @return Returns true if the AbilityInfo is successfully obtained; returns false otherwise.
347      */
348     virtual bool QueryAbilityInfo(const Want &want, int32_t flags, int32_t userId, AbilityInfo &abilityInfo) override;
349     /**
350      * @brief Query the AbilityInfo of list by the given Want.
351      * @param want Indicates the information of the ability.
352      * @param abilityInfos Indicates the obtained AbilityInfos object.
353      * @return Returns true if the AbilityInfos is successfully obtained; returns false otherwise.
354      */
355     virtual bool QueryAbilityInfos(const Want &want, std::vector<AbilityInfo> &abilityInfos) override;
356     /**
357      * @brief Query the AbilityInfo of list by the given Want.
358      * @param want Indicates the information of the ability.
359      * @param flags Indicates the information contained in the AbilityInfo object to be returned.
360      * @param userId Indicates the user ID.
361      * @param abilityInfos Indicates the obtained AbilityInfos object.
362      * @return Returns true if the AbilityInfos is successfully obtained; returns false otherwise.
363      */
364     virtual bool QueryAbilityInfos(
365         const Want &want, int32_t flags, int32_t userId, std::vector<AbilityInfo> &abilityInfos) override;
366     /**
367      * @brief Query the AbilityInfo of list by the given Want.
368      * @param want Indicates the information of the ability.
369      * @param flags Indicates the information contained in the AbilityInfo object to be returned.
370      * @param userId Indicates the user ID.
371      * @param abilityInfos Indicates the obtained AbilityInfos object.
372      * @return Returns ERR_OK if the AbilityInfos is successfully obtained; returns errCode otherwise.
373      */
374     virtual ErrCode QueryAbilityInfosV9(
375         const Want &want, int32_t flags, int32_t userId, std::vector<AbilityInfo> &abilityInfos) override;
376     /**
377      * @brief Query the AbilityInfo of list by the given Wants.
378      * @param wants Indicates the information of the abilities.
379      * @param flags Indicates the information contained in the AbilityInfo object to be returned.
380      * @param userId Indicates the user ID.
381      * @param abilityInfos Indicates the obtained AbilityInfos object.
382      * @return Returns ERR_OK if the AbilityInfos is successfully obtained; returns errCode otherwise.
383      */
384     virtual ErrCode BatchQueryAbilityInfos(const std::vector<Want> &wants, int32_t flags, int32_t userId,
385         std::vector<AbilityInfo> &abilityInfos) override;
386     /**
387      * @brief Query the launcher AbilityInfo of list by the given Want.
388      * @param want Indicates the information of the ability.
389      * @param userId Indicates the user ID.
390      * @param abilityInfos Indicates the obtained AbilityInfos object.
391      * @return Returns ERR_OK if the AbilityInfos is successfully obtained; returns errCode otherwise.
392      */
393     virtual ErrCode QueryLauncherAbilityInfos(
394         const Want &want, int32_t userId, std::vector<AbilityInfo> &abilityInfo) override;
395     /**
396      * @brief Query the AbilityInfo of list for all service on launcher.
397      * @param userId Indicates the information of the user.
398      * @param abilityInfos Indicates the obtained AbilityInfos object.
399      * @return Returns true if the AbilityInfos is successfully obtained; returns false otherwise.
400      */
401     virtual bool QueryAllAbilityInfos(
402         const Want &want, int32_t userId, std::vector<AbilityInfo> &abilityInfos) override;
403     /**
404      * @brief Query the AbilityInfo by ability.uri in config.json through the proxy object.
405      * @param abilityUri Indicates the uri of the ability.
406      * @param abilityInfo Indicates the obtained AbilityInfo object.
407      * @return Returns true if the AbilityInfo is successfully obtained; returns false otherwise.
408      */
409     virtual bool QueryAbilityInfoByUri(const std::string &abilityUri, AbilityInfo &abilityInfo) override;
410     /**
411      * @brief Query the AbilityInfo by ability.uri in config.json.
412      * @param abilityUri Indicates the uri of the ability.
413      * @param abilityInfos Indicates the obtained AbilityInfos object.
414      * @return Returns true if the AbilityInfo is successfully obtained; returns false otherwise.
415      */
416     virtual bool QueryAbilityInfosByUri(const std::string &abilityUri, std::vector<AbilityInfo> &abilityInfos) override;
417     /**
418      * @brief Query the AbilityInfo by ability.uri in config.json through the proxy object.
419      * @param abilityUri Indicates the uri of the ability.
420      * @param userId Indicates the user ID.
421      * @param abilityInfo Indicates the obtained AbilityInfo object.
422      * @return Returns true if the AbilityInfo is successfully obtained; returns false otherwise.
423      */
424     virtual bool QueryAbilityInfoByUri(
425         const std::string &abilityUri, int32_t userId, AbilityInfo &abilityInfo) override;
426     /**
427      * @brief Obtains the BundleInfo of all keep-alive applications in the system through the proxy object.
428      * @param bundleInfos Indicates all of the obtained BundleInfo objects.
429      * @return Returns true if the BundleInfos is successfully obtained; returns false otherwise.
430      */
431     virtual bool QueryKeepAliveBundleInfos(std::vector<BundleInfo> &bundleInfos) override;
432     /**
433      * @brief Obtains the label of a specified ability through the proxy object.
434      * @param bundleName Indicates the bundle name.
435      * @param abilityName Indicates the ability name.
436      * @return Returns the label of the ability if exist; returns empty string otherwise.
437      */
438     virtual std::string GetAbilityLabel(const std::string &bundleName, const std::string &abilityName) override;
439     /**
440      * @brief Obtains the label of a specified ability through the proxy object.
441      * @param bundleName Indicates the bundle name.
442      * @param moduleName Indicates the module name.
443      * @param abilityName Indicates the ability name.
444      * @param label Indicates the obtained label.
445      * @return Returns ERR_OK if called successfully; returns error code otherwise.
446      */
447     virtual ErrCode GetAbilityLabel(const std::string &bundleName, const std::string &moduleName,
448         const std::string &abilityName, std::string &label) override;
449     /**
450      * @brief Obtains information about an application bundle contained
451      *          in an ohos Ability Package (HAP) through the proxy object.
452      * @param hapFilePath Indicates the absolute file path of the HAP.
453      * @param flag Indicates the information contained in the BundleInfo object to be returned.
454      * @param bundleInfo Indicates the obtained BundleInfo object.
455      * @return Returns true if the BundleInfo is successfully obtained; returns false otherwise.
456      */
457     virtual bool GetBundleArchiveInfo(
458         const std::string &hapFilePath, const BundleFlag flag, BundleInfo &bundleInfo) override;
459     /**
460      * @brief Obtains information about an application bundle contained
461      *          in an ohos Ability Package (HAP) through the proxy object.
462      * @param hapFilePath Indicates the absolute file path of the HAP.
463      * @param flags Indicates the information contained in the BundleInfo object to be returned.
464      * @param bundleInfo Indicates the obtained BundleInfo object.
465      * @return Returns true if the BundleInfo is successfully obtained; returns false otherwise.
466      */
467     virtual bool GetBundleArchiveInfo(
468         const std::string &hapFilePath, int32_t flags, BundleInfo &bundleInfo) override;
469     /**
470      * @brief Obtains information about an application bundle contained
471      *          in an ohos Ability Package (HAP) through the proxy object.
472      * @param hapFilePath Indicates the absolute file path of the HAP.
473      * @param flags Indicates the information contained in the BundleInfo object to be returned.
474      * @param bundleInfo Indicates the obtained BundleInfo object.
475      * @return Returns ERR_OK if this function is successfully called; returns errCode otherwise.
476      */
477     virtual ErrCode GetBundleArchiveInfoV9(
478         const std::string &hapFilePath, int32_t flags, BundleInfo &bundleInfo) override;
479     /**
480      * @brief Obtain the HAP module info of a specific ability through the proxy object.
481      * @param abilityInfo Indicates the ability.
482      * @param hapModuleInfo Indicates the obtained HapModuleInfo object.
483      * @return Returns true if the HapModuleInfo is successfully obtained; returns false otherwise.
484      */
485     virtual bool GetHapModuleInfo(const AbilityInfo &abilityInfo, HapModuleInfo &hapModuleInfo) override;
486     /**
487      * @brief Obtain the HAP module info of a specific ability through the proxy object.
488      * @param abilityInfo Indicates the ability.
489      * @param userId Indicates the userId.
490      * @param hapModuleInfo Indicates the obtained HapModuleInfo object.
491      * @return Returns true if the HapModuleInfo is successfully obtained; returns false otherwise.
492      */
493     virtual bool GetHapModuleInfo(
494         const AbilityInfo &abilityInfo, int32_t userId, HapModuleInfo &hapModuleInfo) override;
495     /**
496      * @brief Obtains the Want for starting the main ability of an application
497      *          based on the given bundle name through the proxy object.
498      * @param bundleName Indicates the bundle name.
499      * @param want Indicates the obtained launch Want object.
500      * @param userId Indicates the userId.
501      * @return Returns ERR_OK if this function is successfully called; returns errCode otherwise.
502      */
503     virtual ErrCode GetLaunchWantForBundle(
504         const std::string &bundleName, Want &want, int32_t userId = Constants::UNSPECIFIED_USERID) override;
505     /**
506      * @brief Obtains detailed information about a specified permission through the proxy object.
507      * @param permissionName Indicates the name of the ohos permission.
508      * @param permissionDef Indicates the object containing detailed information about the given ohos permission.
509      * @return Returns ERR_OK if the PermissionDef object is successfully obtained; returns other ErrCode otherwise.
510      */
511     virtual ErrCode GetPermissionDef(const std::string &permissionName, PermissionDef &permissionDef) override;
512     /**
513      * @brief Clears cache data of a specified size through the proxy object.
514      * @param cacheSize Indicates the size of the cache data is to be cleared.
515      * @return Returns ERR_OK if this function is successfully called; returns other ErrCode otherwise.
516      */
517     virtual ErrCode CleanBundleCacheFilesAutomatic(uint64_t cacheSize) override;
518     /**
519      * @brief Clears cache data of a specified application through the proxy object.
520      * @param bundleName Indicates the bundle name of the application whose cache data is to be cleared.
521      * @param cleanCacheCallback Indicates the callback to be invoked for returning the operation result.
522      * @param userId description the user id.
523      * @param appIndex Indicates the app index.
524      * @return Returns ERR_OK if this function is successfully called; returns other ErrCode otherwise.
525      */
526     virtual ErrCode CleanBundleCacheFiles(
527         const std::string &bundleName, const sptr<ICleanCacheCallback> cleanCacheCallback,
528         int32_t userId = Constants::UNSPECIFIED_USERID, int32_t appIndex = 0) override;
529     /**
530      * @brief Clears application running data of a specified application through the proxy object.
531      * @param bundleName Indicates the bundle name of the application whose data is to be cleared.
532      * @param userId Indicates the user id.
533      * @param appIndex Indicates the app index.
534      * @return Returns true if the data cleared successfully; returns false otherwise.
535      */
536     virtual bool CleanBundleDataFiles(const std::string &bundleName, const int userId = 0,
537         const int appIndex = 0) override;
538     /**
539      * @brief Register the specific bundle status callback through the proxy object.
540      * @param bundleStatusCallback Indicates the callback to be invoked for returning the bundle status changed result.
541      * @return Returns true if this function is successfully called; returns false otherwise.
542      */
543     virtual bool RegisterBundleStatusCallback(const sptr<IBundleStatusCallback> &bundleStatusCallback) override;
544 
545     virtual bool RegisterBundleEventCallback(const sptr<IBundleEventCallback> &bundleEventCallback) override;
546 
547     virtual bool UnregisterBundleEventCallback(const sptr<IBundleEventCallback> &bundleEventCallback) override;
548     /**
549      * @brief Clear the specific bundle status callback through the proxy object.
550      * @param bundleStatusCallback Indicates the callback to be cleared.
551      * @return Returns true if this function is successfully called; returns false otherwise.
552      */
553     virtual bool ClearBundleStatusCallback(const sptr<IBundleStatusCallback> &bundleStatusCallback) override;
554     /**
555      * @brief Unregister all the callbacks of status changed through the proxy object.
556      * @return Returns true if this function is successfully called; returns false otherwise.
557      */
558     virtual bool UnregisterBundleStatusCallback() override;
559     /**
560      * @brief Dump the bundle informations with specific flags through the proxy object.
561      * @param flag Indicates the information contained in the dump result.
562      * @param bundleName Indicates the bundle name if needed.
563      * @param userId Indicates the user ID.
564      * @param result Indicates the dump information result.
565      * @return Returns true if the dump result is successfully obtained; returns false otherwise.
566      */
567     virtual bool DumpInfos(
568         const DumpFlag flag, const std::string &bundleName, int32_t userId, std::string &result) override;
569     /**
570      * @brief Compile the bundle informations with specific flags through the proxy object.
571      * @param bundleName Indicates the bundle name if needed.
572      * @param compileMode Indicates the mode name.
573      * @param isAllBundle Does it represent all bundlenames.
574      * @return Returns result of the operation.
575      */
576     virtual ErrCode CompileProcessAOT(const std::string &bundleName, const std::string &compileMode,
577         bool isAllBundle, std::vector<std::string> &compileResults) override;
578     /**
579      * @brief Reset the bundle informations with specific flags through the proxy object.
580      * @param bundleName Indicates the bundle name if needed.
581      * @param isAllBundle Does it represent all bundlenames.
582      * @return Returns result of the operation.
583      */
584     virtual ErrCode CompileReset(const std::string &bundleName, bool isAllBundle) override;
585     /**
586      * @brief copy ap file to /data/local/pgo through the proxy object.
587      * @param bundleName Indicates the bundle name if needed.
588      * @param isAllBundle Does it represent all bundlenames.
589      * @param results Indicates the copy ap information result.
590      * @return Returns ERR_OK if called successfully; returns error code otherwise.
591      */
592     virtual ErrCode CopyAp(const std::string &bundleName, bool isAllBundle, std::vector<std::string> &results) override;
593     /**
594      * @brief Checks whether a specified application is enabled through the proxy object.
595      * @param bundleName Indicates the bundle name of the application.
596      * @param isEnable Indicates the application status is enabled.
597      * @return Returns result of the operation.
598      */
599     virtual ErrCode IsApplicationEnabled(const std::string &bundleName, bool &isEnable) override;
600     /**
601      * @brief Checks whether a specified clone application is enabled.
602      * @param bundleName Indicates the bundle name of the application.
603      * @param appIndex Indicates the app index of clone applications.
604      * @param isEnable Indicates the application status is enabled.
605      * @return Returns result of the operation.
606      */
607     virtual ErrCode IsCloneApplicationEnabled(
608         const std::string &bundleName, int32_t appIndex, bool &isEnable) override;
609     /**
610      * @brief Sets whether to enable a specified application through the proxy object.
611      * @param bundleName Indicates the bundle name of the application.
612      * @param isEnable Specifies whether to enable the application.
613      *                 The value true means to enable it, and the value false means to disable it.
614      * @param userId description the user id.
615      * @return Returns result of the operation.
616      */
617     virtual ErrCode SetApplicationEnabled(const std::string &bundleName, bool isEnable,
618         int32_t userId = Constants::UNSPECIFIED_USERID) override;
619     /**
620      * @brief Sets whether to enable a specified clone application.
621      * @param bundleName Indicates the bundle name of the application.
622      * @param appIndex Indicates the app index of clone applications.
623      * @param isEnable Specifies whether to enable the application.
624      *                 The value true means to enable it, and the value false means to disable it.
625      * @param userId description the user id.
626      * @return Returns result of the operation.
627      */
628     virtual ErrCode SetCloneApplicationEnabled(const std::string &bundleName, int32_t appIndex, bool isEnable,
629         int32_t userId = Constants::UNSPECIFIED_USERID) override;
630     /**
631      * @brief Sets whether to enable a specified ability through the proxy object.
632      * @param abilityInfo Indicates information about the ability to check.
633      * @param isEnable Indicates the ability status is enabled.
634      * @return Returns result of the operation.
635      */
636     virtual ErrCode IsAbilityEnabled(const AbilityInfo &abilityInfo, bool &isEnable) override;
637     /**
638      * @brief Sets whether to enable a specified ability.
639      * @param abilityInfo Indicates information about the ability to check.
640      * @param appIndex Indicates the app index of clone applications.
641      * @param isEnable Indicates the ability status is enabled.
642      * @return Returns result of the operation.
643      */
644     virtual ErrCode IsCloneAbilityEnabled(const AbilityInfo &abilityInfo, int32_t appIndex, bool &isEnable) override;
645     /**
646      * @brief Sets whether to enable a specified ability through the proxy object.
647      * @param abilityInfo Indicates information about the ability.
648      * @param isEnabled Specifies whether to enable the ability.
649      *                 The value true means to enable it, and the value false means to disable it.
650      * @param userId description the user id.
651      * @return Returns result of the operation.
652      */
653     virtual ErrCode SetAbilityEnabled(const AbilityInfo &abilityInfo, bool isEnabled,
654         int32_t userId = Constants::UNSPECIFIED_USERID) override;
655     /**
656      * @brief Sets whether to enable a specified ability.
657      * @param abilityInfo Indicates information about the ability.
658      * @param appIndex Indicates the app index of clone applications.
659      * @param isEnabled Specifies whether to enable the ability.
660      *                 The value true means to enable it, and the value false means to disable it.
661      * @param userId description the user id.
662      * @return Returns result of the operation.
663      */
664     virtual ErrCode SetCloneAbilityEnabled(const AbilityInfo &abilityInfo, int32_t appIndex, bool isEnabled,
665         int32_t userId = Constants::UNSPECIFIED_USERID)  override;
666     /**
667      * @brief Obtains the interface used to install and uninstall bundles through the proxy object.
668      * @return Returns a pointer to IBundleInstaller class if exist; returns nullptr otherwise.
669      */
670     virtual sptr<IBundleInstaller> GetBundleInstaller() override;
671     /**
672      * @brief Obtains the interface used to create or delete user.
673      * @return Returns a pointer to IBundleUserMgr class if exist; returns nullptr otherwise.
674      */
675     virtual sptr<IBundleUserMgr> GetBundleUserMgr() override;
676     /**
677      * @brief Obtains the VerifyManager.
678      * @return Returns a pointer to VerifyManager class if exist; returns nullptr otherwise.
679      */
680     virtual sptr<IVerifyManager> GetVerifyManager() override;
681     /**
682      * @brief  Obtains the FormInfo objects provided by all applications on the device.
683      * @param  formInfos List of FormInfo objects if obtained; returns an empty List if no FormInfo is available on the
684      * device.
685      * @return Returns true if this function is successfully called; returns false otherwise.
686      */
687     virtual bool GetAllFormsInfo(std::vector<FormInfo> &formInfos) override;
688     /**
689      * @brief  Obtains the FormInfo objects provided by a specified application on the device.
690      * @param  bundleName Indicates the bundle name of the application.
691      * @param  formInfos List of FormInfo objects if obtained; returns an empty List if no FormInfo is available on the
692      * device.
693      * @return Returns true if this function is successfully called; returns false otherwise.
694      */
695     virtual bool GetFormsInfoByApp(const std::string &bundleName, std::vector<FormInfo> &formInfos) override;
696     /**
697      * @brief  Obtains the FormInfo objects provided by a specified module name.
698      * @param  bundleName Indicates the bundle name of the application.
699      * @param  moduleName Indicates the module name of the application.
700      * @param  formInfos List of FormInfo objects if obtained; returns an empty List if no FormInfo is available on the
701      * device.
702      * @return Returns true if this function is successfully called; returns false otherwise.
703      */
704     virtual bool GetFormsInfoByModule(
705         const std::string &bundleName, const std::string &moduleName, std::vector<FormInfo> &formInfos) override;
706     /**
707      * @brief Obtains the ShortcutInfo objects provided by a specified application on the device.
708      * @param bundleName Indicates the bundle name of the application.
709      * @param shortcutInfos List of ShortcutInfo objects if obtained.
710      * @return Returns true if this function is successfully called; returns false otherwise.
711      */
712     virtual bool GetShortcutInfos(const std::string &bundleName, std::vector<ShortcutInfo> &shortcutInfos) override;
713 
714     /**
715      * @brief Obtains the ShortcutInfo objects provided by a specified application on the device.
716      * @param bundleName Indicates the bundle name of the application.
717      * @param shortcutInfos List of ShortcutInfo objects if obtained.
718      * @return Returns err code of result.
719      */
720     virtual ErrCode GetShortcutInfoV9(const std::string &bundleName,
721         std::vector<ShortcutInfo> &shortcutInfos, int32_t userId = Constants::UNSPECIFIED_USERID) override;
722     /**
723      * @brief Obtains the CommonEventInfo objects provided by an event key on the device.
724      * @param eventKey Indicates the event of the subscribe.
725      * @param commonEventInfos List of CommonEventInfo objects if obtained.
726      * @return Returns true if this function is successfully called; returns false otherwise.
727      */
728     virtual bool GetAllCommonEventInfo(const std::string &eventKey,
729         std::vector<CommonEventInfo> &commonEventInfos) override;
730     /**
731      * @brief Obtains the DistributedBundleInfo based on a given bundle name and networkId.
732      * @param networkId Indicates the networkId of remote device.
733      * @param bundleName Indicates the application bundle name to be queried.
734      * @param distributedBundleInfo Indicates the obtained DistributedBundleInfo object.
735      * @return Returns true if the DistributedBundleInfo is successfully obtained; returns false otherwise.
736      */
737     virtual bool GetDistributedBundleInfo(const std::string &networkId, const std::string &bundleName,
738         DistributedBundleInfo &distributedBundleInfo) override;
739     /**
740      * @brief Get app privilege level.
741      * @param bundleName Indicates the bundle name of the app privilege level.
742      * @param userId Indicates the user id.
743      * @return Returns app privilege level.
744      */
745     virtual std::string GetAppPrivilegeLevel(
746         const std::string &bundleName, int32_t userId = Constants::UNSPECIFIED_USERID) override;
747     /**
748      * @brief Query extension info.
749      * @param Want Indicates the information of extension info.
750      * @param flag Indicates the query flag which will fliter any specified stuff in the extension info.
751      * @param userId Indicates the userId in the system.
752      * @param extensionInfos Indicates the obtained extensions.
753      * @return Returns true if this function is successfully called; returns false otherwise.
754      */
755     virtual bool QueryExtensionAbilityInfos(const Want &want, const int32_t &flag, const int32_t &userId,
756         std::vector<ExtensionAbilityInfo> &extensionInfos) override;
757     /**
758      * @brief Query extension info.
759      * @param Want Indicates the information of extension info.
760      * @param flags Indicates the query flag which will filter any specified stuff in the extension info.
761      * @param userId Indicates the userId in the system.
762      * @param extensionInfos Indicates the obtained extensions.
763      * @return Returns ERR_OK if this function is successfully called; returns errCode otherwise.
764      */
765     virtual ErrCode QueryExtensionAbilityInfosV9(const Want &want, int32_t flags, int32_t userId,
766         std::vector<ExtensionAbilityInfo> &extensionInfos) override;
767     /**
768      * @brief Query extension info.
769      * @param Want Indicates the information of extension info.
770      * @param extensionType Indicates the type of the extension.
771      * @param flag Indicates the query flag which will fliter any specified stuff in the extension info.
772      * @param userId Indicates the userId in the system.
773      * @param extensionInfos Indicates the obtained extensions.
774      * @return Returns true if this function is successfully called; returns false otherwise.
775      */
776     virtual bool QueryExtensionAbilityInfos(const Want &want, const ExtensionAbilityType &extensionType,
777         const int32_t &flag, const int32_t &userId, std::vector<ExtensionAbilityInfo> &extensionInfos) override;
778     /**
779      * @brief Query extension info.
780      * @param Want Indicates the information of extension info.
781      * @param extensionType Indicates the type of the extension.
782      * @param flags Indicates the query flag which will filter any specified stuff in the extension info.
783      * @param userId Indicates the userId in the system.
784      * @param extensionInfos Indicates the obtained extensions.
785      * @return Returns ERR_OK if this function is successfully called; returns errCode otherwise.
786      */
787     virtual ErrCode QueryExtensionAbilityInfosV9(const Want &want, const ExtensionAbilityType &extensionType,
788         int32_t flags, int32_t userId, std::vector<ExtensionAbilityInfo> &extensionInfos) override;
789     virtual bool QueryExtensionAbilityInfos(const ExtensionAbilityType &extensionType, const int32_t &userId,
790         std::vector<ExtensionAbilityInfo> &extensionInfos) override;
791 
792     virtual bool VerifyCallingPermission(const std::string &permission) override;
793 
794     virtual bool QueryExtensionAbilityInfoByUri(const std::string &uri, int32_t userId,
795         ExtensionAbilityInfo &extensionAbilityInfo) override;
796 
797     virtual bool ImplicitQueryInfoByPriority(const Want &want, int32_t flags, int32_t userId,
798         AbilityInfo &abilityInfo, ExtensionAbilityInfo &extensionInfo) override;
799 
800     virtual bool ImplicitQueryInfos(const Want &want, int32_t flags, int32_t userId, bool withDefault,
801         std::vector<AbilityInfo> &abilityInfos, std::vector<ExtensionAbilityInfo> &extensionInfos,
802         bool &findDefaultApp) override;
803 
804     /**
805      * @brief Obtains the AbilityInfo based on a given bundle name through the proxy object.
806      * @param bundleName Indicates the bundle name to be queried.
807      * @param abilityName Indicates the ability name to be queried.
808      * @param abilityInfo Indicates the obtained AbilityInfo object.
809      * @return Returns true if the AbilityInfo is successfully obtained; returns false otherwise.
810      */
811     virtual bool GetAbilityInfo(
812         const std::string &bundleName, const std::string &abilityName, AbilityInfo &abilityInfo) override;
813 
814     /**
815      * @brief Obtains the AbilityInfo based on a given bundle name through the proxy object.
816      * @param bundleName Indicates the bundle name to be queried.
817      * @param moduleName Indicates the module name to be queried.
818      * @param abilityName Indicates the ability name to be queried.
819      * @param abilityInfo Indicates the obtained AbilityInfo object.
820      * @return Returns true if the AbilityInfo is successfully obtained; returns false otherwise.
821      */
822     virtual bool GetAbilityInfo(
823         const std::string &bundleName, const std::string &moduleName,
824         const std::string &abilityName, AbilityInfo &abilityInfo) override;
825 
826     virtual ErrCode GetSandboxBundleInfo(
827         const std::string &bundleName, int32_t appIndex, int32_t userId, BundleInfo &info) override;
828     /**
829      * @brief Obtains the value of isRemovable based on a given bundle name through the proxy object.
830      * @param bundleName Indicates the bundle name to be queried.
831      * @param moduleName Indicates the module name to be queried.
832      * @param isRemovable Indicates the module whether is removable.
833      * @return Returns true if the isRemovable is successfully obtained; returns false otherwise.
834      */
835     virtual ErrCode IsModuleRemovable(const std::string &bundleName, const std::string &moduleName,
836         bool &isRemovable) override;
837     /**
838      * @brief Sets whether to enable isRemovable based on a given bundle name through the proxy object.
839      * @param bundleName Indicates the bundle name to be queried.
840      * @param moduleName Indicates the module name to be queried.
841      * @param isEnable Specifies whether to enable the isRemovable of InnerModuleInfo.
842      *                 The value true means to enable it, and the value false means to disable it
843      * @return Returns true if the isRemovable is successfully obtained; returns false otherwise.
844      */
845     virtual bool SetModuleRemovable(
846         const std::string &bundleName, const std::string &moduleName, bool isEnable) override;
847 
848     /**
849      * @brief Obtains the dependent module names.
850      *
851      * @param bundleName Indicates the bundle name to be queried.
852      * @param moduleName Indicates the module name to be queried.
853      * @param dependentModuleNames Indicates the obtained dependent module names.
854      * @return Returns true if this function is successfully called; returns false otherwise.
855      */
856     virtual bool GetAllDependentModuleNames(const std::string &bundleName, const std::string &moduleName,
857         std::vector<std::string> &dependentModuleNames) override;
858     /**
859      * @brief Obtains the value of upgradeFlag based on a given bundle name through the proxy object.
860      * @param bundleName Indicates the bundle name to be queried.
861      * @param moduleName Indicates the module name to be queried.
862      * @return Returns true if the upgradeFlag is successfully obtained; returns false otherwise.
863      */
864     virtual bool GetModuleUpgradeFlag(const std::string &bundleName, const std::string &moduleName) override;
865     /**
866      * @brief Sets whether to enable upgradeFlag based on a given bundle name through the proxy object.
867      * @param bundleName Indicates the bundle name to be queried.
868      * @param moduleName Indicates the module name to be queried.
869      * @param isEnable Specifies whether to enable the upgradeFlag of InnerModuleInfo.
870      *                 The value true means to enable it, and the value false means to disable it
871      * @return Returns ERR_OK if the upgradeFlag is successfully obtained; returns other ErrCode otherwise.
872      */
873     virtual ErrCode SetModuleUpgradeFlag(
874         const std::string &bundleName, const std::string &moduleName, int32_t upgradeFlag) override;
875     /**
876      * @brief Process preload when ability or extensionAbility is running.
877      * @param want Indicates the information of the ability.
878      * @param preload Specifies whether to preload modules in atomicService.
879      */
880     virtual bool ProcessPreload(const Want &want) override;
881 
882     virtual bool ObtainCallingBundleName(std::string &bundleName) override;
883 
884     virtual bool GetBundleStats(const std::string &bundleName, int32_t userId,
885         std::vector<int64_t> &bundleStats, int32_t appIndex = 0, uint32_t statFlag = 0) override;
886 
887     virtual bool GetAllBundleStats(int32_t userId, std::vector<int64_t> &bundleStats) override;
888 
889     virtual sptr<IExtendResourceManager> GetExtendResourceManager() override;
890 
891     virtual bool CheckAbilityEnableInstall(
892         const Want &want, int32_t missionId, int32_t userId, const sptr<IRemoteObject> &callback) override;
893 
894     virtual ErrCode GetMediaData(const std::string &bundleName, const std::string &moduleName,
895         const std::string &abilityName, std::unique_ptr<uint8_t[]> &mediaDataPtr, size_t &len,
896         int32_t userId = Constants::UNSPECIFIED_USERID) override;
897 
898     virtual std::string GetStringById(const std::string &bundleName, const std::string &moduleName,
899         uint32_t resId, int32_t userId, const std::string &localeInfo = Constants::EMPTY_STRING) override;
900 
901     virtual std::string GetIconById(const std::string &bundleName, const std::string &moduleName,
902         uint32_t resId, uint32_t density, int32_t userId) override;
903 
904     virtual ErrCode GetAppProvisionInfo(const std::string &bundleName, int32_t userId,
905         AppProvisionInfo &appProvisionInfo) override;
906 
907     virtual ErrCode GetAllSharedBundleInfo(std::vector<SharedBundleInfo> &sharedBundles) override;
908     virtual ErrCode GetSharedBundleInfo(const std::string &bundleName, const std::string &moduleName,
909         std::vector<SharedBundleInfo> &sharedBundles) override;
910 
911 #ifdef BUNDLE_FRAMEWORK_DEFAULT_APP
912     virtual sptr<IDefaultApp> GetDefaultAppProxy() override;
913 #endif
914 
915     virtual ErrCode GetSandboxAbilityInfo(const Want &want, int32_t appIndex, int32_t flags, int32_t userId,
916         AbilityInfo &info) override;
917     virtual ErrCode GetSandboxExtAbilityInfos(const Want &want, int32_t appIndex, int32_t flags, int32_t userId,
918         std::vector<ExtensionAbilityInfo> &infos) override;
919     virtual ErrCode GetSandboxHapModuleInfo(const AbilityInfo &abilityInfo, int32_t appIndex, int32_t userId,
920         HapModuleInfo &info) override;
921 
922     virtual sptr<IQuickFixManager> GetQuickFixManagerProxy() override;
923 
924 #ifdef BUNDLE_FRAMEWORK_APP_CONTROL
925     virtual sptr<IAppControlMgr> GetAppControlProxy() override;
926 #endif
927     virtual ErrCode SetDebugMode(bool isDebug) override;
928 
929     virtual bool VerifySystemApi(int32_t beginApiVersion = Constants::INVALID_API_VERSION) override;
930 
931     virtual sptr<IOverlayManager> GetOverlayManagerProxy() override;
932 
933     virtual ErrCode GetBaseSharedBundleInfos(const std::string &bundleName,
934         std::vector<BaseSharedBundleInfo> &baseSharedBundleInfos,
935         GetDependentBundleInfoFlag flag = GetDependentBundleInfoFlag::GET_APP_CROSS_HSP_BUNDLE_INFO) override;
936 
937     virtual ErrCode GetSharedBundleInfoBySelf(const std::string &bundleName,
938         SharedBundleInfo &sharedBundleInfo) override;
939 
940     virtual ErrCode GetSharedDependencies(const std::string &bundleName, const std::string &moduleName,
941         std::vector<Dependency> &dependencies) override;
942 
943     virtual ErrCode GetAllProxyDataInfos(
944         std::vector<ProxyData> &proxyDatas, int32_t userId = Constants::UNSPECIFIED_USERID) override;
945 
946     virtual ErrCode GetProxyDataInfos(const std::string &bundleName, const std::string &moduleName,
947         std::vector<ProxyData> &proxyDatas, int32_t userId = Constants::UNSPECIFIED_USERID) override;
948 
949     virtual ErrCode GetSpecifiedDistributionType(const std::string &bundleName,
950         std::string &specifiedDistributionType) override;
951 
952     virtual ErrCode GetAdditionalInfo(const std::string &bundleName,
953         std::string &additionalInfo) override;
954 
955     virtual ErrCode SetExtNameOrMIMEToApp(const std::string &bundleName, const std::string &moduleName,
956         const std::string &abilityName, const std::string &extName, const std::string &mimeType) override;
957 
958     virtual ErrCode DelExtNameOrMIMEToApp(const std::string &bundleName, const std::string &moduleName,
959         const std::string &abilityName, const std::string &extName, const std::string &mimeType) override;
960 
961     virtual bool QueryDataGroupInfos(const std::string &bundleName, int32_t userId,
962         std::vector<DataGroupInfo> &infos) override;
963 
964     virtual bool GetGroupDir(const std::string &dataGroupId, std::string &dir) override;
965 
966     virtual bool QueryAppGalleryBundleName(std::string &bundleName) override;
967 
968     /**
969      * @brief Query extension info with type name.
970      * @param Want Indicates the information of extension info.
971      * @param extensionTypeName Indicates the type of the extension.
972      * @param flag Indicates the query flag which will fliter any specified stuff in the extension info.
973      * @param userId Indicates the userId in the system.
974      * @param extensionInfos Indicates the obtained extensions.
975      * @return Returns ERR_OK if this function is successfully called; returns other ErrCode otherwise.
976      */
977     virtual ErrCode QueryExtensionAbilityInfosWithTypeName(const Want &want, const std::string &extensionTypeName,
978         const int32_t flag, const int32_t userId, std::vector<ExtensionAbilityInfo> &extensionInfos) override;
979 
980     /**
981      * @brief Query extension info only with type name.
982      * @param extensionTypeName Indicates the type of the extension.
983      * @param flag Indicates the query flag which will fliter any specified stuff in the extension info.
984      * @param userId Indicates the userId in the system.
985      * @param extensionInfos Indicates the obtained extensions.
986      * @return Returns ERR_OK if this function is successfully called; returns other ErrCode otherwise.
987      */
988     virtual ErrCode QueryExtensionAbilityInfosOnlyWithTypeName(const std::string &extensionTypeName,
989         const uint32_t flag, const int32_t userId, std::vector<ExtensionAbilityInfo> &extensionInfos) override;
990 
991     virtual ErrCode ResetAOTCompileStatus(const std::string &bundleName, const std::string &moduleName,
992         int32_t triggerMode) override;
993 
994     virtual ErrCode GetJsonProfile(ProfileType profileType, const std::string &bundleName,
995         const std::string &moduleName, std::string &profile, int32_t userId = Constants::UNSPECIFIED_USERID) override;
996 
997     virtual sptr<IBundleResource> GetBundleResourceProxy() override;
998 
999     virtual ErrCode GetRecoverableApplicationInfo(
1000         std::vector<RecoverableApplicationInfo> &recoverableApplications) override;
1001 
1002     virtual ErrCode GetUninstalledBundleInfo(const std::string bundleName, BundleInfo &bundleInfo) override;
1003 
1004     virtual ErrCode SetAdditionalInfo(const std::string &bundleName, const std::string &additionalInfo) override;
1005 
1006     virtual ErrCode CreateBundleDataDir(int32_t userId) override;
1007 
1008     /**
1009      * @brief Check whether the link can be opened.
1010      * @param link Indicates the link to be opened.
1011      * @param canOpen Indicates whether the link can be opened.
1012      * @return Returns result of the operation.
1013      */
1014     virtual ErrCode CanOpenLink(
1015         const std::string &link, bool &canOpen) override;
1016 
1017     /**
1018      * @brief Get odid of the current application.
1019      * @param odid Indicates the odid of application.
1020      * @return Returns ERR_OK if this function is successfully called; returns other ErrCode otherwise.
1021      */
1022     virtual ErrCode GetOdid(std::string &odid) override;
1023     /**
1024      * @brief Obtains BundleInfo of all bundles available in the system through the developerId.
1025      * @param developerId Indicates the developerId of application.
1026      * @param userId Indicates the user ID.
1027      * @return Returns ERR_OK if this function is successfully called; returns other ErrCode otherwise.
1028      */
1029     virtual ErrCode GetAllBundleInfoByDeveloperId(const std::string &developerId,
1030         std::vector<BundleInfo> &bundleInfos, int32_t userId = Constants::UNSPECIFIED_USERID) override;
1031     /**
1032      * @brief Obtains all developerId list through the specified distribution type of application.
1033      * @param appDistributionType Indicates the distribution type of application.
1034      * @param userId Indicates the user ID.
1035      * @return Returns ERR_OK if this function is successfully called; returns other ErrCode otherwise.
1036      */
1037     virtual ErrCode GetDeveloperIds(const std::string &appDistributionType,
1038         std::vector<std::string> &developerIdList, int32_t userId = Constants::UNSPECIFIED_USERID) override;
1039     /**
1040      * @brief Switch uninstall state of a specified application.
1041      * @param bundleName Indicates the bundle name of the application.
1042      * @param state Indicates whether the specified application can be uninstalled.
1043      * @return Returns ERR_OK if this function is successfully called; returns other ErrCode otherwise.
1044      */
1045     virtual ErrCode SwitchUninstallState(const std::string &bundleName, const bool &state,
1046         bool isNeedSendNotify = true) override;
1047 
1048     /**
1049      * @brief Query the AbilityInfo by continueType.
1050      * @param bundleName Indicates the bundle name of the application.
1051      * @param continueType Indicates the continue type of the ability.
1052      * @param abilityInfo Indicates the obtained AbilityInfo object.
1053      * @param userId Indicates the information of the user.
1054      * @return Returns true if the AbilityInfos is successfully obtained; returns false otherwise.
1055      */
1056     virtual ErrCode QueryAbilityInfoByContinueType(const std::string &bundleName, const std::string &continueType,
1057         AbilityInfo &abilityInfo, int32_t userId = Constants::UNSPECIFIED_USERID) override;
1058 
1059     /**
1060      * @brief Get preinstalled application infos.
1061      * @param preinstalledApplicationInfos Indicates all of the obtained PreinstalledApplicationInfo objects.
1062      * @return Returns ERR_OK if this function is successfully called; returns other ErrCode otherwise.
1063      */
1064     virtual ErrCode GetAllPreinstalledApplicationInfos(
1065         std::vector<PreinstalledApplicationInfo> &preinstalledApplicationInfos) override;
1066 
1067     virtual ErrCode QueryCloneAbilityInfo(const ElementName &element,
1068         int32_t flags, int32_t appIndex, AbilityInfo &abilityInfo, int32_t userId) override;
1069 
1070     virtual ErrCode GetCloneBundleInfo(const std::string &bundleName, int32_t flag, int32_t appIndex,
1071         BundleInfo &bundleInfo, int32_t userId = Constants::UNSPECIFIED_USERID) override;
1072 
1073     virtual ErrCode GetCloneAppIndexes(const std::string &bundleName, std::vector<int32_t> &appIndexes,
1074         int32_t userId = Constants::UNSPECIFIED_USERID) override;
1075 
1076     virtual ErrCode GetLaunchWant(Want &want) override;
1077 
1078     virtual ErrCode QueryCloneExtensionAbilityInfoWithAppIndex(const ElementName &elementName, int32_t flags,
1079         int32_t appIndex, ExtensionAbilityInfo &extensionAbilityInfo,
1080         int32_t userId = Constants::UNSPECIFIED_USERID) override;
1081 
1082     virtual ErrCode GetSignatureInfoByBundleName(const std::string &bundleName, SignatureInfo &signatureInfo) override;
1083 
1084     virtual ErrCode AddDesktopShortcutInfo(const ShortcutInfo &shortcutInfo, int32_t userId) override;
1085 
1086     virtual ErrCode DeleteDesktopShortcutInfo(const ShortcutInfo &shortcutInfo, int32_t userId) override;
1087 
1088     virtual ErrCode GetAllDesktopShortcutInfo(int32_t userId, std::vector<ShortcutInfo> &shortcutInfos) override;
1089 
1090     virtual ErrCode GetOdidByBundleName(const std::string &bundleName, std::string &odid) override;
1091 
1092     /**
1093      * @brief Obtains BundleInfo of all continuable bundles available in the system through the proxy object.
1094      * @param flag Indicates the flag used to specify information contained in the BundleInfo that will be returned.
1095      * @param bundleInfos Indicates all of the obtained BundleInfo objects.
1096      * @param userId Indicates the user ID.
1097      * @return Returns true if the BundleInfos is successfully obtained; returns false otherwise.
1098      */
1099     virtual bool GetBundleInfosForContinuation(int32_t flags, std::vector<BundleInfo> &bundleInfos,
1100         int32_t userId = Constants::UNSPECIFIED_USERID) override;
1101 
1102     /**
1103      * @brief Get a list of application package names that continue the specified package name.
1104      * @param continueBundleName The package name that is being continued.
1105      * @param bundleNames Continue the list of specified package names.
1106      * @param userId Indicates the user ID.
1107      * @return Returns ERR_OK if successfully obtained; returns error code otherwise.
1108      */
1109     ErrCode GetContinueBundleNames(const std::string &continueBundleName, std::vector<std::string> &bundleNames,
1110         int32_t userId = Constants::UNSPECIFIED_USERID) override;
1111 
1112     virtual ErrCode IsBundleInstalled(const std::string &bundleName, int32_t userId,
1113         int32_t appIndex, bool &isInstalled) override;
1114 
1115     virtual ErrCode GetCompatibleDeviceType(const std::string &bundleName, std::string &deviceType) override;
1116 
1117     virtual ErrCode GetBundleNameByAppId(const std::string &appId, std::string &bundleName) override;
1118 
1119     virtual ErrCode GetDirByBundleNameAndAppIndex(const std::string &bundleName, const int32_t appIndex,
1120         std::string &dataDir) override;
1121 
1122     virtual ErrCode GetAllBundleDirs(int32_t userId, std::vector<BundleDir> &bundleDirs) override;
1123 private:
1124     /**
1125      * @brief Send a command message from the proxy object.
1126      * @param code Indicates the message code to be sent.
1127      * @param data Indicates the objects to be sent.
1128      * @param reply Indicates the reply to be sent;
1129      * @return Returns true if message send successfully; returns false otherwise.
1130      */
1131     bool SendTransactCmd(BundleMgrInterfaceCode code, MessageParcel &data, MessageParcel &reply);
1132 
1133     /**
1134      * @brief Send a command message from the proxy object and  printf log.
1135      * @param code Indicates the message code to be sent.
1136      * @param data Indicates the objects to be sent.
1137      * @param reply Indicates the reply to be sent;
1138      * @return Returns true if message send successfully; returns false otherwise.
1139      */
1140     bool SendTransactCmdWithLog(BundleMgrInterfaceCode code, MessageParcel &data, MessageParcel &reply);
1141 
1142     /**
1143      * @brief Send a command message and then get a parcelable information object from the reply.
1144      * @param code Indicates the message code to be sent.
1145      * @param data Indicates the objects to be sent.
1146      * @param parcelableInfo Indicates the object to be got;
1147      * @return Returns true if objects get successfully; returns false otherwise.
1148      */
1149     template <typename T>
1150     bool GetParcelableInfo(BundleMgrInterfaceCode code, MessageParcel &data, T &parcelableInfo);
1151 
1152     template <typename T>
1153     ErrCode GetParcelableInfoWithErrCode(BundleMgrInterfaceCode code, MessageParcel &data, T &parcelableInfo);
1154     /**
1155      * @brief Send a command message and then get a vector of parcelable information objects from the reply.
1156      * @param code Indicates the message code to be sent.
1157      * @param data Indicates the objects to be sent.
1158      * @param parcelableInfos Indicates the vector objects to be got;
1159      * @return Returns true if the vector get successfully; returns false otherwise.
1160      */
1161     template <typename T>
1162     bool GetParcelableInfos(BundleMgrInterfaceCode code, MessageParcel &data, std::vector<T> &parcelableInfos);
1163 
1164     template <typename T>
1165     ErrCode GetParcelableInfosWithErrCode(BundleMgrInterfaceCode code, MessageParcel &data,
1166         std::vector<T> &parcelableInfos);
1167 
1168     template<typename T>
1169     bool GetVectorFromParcelIntelligent(
1170         BundleMgrInterfaceCode code, MessageParcel &data, std::vector<T> &parcelableInfos);
1171 
1172     template<typename T>
1173     ErrCode GetVectorFromParcelIntelligentWithErrCode(
1174         BundleMgrInterfaceCode code, MessageParcel &data, std::vector<T> &parcelableInfos);
1175 
1176     template<typename T>
1177     ErrCode InnerGetVectorFromParcelIntelligent(MessageParcel &reply, std::vector<T> &parcelableInfos);
1178 
1179     template<typename T>
1180     ErrCode GetParcelInfo(BundleMgrInterfaceCode code, MessageParcel &data, T &parcelInfo);
1181 
1182     template<typename T>
1183     ErrCode InnerGetParcelInfo(MessageParcel &reply, T &parcelInfo);
1184 
1185     template<typename T>
1186     ErrCode GetParcelInfoIntelligent(BundleMgrInterfaceCode code, MessageParcel &data, T &parcelInfo);
1187 
1188     ErrCode GetBigString(BundleMgrInterfaceCode code, MessageParcel &data, std::string &result);
1189 
1190     ErrCode InnerGetBigString(MessageParcel &reply, std::string &result);
1191 
1192     ErrCode GetMediaDataFromAshMem(MessageParcel &reply, std::unique_ptr<uint8_t[]> &mediaDataPtr, size_t &len);
1193     static inline BrokerDelegator<BundleMgrProxy> delegator_;
1194 
1195     template<typename T>
1196     ErrCode WriteParcelInfoIntelligent(const T &parcelInfo, MessageParcel &reply) const;
1197 
1198     ErrCode GetParcelInfoFromAshMem(MessageParcel &reply, void *&data);
1199 };
1200 
1201 }  // namespace AppExecFwk
1202 }  // namespace OHOS
1203 #endif  // FOUNDATION_APPEXECFWK_INTERFACES_INNERKITS_APPEXECFWK_CORE_INCLUDE_BUNDLEMGR_BUNDLE_MGR_PROXY_H