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