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_INTERFACE_H
17 #define FOUNDATION_APPEXECFWK_INTERFACES_INNERKITS_APPEXECFWK_CORE_INCLUDE_BUNDLEMGR_BUNDLE_MGR_INTERFACE_H
18 
19 #include "ability_info.h"
20 #include "appexecfwk_errors.h"
21 #include "application_info.h"
22 #include "app_provision_info.h"
23 #include "bundle_constants.h"
24 #include "bundle_dir.h"
25 #include "bundle_event_callback_interface.h"
26 #include "bundle_info.h"
27 #include "bundle_pack_info.h"
28 #include "bundle_installer_interface.h"
29 #include "bundle_status_callback_interface.h"
30 #include "bundle_user_mgr_interface.h"
31 #include "clean_cache_callback_interface.h"
32 #include "common_event_info.h"
33 #include "data_group_info.h"
34 #include "app_control_interface.h"
35 #include "bundle_resource_interface.h"
36 #include "default_app_interface.h"
37 #include "extend_resource_manager_interface.h"
38 #include "overlay_manager_interface.h"
39 #include "quick_fix_manager_interface.h"
40 #include "verify_manager_interface.h"
41 #include "distributed_bundle_info.h"
42 #include "form_info.h"
43 #include "hap_module_info.h"
44 #include "permission_define.h"
45 #include "preinstalled_application_info.h"
46 #include "recoverable_application_info.h"
47 #include "shared/base_shared_bundle_info.h"
48 #include "shared/shared_bundle_info.h"
49 #include "shortcut_info.h"
50 #include "want.h"
51 
52 namespace OHOS {
53 namespace AppExecFwk {
54 enum class DumpFlag {
55     DUMP_BUNDLE_LIST = 1,  // corresponse to option "-bundle-list"
56     DUMP_BUNDLE_INFO,      // corresponse to option "-bundle [name]"
57     DUMP_SHORTCUT_INFO,    // corresponse to option "-bundle [name] -shortcut-info"
58 };
59 
60 class IBundleMgr : public IRemoteBroker {
61 public:
62     DECLARE_INTERFACE_DESCRIPTOR(u"ohos.appexecfwk.BundleMgr");
63 
64     using Want = OHOS::AAFwk::Want;
65     /**
66      * @brief Obtains the ApplicationInfo based on a given bundle name.
67      * @param appName Indicates the application bundle name to be queried.
68      * @param flag Indicates the flag used to specify information contained
69      *             in the ApplicationInfo object that will be returned.
70      * @param userId Indicates the user ID.
71      * @param appInfo Indicates the obtained ApplicationInfo object.
72      * @return Returns true if the application is successfully obtained; returns false otherwise.
73      */
GetApplicationInfo(const std::string & appName,const ApplicationFlag flag,const int userId,ApplicationInfo & appInfo)74     virtual bool GetApplicationInfo(
75         const std::string &appName, const ApplicationFlag flag, const int userId, ApplicationInfo &appInfo)
76     {
77         return false;
78     }
79     /**
80      * @brief Obtains the ApplicationInfo based on a given bundle name.
81      * @param appName Indicates the application bundle name to be queried.
82      * @param flags Indicates the flag used to specify information contained
83      *             in the ApplicationInfo object that will be returned.
84      * @param userId Indicates the user ID.
85      * @param appInfo Indicates the obtained ApplicationInfo object.
86      * @return Returns true if the application is successfully obtained; returns false otherwise.
87      */
GetApplicationInfo(const std::string & appName,int32_t flags,int32_t userId,ApplicationInfo & appInfo)88     virtual bool GetApplicationInfo(
89         const std::string &appName, int32_t flags, int32_t userId, ApplicationInfo &appInfo)
90     {
91         return false;
92     }
93     /**
94      * @brief Obtains the ApplicationInfo based on a given bundle name.
95      * @param appName Indicates the application bundle name to be queried.
96      * @param flag Indicates the flag used to specify information contained
97      *             in the ApplicationInfo object that will be returned.
98      * @param userId Indicates the user ID.
99      * @param appInfo Indicates the obtained ApplicationInfo object.
100      * @return Returns ERR_OK if the application is successfully obtained; returns error code otherwise.
101      */
GetApplicationInfoV9(const std::string & appName,int32_t flag,int32_t userId,ApplicationInfo & appInfo)102     virtual ErrCode GetApplicationInfoV9(
103         const std::string &appName, int32_t flag, int32_t userId, ApplicationInfo &appInfo)
104     {
105         return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
106     }
107     /**
108      * @brief Obtains information about all installed applications of a specified user.
109      * @param flag Indicates the flag used to specify information contained
110      *             in the ApplicationInfo objects that will be returned.
111      * @param userId Indicates the user ID.
112      * @param appInfos Indicates all of the obtained ApplicationInfo objects.
113      * @return Returns true if the application is successfully obtained; returns false otherwise.
114      */
GetApplicationInfos(const ApplicationFlag flag,int userId,std::vector<ApplicationInfo> & appInfos)115     virtual bool GetApplicationInfos(
116         const ApplicationFlag flag, int userId, std::vector<ApplicationInfo> &appInfos)
117     {
118         return false;
119     }
120     /**
121      * @brief Obtains information about all installed applications of a specified user.
122      * @param flags Indicates the flag used to specify information contained
123      *             in the ApplicationInfo objects that will be returned.
124      * @param userId Indicates the user ID.
125      * @param appInfos Indicates all of the obtained ApplicationInfo objects.
126      * @return Returns true if the application is successfully obtained; returns false otherwise.
127      */
GetApplicationInfos(int32_t flags,int32_t userId,std::vector<ApplicationInfo> & appInfos)128     virtual bool GetApplicationInfos(
129         int32_t flags, int32_t userId, std::vector<ApplicationInfo> &appInfos)
130     {
131         return false;
132     }
133     /**
134      * @brief Obtains information about all installed applications of a specified user.
135      * @param flags Indicates the flag used to specify information contained
136      *             in the ApplicationInfo objects that will be returned.
137      * @param userId Indicates the user ID.
138      * @param appInfos Indicates all of the obtained ApplicationInfo objects.
139      * @return Returns ERR_OK if the application is successfully obtained; returns error code otherwise.
140      */
GetApplicationInfosV9(int32_t flags,int32_t userId,std::vector<ApplicationInfo> & appInfos)141     virtual ErrCode GetApplicationInfosV9(
142         int32_t flags, int32_t userId, std::vector<ApplicationInfo> &appInfos)
143     {
144         return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
145     }
146     /**
147      * @brief Obtains the BundleInfo based on a given bundle name.
148      * @param bundleName Indicates the application bundle name to be queried.
149      * @param flag Indicates the information contained in the BundleInfo object to be returned.
150      * @param bundleInfo Indicates the obtained BundleInfo object.
151      * @param userId Indicates the user ID.
152      * @return Returns true if the BundleInfo is successfully obtained; returns false otherwise.
153      */
154     virtual bool GetBundleInfo(const std::string &bundleName, const BundleFlag flag,
155         BundleInfo &bundleInfo, int32_t userId = Constants::UNSPECIFIED_USERID)
156     {
157         return false;
158     }
159     /**
160      * @brief Obtains the BundleInfo based on a given bundle name.
161      * @param bundleName Indicates the application bundle name to be queried.
162      * @param flags Indicates the information contained in the BundleInfo object to be returned.
163      * @param bundleInfo Indicates the obtained BundleInfo object.
164      * @param userId Indicates the user ID.
165      * @return Returns true if the BundleInfo is successfully obtained; returns false otherwise.
166      */
167     virtual bool GetBundleInfo(const std::string &bundleName, int32_t flags,
168         BundleInfo &bundleInfo, int32_t userId = Constants::UNSPECIFIED_USERID)
169     {
170         return false;
171     }
172     /**
173      * @brief Obtains the BundleInfo based on a given bundle name.
174      * @param bundleName Indicates the application bundle name to be queried.
175      * @param flags Indicates the information contained in the BundleInfo object to be returned.
176      * @param bundleInfo Indicates the obtained BundleInfo object.
177      * @param userId Indicates the user ID.
178      * @return Returns ERR_OK if the BundleInfo is successfully obtained; returns error code otherwise.
179      */
GetBundleInfoV9(const std::string & bundleName,int32_t flags,BundleInfo & bundleInfo,int32_t userId)180     virtual ErrCode GetBundleInfoV9(const std::string &bundleName, int32_t flags,
181         BundleInfo &bundleInfo, int32_t userId)
182     {
183         return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
184     }
185     /**
186      * @brief Obtains the BundleInfos by the given want list through the proxy object.
187      * @param wants Indicates the imformation of the abilities to be queried.
188      * @param flags Indicates the information contained in the BundleInfo object to be returned.
189      * @param bundleInfos Indicates the obtained BundleInfo list object.
190      * @param userId Indicates the user ID.
191      * @return Returns ERR_OK if the BundleInfo is successfully obtained; returns error code otherwise.
192      */
BatchGetBundleInfo(const std::vector<Want> & wants,int32_t flags,std::vector<BundleInfo> & bundleInfos,int32_t userId)193     virtual ErrCode BatchGetBundleInfo(const std::vector<Want> &wants, int32_t flags,
194         std::vector<BundleInfo> &bundleInfos, int32_t userId)
195     {
196         return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
197     }
198     /**
199      * @brief Batch obtains the BundleInfos based on a given bundle name list.
200      * @param bundleNames Indicates the application bundle name list to be queried.
201      * @param flags Indicates the information contained in the BundleInfo object to be returned.
202      * @param bundleInfos Indicates the obtained BundleInfo list object.
203      * @param userId Indicates the user ID.
204      * @return Returns ERR_OK if the BundleInfo is successfully obtained; returns error code otherwise.
205      */
BatchGetBundleInfo(const std::vector<std::string> & bundleNames,int32_t flags,std::vector<BundleInfo> & bundleInfos,int32_t userId)206     virtual ErrCode BatchGetBundleInfo(const std::vector<std::string> &bundleNames, int32_t flags,
207         std::vector<BundleInfo> &bundleInfos, int32_t userId)
208     {
209         return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
210     }
211     /**
212      * @brief Obtains the BundleInfo for the calling app.
213      * @param bundleName Indicates the application bundle name to be queried.
214      * @param flags Indicates the information contained in the BundleInfo object to be returned.
215      * @param bundleInfo Indicates the obtained BundleInfo object.
216      * @param userId Indicates the user ID.
217      * @return Returns ERR_OK if the BundleInfo is successfully obtained; returns error code otherwise.
218      */
GetBundleInfoForSelf(int32_t flags,BundleInfo & bundleInfo)219     virtual ErrCode GetBundleInfoForSelf(int32_t flags, BundleInfo &bundleInfo)
220     {
221         return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
222     }
223     /**
224      * @brief Obtains the BundleInfo based on a given bundle name, which the calling app depends on.
225      * @param sharedBundleName Indicates the bundle name to be queried.
226      * @param sharedBundleInfo Indicates the obtained BundleInfo object.
227      * @param flag Indicates the flag, GetDependentBundleInfoFlag.
228      * @return Returns ERR_OK if the BundleInfo is successfully obtained; returns error code otherwise.
229      */
230     virtual ErrCode GetDependentBundleInfo(const std::string &sharedBundleName, BundleInfo &sharedBundleInfo,
231         GetDependentBundleInfoFlag flag = GetDependentBundleInfoFlag::GET_APP_CROSS_HSP_BUNDLE_INFO)
232     {
233         return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
234     }
235     /**
236      * @brief Obtains the BundlePackInfo based on a given bundle name.
237      * @param bundleName Indicates the application bundle name to be queried.
238      * @param flags Indicates the information contained in the BundleInfo object to be returned.
239      * @param BundlePackInfo Indicates the obtained BundlePackInfo object.
240      * @param userId Indicates the user ID.
241      * @return Returns ERR_OK if the BundlePackInfo is successfully obtained; returns other ErrCode otherwise.
242      */
243     virtual ErrCode GetBundlePackInfo(const std::string &bundleName, const BundlePackFlag flag,
244         BundlePackInfo &bundlePackInfo, int32_t userId = Constants::UNSPECIFIED_USERID)
245     {
246         return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
247     }
248 
249     /**
250      * @brief Obtains the BundlePackInfo based on a given bundle name.
251      * @param bundleName Indicates the application bundle name to be queried.
252      * @param flags Indicates the information contained in the BundleInfo object to be returned.
253      * @param BundlePackInfo Indicates the obtained BundlePackInfo object.
254      * @param userId Indicates the user ID.
255      * @return Returns ERR_OK if the BundlePackInfo is successfully obtained; returns other ErrCode otherwise.
256      */
257     virtual ErrCode GetBundlePackInfo(const std::string &bundleName, int32_t flags,
258         BundlePackInfo &bundlePackInfo, int32_t userId = Constants::UNSPECIFIED_USERID)
259     {
260         return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
261     }
262 
263     /**
264      * @brief Obtains BundleInfo of all bundles available in the system.
265      * @param flag Indicates the flag used to specify information contained in the BundleInfo that will be returned.
266      * @param bundleInfos Indicates all of the obtained BundleInfo objects.
267      * @param userId Indicates the user ID.
268      * @return Returns true if the BundleInfos is successfully obtained; returns false otherwise.
269      */
270     virtual bool GetBundleInfos(const BundleFlag flag,
271         std::vector<BundleInfo> &bundleInfos, int32_t userId = Constants::UNSPECIFIED_USERID)
272     {
273         return false;
274     }
275     /**
276      * @brief Obtains BundleInfo of all bundles available in the system.
277      * @param flags Indicates the flag used to specify information contained in the BundleInfo that will be returned.
278      * @param bundleInfos Indicates all of the obtained BundleInfo objects.
279      * @param userId Indicates the user ID.
280      * @return Returns true if the BundleInfos is successfully obtained; returns false otherwise.
281      */
282     virtual bool GetBundleInfos(int32_t flags,
283         std::vector<BundleInfo> &bundleInfos, int32_t userId = Constants::UNSPECIFIED_USERID)
284     {
285         return false;
286     }
287     /**
288      * @brief Obtains BundleInfo of all bundles available in the system.
289      * @param flags Indicates the flag used to specify information contained in the BundleInfo that will be returned.
290      * @param bundleInfos Indicates all of the obtained BundleInfo objects.
291      * @param userId Indicates the user ID.
292      * @return Returns ERR_OK if the BundleInfos is successfully obtained; returns error code otherwise.
293      */
GetBundleInfosV9(int32_t flags,std::vector<BundleInfo> & bundleInfos,int32_t userId)294     virtual ErrCode GetBundleInfosV9(int32_t flags, std::vector<BundleInfo> &bundleInfos, int32_t userId)
295     {
296         return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
297     }
298     /**
299      * @brief Obtains the application UID based on the given bundle name and user ID.
300      * @param bundleName Indicates the bundle name of the application.
301      * @param userId Indicates the user ID.
302      * @return Returns the uid if successfully obtained; returns -1 otherwise.
303      */
GetUidByBundleName(const std::string & bundleName,const int userId)304     virtual int GetUidByBundleName(const std::string &bundleName, const int userId)
305     {
306         return Constants::INVALID_UID;
307     }
308     /**
309      * @brief Obtains the application UID based on the given bundle name and user ID.
310      * @param bundleName Indicates the bundle name of the application.
311      * @param userId Indicates the user ID.
312      * @param userId Indicates the app Index.
313      * @return Returns the uid if successfully obtained; returns -1 otherwise.
314      */
GetUidByBundleName(const std::string & bundleName,const int32_t userId,int32_t appIndex)315     virtual int32_t GetUidByBundleName(const std::string &bundleName, const int32_t userId, int32_t appIndex)
316     {
317         return Constants::INVALID_UID;
318     }
319     /**
320      * @brief Obtains the debug application UID based on the given bundle name and user ID.
321      * @param bundleName Indicates the bundle name of the application.
322      * @param userId Indicates the user ID.
323      * @return Returns the uid if successfully obtained; returns -1 otherwise.
324      */
GetUidByDebugBundleName(const std::string & bundleName,const int userId)325     virtual int GetUidByDebugBundleName(const std::string &bundleName, const int userId)
326     {
327         return Constants::INVALID_UID;
328     }
329     /**
330      * @brief Obtains the application ID based on the given bundle name and user ID.
331      * @param bundleName Indicates the bundle name of the application.
332      * @param userId Indicates the user ID.
333      * @return Returns the application ID if successfully obtained; returns empty string otherwise.
334      */
GetAppIdByBundleName(const std::string & bundleName,const int userId)335     virtual std::string GetAppIdByBundleName(const std::string &bundleName, const int userId)
336     {
337         return Constants::EMPTY_STRING;
338     }
339     /**
340      * @brief Obtains the bundle name of a specified application based on the given UID.
341      * @param uid Indicates the uid.
342      * @param bundleName Indicates the obtained bundle name.
343      * @return Returns true if the bundle name is successfully obtained; returns false otherwise.
344      */
GetBundleNameForUid(const int uid,std::string & bundleName)345     virtual bool GetBundleNameForUid(const int uid, std::string &bundleName)
346     {
347         return false;
348     }
349     /**
350      * @brief Obtains all bundle names of a specified application based on the given application UID.
351      * @param uid Indicates the uid.
352      * @param bundleNames Indicates the obtained bundle names.
353      * @return Returns true if the bundle names is successfully obtained; returns false otherwise.
354      */
GetBundlesForUid(const int uid,std::vector<std::string> & bundleNames)355     virtual bool GetBundlesForUid(const int uid, std::vector<std::string> &bundleNames)
356     {
357         return false;
358     }
359     /**
360      * @brief Obtains the formal name associated with the given UID.
361      * @param uid Indicates the uid.
362      * @param name Indicates the obtained formal name.
363      * @return Returns ERR_OK if execute success; returns errCode otherwise.
364      */
GetNameForUid(const int uid,std::string & name)365     virtual ErrCode GetNameForUid(const int uid, std::string &name)
366     {
367         return ERR_BUNDLE_MANAGER_INTERNAL_ERROR;
368     }
369     /**
370      * @brief Obtains the formal name associated with the given UID.
371      * @param uid Indicates the uid.
372      * @param bundleName Indicates the obtained formal bundleName.
373      * @param name Indicates the obtained appIndex.
374      * @return Returns ERR_OK if execute success; returns errCode otherwise.
375      */
GetNameAndIndexForUid(const int32_t uid,std::string & bundleName,int32_t & appIndex)376     virtual ErrCode GetNameAndIndexForUid(const int32_t uid, std::string &bundleName, int32_t &appIndex)
377     {
378         return ERR_BUNDLE_MANAGER_INTERNAL_ERROR;
379     }
380     /**
381      * @brief Obtains an array of all group IDs associated with a specified bundle.
382      * @param bundleName Indicates the bundle name.
383      * @param gids Indicates the group IDs associated with the specified bundle.
384      * @return Returns true if the gids is successfully obtained; returns false otherwise.
385      */
GetBundleGids(const std::string & bundleName,std::vector<int> & gids)386     virtual bool GetBundleGids(const std::string &bundleName, std::vector<int> &gids)
387     {
388         return false;
389     }
390     /**
391      * @brief Obtains an array of all group IDs associated with the given bundle name and UID.
392      * @param bundleName Indicates the bundle name.
393      * @param uid Indicates the uid.
394      * @param gids Indicates the group IDs associated with the specified bundle.
395      * @return Returns true if the gids is successfully obtained; returns false otherwise.
396      */
GetBundleGidsByUid(const std::string & bundleName,const int & uid,std::vector<int> & gids)397     virtual bool GetBundleGidsByUid(const std::string &bundleName, const int &uid, std::vector<int> &gids)
398     {
399         return false;
400     }
401     /**
402      * @brief Obtains the type of a specified application based on the given bundle name.
403      * @param bundleName Indicates the bundle name.
404      * @return Returns "system" if the bundle is a system application; returns "third-party" otherwise.
405      */
GetAppType(const std::string & bundleName)406     virtual std::string GetAppType(const std::string &bundleName)
407     {
408         return Constants::EMPTY_STRING;
409     }
410     /**
411      * @brief Check whether the app is system app by it's UID.
412      * @param uid Indicates the uid.
413      * @return Returns true if the bundle is a system application; returns false otherwise.
414      */
CheckIsSystemAppByUid(const int uid)415     virtual bool CheckIsSystemAppByUid(const int uid)
416     {
417         return false;
418     }
419     /**
420      * @brief Obtains the BundleInfo of application bundles based on the specified metaData.
421      * @param metaData Indicates the metadata to get in the bundle.
422      * @param bundleInfos Indicates all of the obtained BundleInfo objects.
423      * @return Returns true if the BundleInfos is successfully obtained; returns false otherwise.
424      */
GetBundleInfosByMetaData(const std::string & metaData,std::vector<BundleInfo> & bundleInfos)425     virtual bool GetBundleInfosByMetaData(const std::string &metaData, std::vector<BundleInfo> &bundleInfos)
426     {
427         return false;
428     }
429     /**
430      * @brief Query the AbilityInfo by the given Want.
431      * @param want Indicates the information of the ability.
432      * @param abilityInfo Indicates the obtained AbilityInfo object.
433      * @return Returns true if the AbilityInfo is successfully obtained; returns false otherwise.
434      */
QueryAbilityInfo(const Want & want,AbilityInfo & abilityInfo)435     virtual bool QueryAbilityInfo(const Want &want, AbilityInfo &abilityInfo)
436     {
437         return false;
438     }
439     /**
440      * @brief Query the AbilityInfo by the given Want.
441      * @param want Indicates the information of the ability.
442      * @param flags Indicates the information contained in the AbilityInfo object to be returned.
443      * @param userId Indicates the user ID.
444      * @param abilityInfo Indicates the obtained AbilityInfo object.
445      * @param callBack Indicates the callback to be invoked for return ability manager service the operation result.
446      * @return Returns true if the AbilityInfo is successfully obtained; returns false otherwise.
447      */
QueryAbilityInfo(const Want & want,int32_t flags,int32_t userId,AbilityInfo & abilityInfo,const sptr<IRemoteObject> & callBack)448     virtual bool QueryAbilityInfo(const Want &want, int32_t flags, int32_t userId, AbilityInfo &abilityInfo,
449         const sptr<IRemoteObject> &callBack)
450     {
451         return false;
452     }
453     /**
454      * @brief Silent install by the given Want.
455      * @param want Indicates the information of the want.
456      * @param userId Indicates the user ID.
457      * @param callBack Indicates the callback to be invoked for return the operation result.
458      * @return Returns true if silent install successfully; returns false otherwise.
459      */
SilentInstall(const Want & want,int32_t userId,const sptr<IRemoteObject> & callBack)460     virtual bool SilentInstall(const Want &want, int32_t userId, const sptr<IRemoteObject> &callBack)
461     {
462         return false;
463     }
464     /**
465      * @brief Upgrade atomic service
466      * @param want Indicates the information of the ability.
467      * @param userId Indicates the user ID.
468      */
UpgradeAtomicService(const Want & want,int32_t userId)469     virtual void UpgradeAtomicService(const Want &want, int32_t userId)
470     {
471         return;
472     }
473     /**
474      * @brief Query the AbilityInfo by the given Want.
475      * @param want Indicates the information of the ability.
476      * @param flags Indicates the information contained in the AbilityInfo object to be returned.
477      * @param userId Indicates the user ID.
478      * @param abilityInfo Indicates the obtained AbilityInfo object.
479      * @return Returns true if the AbilityInfo is successfully obtained; returns false otherwise.
480      */
QueryAbilityInfo(const Want & want,int32_t flags,int32_t userId,AbilityInfo & abilityInfo)481     virtual bool QueryAbilityInfo(const Want &want, int32_t flags, int32_t userId, AbilityInfo &abilityInfo)
482     {
483         return false;
484     }
485     /**
486      * @brief Query the AbilityInfo of list by the given Want.
487      * @param want Indicates the information of the ability.
488      * @param abilityInfos Indicates the obtained AbilityInfos object.
489      * @return Returns true if the AbilityInfos is successfully obtained; returns false otherwise.
490      */
QueryAbilityInfos(const Want & want,std::vector<AbilityInfo> & abilityInfos)491     virtual bool QueryAbilityInfos(const Want &want, std::vector<AbilityInfo> &abilityInfos)
492     {
493         return false;
494     }
495     /**
496      * @brief Query the AbilityInfo of list by the given Want.
497      * @param want Indicates the information of the ability.
498      * @param flags Indicates the information contained in the AbilityInfo object to be returned.
499      * @param userId Indicates the user ID.
500      * @param abilityInfos Indicates the obtained AbilityInfos object.
501      * @return Returns true if the AbilityInfos is successfully obtained; returns false otherwise.
502      */
QueryAbilityInfos(const Want & want,int32_t flags,int32_t userId,std::vector<AbilityInfo> & abilityInfos)503     virtual bool QueryAbilityInfos(
504         const Want &want, int32_t flags, int32_t userId, std::vector<AbilityInfo> &abilityInfos)
505     {
506         return false;
507     }
508     /**
509      * @brief Query the AbilityInfo of list by the given Want.
510      * @param want Indicates the information of the ability.
511      * @param flags Indicates the information contained in the AbilityInfo object to be returned.
512      * @param userId Indicates the user ID.
513      * @param abilityInfos Indicates the obtained AbilityInfos object.
514      * @return Returns ERR_OK if the AbilityInfos is successfully obtained; returns errCode otherwise.
515      */
QueryAbilityInfosV9(const Want & want,int32_t flags,int32_t userId,std::vector<AbilityInfo> & abilityInfos)516     virtual ErrCode QueryAbilityInfosV9(
517         const Want &want, int32_t flags, int32_t userId, std::vector<AbilityInfo> &abilityInfos)
518     {
519         return ERR_BUNDLE_MANAGER_INTERNAL_ERROR;
520     }
521     /**
522      * @brief Query the AbilityInfo of list by the given Wants.
523      * @param want Indicates the information of the ability.
524      * @param flags Indicates the information contained in the AbilityInfo object to be returned.
525      * @param userId Indicates the user ID.
526      * @param abilityInfos Indicates the obtained AbilityInfos object.
527      * @return Returns ERR_OK if the AbilityInfos is successfully obtained; returns errCode otherwise.
528      */
BatchQueryAbilityInfos(const std::vector<Want> & wants,int32_t flags,int32_t userId,std::vector<AbilityInfo> & abilityInfos)529     virtual ErrCode BatchQueryAbilityInfos(
530         const std::vector<Want> &wants, int32_t flags, int32_t userId, std::vector<AbilityInfo> &abilityInfos)
531     {
532         return ERR_BUNDLE_MANAGER_INTERNAL_ERROR;
533     }
534 
QueryLauncherAbilityInfos(const Want & want,int32_t userId,std::vector<AbilityInfo> & abilityInfo)535     virtual ErrCode QueryLauncherAbilityInfos(
536         const Want &want, int32_t userId, std::vector<AbilityInfo> &abilityInfo)
537     {
538         return ERR_BUNDLE_MANAGER_INTERNAL_ERROR;
539     }
540     /**
541      * @brief Query the AllAbilityInfos of list by the given userId.
542      * @param userId Indicates the information of the user.
543      * @param abilityInfos Indicates the obtained AbilityInfos object.
544      * @return Returns true if the AbilityInfos is successfully obtained; returns false otherwise.
545      */
QueryAllAbilityInfos(const Want & want,int32_t userId,std::vector<AbilityInfo> & abilityInfos)546     virtual bool QueryAllAbilityInfos(const Want &want, int32_t userId, std::vector<AbilityInfo> &abilityInfos)
547     {
548         return false;
549     }
550     /**
551      * @brief Query the AbilityInfo by ability.uri in config.json.
552      * @param abilityUri Indicates the uri of the ability.
553      * @param abilityInfo Indicates the obtained AbilityInfo object.
554      * @return Returns true if the AbilityInfo is successfully obtained; returns false otherwise.
555      */
QueryAbilityInfoByUri(const std::string & abilityUri,AbilityInfo & abilityInfo)556     virtual bool QueryAbilityInfoByUri(const std::string &abilityUri, AbilityInfo &abilityInfo)
557     {
558         return false;
559     }
560     /**
561      * @brief Query the AbilityInfo by ability.uri in config.json.
562      * @param abilityUri Indicates the uri of the ability.
563      * @param userId Indicates the user ID.
564      * @param abilityInfo Indicates the obtained AbilityInfo object.
565      * @return Returns true if the AbilityInfo is successfully obtained; returns false otherwise.
566      */
QueryAbilityInfoByUri(const std::string & abilityUri,int32_t userId,AbilityInfo & abilityInfo)567     virtual bool QueryAbilityInfoByUri(const std::string &abilityUri, int32_t userId, AbilityInfo &abilityInfo)
568     {
569         return true;
570     };
571     /**
572      * @brief Query the AbilityInfo by ability.uri in config.json.
573      * @param abilityUri Indicates the uri of the ability.
574      * @param abilityInfos Indicates the obtained AbilityInfos object.
575      * @return Returns true if the AbilityInfo is successfully obtained; returns false otherwise.
576      */
QueryAbilityInfosByUri(const std::string & abilityUri,std::vector<AbilityInfo> & abilityInfos)577     virtual bool QueryAbilityInfosByUri(const std::string &abilityUri, std::vector<AbilityInfo> &abilityInfos)
578     {
579         return false;
580     }
581     /**
582      * @brief Obtains the BundleInfo of all keep-alive applications in the system.
583      * @param bundleInfos Indicates all of the obtained BundleInfo objects.
584      * @return Returns true if the BundleInfos is successfully obtained; returns false otherwise.
585      */
QueryKeepAliveBundleInfos(std::vector<BundleInfo> & bundleInfos)586     virtual bool QueryKeepAliveBundleInfos(std::vector<BundleInfo> &bundleInfos)
587     {
588         return false;
589     }
590     /**
591      * @brief Obtains the label of a specified ability.
592      * @param bundleName Indicates the bundle name.
593      * @param abilityName Indicates the ability name.
594      * @return Returns the label of the ability if exist; returns empty string otherwise.
595      */
GetAbilityLabel(const std::string & bundleName,const std::string & abilityName)596     virtual std::string GetAbilityLabel(const std::string &bundleName, const std::string &abilityName)
597     {
598         return Constants::EMPTY_STRING;
599     }
600     /**
601      * @brief Obtains the label of a specified ability.
602      * @param bundleName Indicates the bundle name.
603      * @param moduleName Indicates the module name.
604      * @param abilityName Indicates the ability name.
605      * @param label Indicates the obtained label.
606      * @return Returns ERR_OK if called successfully; returns error code otherwise.
607      */
GetAbilityLabel(const std::string & bundleName,const std::string & moduleName,const std::string & abilityName,std::string & label)608     virtual ErrCode GetAbilityLabel(const std::string &bundleName, const std::string &moduleName,
609         const std::string &abilityName, std::string &label)
610     {
611         return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
612     }
613     /**
614      * @brief Obtains information about an application bundle contained in an ohos Ability Package (HAP).
615      * @param hapFilePath Indicates the absolute file path of the HAP.
616      * @param flag Indicates the information contained in the BundleInfo object to be returned.
617      * @param bundleInfo Indicates the obtained BundleInfo object.
618      * @return Returns true if the BundleInfo is successfully obtained; returns false otherwise.
619      */
GetBundleArchiveInfo(const std::string & hapFilePath,const BundleFlag flag,BundleInfo & bundleInfo)620     virtual bool GetBundleArchiveInfo(
621         const std::string &hapFilePath, const BundleFlag flag, BundleInfo &bundleInfo)
622     {
623         return false;
624     }
625     /**
626      * @brief Obtains information about an application bundle contained in an ohos Ability Package (HAP).
627      * @param hapFilePath Indicates the absolute file path of the HAP.
628      * @param flags Indicates the information contained in the BundleInfo object to be returned.
629      * @param bundleInfo Indicates the obtained BundleInfo object.
630      * @return Returns true if the BundleInfo is successfully obtained; returns false otherwise.
631      */
GetBundleArchiveInfo(const std::string & hapFilePath,int32_t flags,BundleInfo & bundleInfo)632     virtual bool GetBundleArchiveInfo(
633         const std::string &hapFilePath, int32_t flags, BundleInfo &bundleInfo)
634     {
635         return false;
636     }
637     /**
638      * @brief Obtains information about an application bundle contained in an ohos Ability Package (HAP).
639      * @param hapFilePath Indicates the absolute file path of the HAP.
640      * @param flags Indicates the information contained in the BundleInfo object to be returned.
641      * @param bundleInfo Indicates the obtained BundleInfo object.
642      * @return Returns ERR_OK if this function is successfully called; returns errCode otherwise.
643      */
GetBundleArchiveInfoV9(const std::string & hapFilePath,int32_t flags,BundleInfo & bundleInfo)644     virtual ErrCode GetBundleArchiveInfoV9(
645         const std::string &hapFilePath, int32_t flags, BundleInfo &bundleInfo)
646     {
647         return ERR_BUNDLE_MANAGER_INTERNAL_ERROR;
648     }
649     /**
650      * @brief Obtain the HAP module info of a specific ability.
651      * @param abilityInfo Indicates the ability.
652      * @param hapModuleInfo Indicates the obtained HapModuleInfo object.
653      * @return Returns true if the HapModuleInfo is successfully obtained; returns false otherwise.
654      */
GetHapModuleInfo(const AbilityInfo & abilityInfo,HapModuleInfo & hapModuleInfo)655     virtual bool GetHapModuleInfo(const AbilityInfo &abilityInfo, HapModuleInfo &hapModuleInfo)
656     {
657         return false;
658     }
659     /**
660      * @brief Obtain the HAP module info of a specific ability.
661      * @param abilityInfo Indicates the ability.
662      * @param userId Indicates the userId.
663      * @param hapModuleInfo Indicates the obtained HapModuleInfo object.
664      * @return Returns true if the HapModuleInfo is successfully obtained; returns false otherwise.
665      */
GetHapModuleInfo(const AbilityInfo & abilityInfo,int32_t userId,HapModuleInfo & hapModuleInfo)666     virtual bool GetHapModuleInfo(const AbilityInfo &abilityInfo, int32_t userId, HapModuleInfo &hapModuleInfo)
667     {
668         return false;
669     }
670     /**
671      * @brief Obtains the Want for starting the main ability of an application based on the given bundle name.
672      * @param bundleName Indicates the bundle name.
673      * @param want Indicates the obtained launch Want object.
674      * @param userId Indicates the userId.
675      * @return Returns ERR_OK if this function is successfully called; returns errCode otherwise.
676      */
677     virtual ErrCode GetLaunchWantForBundle(
678         const std::string &bundleName, Want &want, int32_t userId = Constants::UNSPECIFIED_USERID)
679     {
680         return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
681     }
682     /**
683      * @brief Obtains detailed information about a specified permission.
684      * @param permissionName Indicates the name of the ohos permission.
685      * @param permissionDef Indicates the object containing detailed information about the given ohos permission.
686      * @return Returns ERR_OK if the PermissionDef object is successfully obtained; returns other ErrCode otherwise.
687      */
GetPermissionDef(const std::string & permissionName,PermissionDef & permissionDef)688     virtual ErrCode GetPermissionDef(const std::string &permissionName, PermissionDef &permissionDef)
689     {
690         return ERR_OK;
691     }
692     /**
693      * @brief Clears cache data of a specified application.
694      * @param bundleName Indicates the bundle name of the application whose cache data is to be cleared.
695      * @param cleanCacheCallback Indicates the callback to be invoked for returning the operation result.
696      * @param userId description the user id.
697      * @param appIndex Indicates the app index.
698      * @return Returns ERR_OK if this function is successfully called; returns other ErrCode otherwise.
699      */
700     virtual ErrCode CleanBundleCacheFiles(
701         const std::string &bundleName, const sptr<ICleanCacheCallback> cleanCacheCallback,
702         int32_t userId = Constants::UNSPECIFIED_USERID, int32_t appIndex = 0)
703     {
704         return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
705     }
706     /**
707      * @brief Clears cache data of a specified size.
708      * @param cacheSize Indicates the size of the cache data is to be cleared.
709      * @return Returns ERR_OK if this function is successfully called; returns other ErrCode otherwise.
710      */
CleanBundleCacheFilesAutomatic(uint64_t cacheSize)711     virtual ErrCode CleanBundleCacheFilesAutomatic(uint64_t cacheSize)
712     {
713         return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
714     }
715     /**
716      * @brief Clears application running data of a specified application.
717      * @param bundleName Indicates the bundle name of the application whose data is to be cleared.
718      * @param userId Indicates the user id.
719      * @param appIndex Indicates the app index.
720      * @return Returns true if the data cleared successfully; returns false otherwise.
721      */
722     virtual bool CleanBundleDataFiles(const std::string &bundleName, const int userId = 0, const int appIndex = 0)
723     {
724         return false;
725     }
726     /**
727      * @brief Register the specific bundle status callback.
728      * @param bundleStatusCallback Indicates the callback to be invoked for returning the bundle status changed result.
729      * @return Returns true if this function is successfully called; returns false otherwise.
730      */
RegisterBundleStatusCallback(const sptr<IBundleStatusCallback> & bundleStatusCallback)731     virtual bool RegisterBundleStatusCallback(const sptr<IBundleStatusCallback> &bundleStatusCallback)
732     {
733         return false;
734     }
735 
RegisterBundleEventCallback(const sptr<IBundleEventCallback> & bundleEventCallback)736     virtual bool RegisterBundleEventCallback(const sptr<IBundleEventCallback> &bundleEventCallback)
737     {
738         return false;
739     }
740 
UnregisterBundleEventCallback(const sptr<IBundleEventCallback> & bundleEventCallback)741     virtual bool UnregisterBundleEventCallback(const sptr<IBundleEventCallback> &bundleEventCallback)
742     {
743         return false;
744     }
745     /**
746      * @brief Clear the specific bundle status callback.
747      * @param bundleStatusCallback Indicates the callback to be cleared.
748      * @return Returns true if this function is successfully called; returns false otherwise.
749      */
ClearBundleStatusCallback(const sptr<IBundleStatusCallback> & bundleStatusCallback)750     virtual bool ClearBundleStatusCallback(const sptr<IBundleStatusCallback> &bundleStatusCallback)
751     {
752         return false;
753     }
754     /**
755      * @brief Unregister all the callbacks of status changed.
756      * @return Returns true if this function is successfully called; returns false otherwise.
757      */
UnregisterBundleStatusCallback()758     virtual bool UnregisterBundleStatusCallback()
759     {
760         return false;
761     }
762 
763     /**
764      * @brief Obtains the value of isRemovable based on a given bundle name and module name.
765      * @param bundleName Indicates the bundle name to be queried.
766      * @param moduleName Indicates the module name to be queried.
767      * @param isRemovable Indicates the module whether is removable.
768      * @return Returns ERR_OK if the isRemovable is successfully obtained; returns other ErrCode otherwise.
769      */
IsModuleRemovable(const std::string & bundleName,const std::string & moduleName,bool & isRemovable)770     virtual ErrCode IsModuleRemovable(const std::string &bundleName, const std::string &moduleName, bool &isRemovable)
771     {
772         return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
773     }
774     /**
775      * @brief Sets whether to enable isRemovable based on a given bundle name and module name.
776      * @param bundleName Indicates the bundle name to be queried.
777      * @param moduleName Indicates the module name to be queried.
778      * @param isEnable Specifies whether to enable the isRemovable of InnerModuleInfo.
779      *                 The value true means to enable it, and the value false means to disable it
780      * @return Returns true if the isRemovable is successfully obtained; returns false otherwise.
781      */
SetModuleRemovable(const std::string & bundleName,const std::string & moduleName,bool isEnable)782     virtual bool SetModuleRemovable(
783         const std::string &bundleName, const std::string &moduleName, bool isEnable)
784     {
785         return false;
786     }
787 
788     /**
789      * @brief Dump the bundle informations with specific flags.
790      * @param flag Indicates the information contained in the dump result.
791      * @param bundleName Indicates the bundle name if needed.
792      * @param userId Indicates the user ID.
793      * @param result Indicates the dump information result.
794      * @return Returns true if the dump result is successfully obtained; returns false otherwise.
795      */
DumpInfos(const DumpFlag flag,const std::string & bundleName,int32_t userId,std::string & result)796     virtual bool DumpInfos(
797         const DumpFlag flag, const std::string &bundleName, int32_t userId, std::string &result)
798     {
799         return false;
800     }
801     /**
802      * @brief Compile the bundle informations with specific flags.
803      * @param bundleName Indicates the bundle name if needed.
804      * @param compileMode Indicates the mode name.
805      * @param isAllBundle Does it represent all bundlenames.
806      * @return Returns true if the compile result is successfully obtained; returns false otherwise.
807      */
CompileProcessAOT(const std::string & bundleName,const std::string & compileMode,bool isAllBundle,std::vector<std::string> & compileResults)808     virtual ErrCode CompileProcessAOT(const std::string &bundleName, const std::string &compileMode,
809         bool isAllBundle, std::vector<std::string> &compileResults)
810     {
811         return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
812     }
813     /**
814      * @brief Reset the bundle informations with specific flags.
815      * @param bundleName Indicates the bundle name if needed.
816      * @param isAllBundle Does it represent all bundlenames.
817      * @return Returns true if the reset result is successfully obtained; returns false otherwise.
818      */
CompileReset(const std::string & bundleName,bool isAllBundle)819     virtual ErrCode CompileReset(const std::string &bundleName, bool isAllBundle)
820     {
821         return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
822     }
823     /**
824      * @brief copy ap file to /data/local/pgo
825      * @param bundleName Indicates the bundle name if needed.
826      * @param isAllBundle Does it represent all bundlenames.
827      * @param results Indicates the copy ap information result.
828      * @return Returns ERR_OK if called successfully; returns error code otherwise.
829      */
CopyAp(const std::string & bundleName,bool isAllBundle,std::vector<std::string> & results)830     virtual ErrCode CopyAp(const std::string &bundleName, bool isAllBundle, std::vector<std::string> &results)
831     {
832         return ERR_BUNDLE_MANAGER_INTERNAL_ERROR;
833     }
834     /**
835      * @brief Checks whether a specified application is enabled.
836      * @param bundleName Indicates the bundle name of the application.
837      * @param isEnable Indicates the application status is enabled.
838      * @return Returns result of the operation.
839      */
IsApplicationEnabled(const std::string & bundleName,bool & isEnable)840     virtual ErrCode IsApplicationEnabled(const std::string &bundleName, bool &isEnable)
841     {
842         return ERR_OK;
843     }
844     /**
845      * @brief Checks whether a specified clone application is enabled.
846      * @param bundleName Indicates the bundle name of the application.
847      * @param appIndex Indicates the app index of clone applications.
848      * @param isEnable Indicates the application status is enabled.
849      * @return Returns result of the operation.
850      */
IsCloneApplicationEnabled(const std::string & bundleName,int32_t appIndex,bool & isEnable)851     virtual ErrCode IsCloneApplicationEnabled(const std::string &bundleName, int32_t appIndex, bool &isEnable)
852     {
853         return ERR_OK;
854     }
855     /**
856      * @brief Sets whether to enable a specified application.
857      * @param bundleName Indicates the bundle name of the application.
858      * @param isEnable Specifies whether to enable the application.
859      *                 The value true means to enable it, and the value false means to disable it.
860      * @param userId description the user id.
861      * @return Returns result of the operation.
862      */
863     virtual ErrCode SetApplicationEnabled(const std::string &bundleName, bool isEnable,
864         int32_t userId = Constants::UNSPECIFIED_USERID)
865     {
866         return ERR_OK;
867     }
868     /**
869      * @brief Sets whether to enable a specified clone application.
870      * @param bundleName Indicates the bundle name of the application.
871      * @param appIndex Indicates the app index of clone applications.
872      * @param isEnable Specifies whether to enable the application.
873      *                 The value true means to enable it, and the value false means to disable it.
874      * @param userId description the user id.
875      * @return Returns result of the operation.
876      */
877     virtual ErrCode SetCloneApplicationEnabled(const std::string &bundleName, int32_t appIndex, bool isEnable,
878         int32_t userId = Constants::UNSPECIFIED_USERID)
879     {
880         return ERR_OK;
881     }
882     /**
883      * @brief Sets whether to enable a specified ability.
884      * @param abilityInfo Indicates information about the ability to check.
885      * @param isEnable Indicates the ability status is enabled.
886      * @return Returns result of the operation.
887      */
IsAbilityEnabled(const AbilityInfo & abilityInfo,bool & isEnable)888     virtual ErrCode IsAbilityEnabled(const AbilityInfo &abilityInfo, bool &isEnable)
889     {
890         return ERR_OK;
891     }
892     /**
893      * @brief Sets whether to enable a specified ability.
894      * @param abilityInfo Indicates information about the ability to check.
895      * @param appIndex Indicates the app index of clone applications.
896      * @param isEnable Indicates the ability status is enabled.
897      * @return Returns result of the operation.
898      */
IsCloneAbilityEnabled(const AbilityInfo & abilityInfo,int32_t appIndex,bool & isEnable)899     virtual ErrCode IsCloneAbilityEnabled(const AbilityInfo &abilityInfo, int32_t appIndex, bool &isEnable)
900     {
901         return ERR_OK;
902     }
903     /**
904      * @brief Sets whether to enable a specified ability.
905      * @param abilityInfo Indicates information about the ability.
906      * @param isEnabled Specifies whether to enable the ability.
907      *                 The value true means to enable it, and the value false means to disable it.
908      * @param userId description the user id.
909      * @return Returns result of the operation.
910      */
911     virtual ErrCode SetAbilityEnabled(const AbilityInfo &abilityInfo, bool isEnabled,
912         int32_t userId = Constants::UNSPECIFIED_USERID)
913     {
914         return ERR_OK;
915     }
916     /**
917      * @brief Sets whether to enable a specified ability.
918      * @param abilityInfo Indicates information about the ability.
919      * @param appIndex Indicates the app index of clone applications.
920      * @param isEnabled Specifies whether to enable the ability.
921      *                 The value true means to enable it, and the value false means to disable it.
922      * @param userId description the user id.
923      * @return Returns result of the operation.
924      */
925     virtual ErrCode SetCloneAbilityEnabled(const AbilityInfo &abilityInfo, int32_t appIndex, bool isEnabled,
926         int32_t userId = Constants::UNSPECIFIED_USERID)
927     {
928         return ERR_OK;
929     }
930     /**
931      * @brief Obtains the FormInfo objects provided by all applications on the device.
932      * @param formInfo list of FormInfo objects if obtained; returns an empty List if no FormInfo is available on the
933      * device.
934      * @return Returns true if this function is successfully called; returns false otherwise.
935      */
GetAllFormsInfo(std::vector<FormInfo> & formInfos)936     virtual bool GetAllFormsInfo(std::vector<FormInfo> &formInfos)
937     {
938         return false;
939     }
940     /**
941      * @brief Obtains the FormInfo objects provided by a specified application on the device.
942      * @param bundleName Indicates the bundle name of the application.
943      * @param formInfo list of FormInfo objects if obtained; returns an empty List if no FormInfo is available on the
944      * device.
945      * @return Returns true if this function is successfully called; returns false otherwise.
946      */
GetFormsInfoByApp(const std::string & bundleName,std::vector<FormInfo> & formInfos)947     virtual bool GetFormsInfoByApp(const std::string &bundleName, std::vector<FormInfo> &formInfos)
948     {
949         return false;
950     }
951     /**
952      * @brief Obtains the FormInfo objects provided by a specified.
953      * @param formInfo list of FormInfo objects if obtained; returns an empty List if no FormInfo is available on the
954      * device.
955      * @param moduleName Indicates the module name of the application.
956      * @param bundleName Indicates the bundle name of the application.
957      * @return Returns true if this function is successfully called; returns false otherwise.
958      */
GetFormsInfoByModule(const std::string & bundleName,const std::string & moduleName,std::vector<FormInfo> & formInfos)959     virtual bool GetFormsInfoByModule(
960         const std::string &bundleName, const std::string &moduleName, std::vector<FormInfo> &formInfos)
961     {
962         return false;
963     }
964     /**
965      * @brief Obtains the ShortcutInfo objects provided by a specified application on the device.
966      * @param bundleName Indicates the bundle name of the application.
967      * @param shortcutInfos List of ShortcutInfo objects if obtained.
968      * @return Returns true if this function is successfully called; returns false otherwise.
969      */
GetShortcutInfos(const std::string & bundleName,std::vector<ShortcutInfo> & shortcutInfos)970     virtual bool GetShortcutInfos(const std::string &bundleName, std::vector<ShortcutInfo> &shortcutInfos)
971     {
972         return false;
973     }
974 
975     virtual ErrCode GetShortcutInfoV9(const std::string &bundleName,
976         std::vector<ShortcutInfo> &shortcutInfos, int32_t userId = Constants::UNSPECIFIED_USERID)
977     {
978         return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
979     }
980     /**
981      * @brief Obtains the CommonEventInfo objects provided by an event key on the device.
982      * @param eventKey Indicates the event of the subscribe.
983      * @param commonEventInfos List of CommonEventInfo objects if obtained.
984      * @return Returns true if this function is successfully called; returns false otherwise.
985      */
GetAllCommonEventInfo(const std::string & eventKey,std::vector<CommonEventInfo> & commonEventInfos)986     virtual bool GetAllCommonEventInfo(const std::string &eventKey, std::vector<CommonEventInfo> &commonEventInfos)
987     {
988         return false;
989     }
990     /**
991      * @brief Obtains the interface used to install and uninstall bundles.
992      * @return Returns a pointer to IBundleInstaller class if exist; returns nullptr otherwise.
993      */
GetBundleInstaller()994     virtual sptr<IBundleInstaller> GetBundleInstaller()
995     {
996         return nullptr;
997     }
998     /**
999      * @brief Obtains the interface used to create or delete user.
1000      * @return Returns a pointer to IBundleUserMgr class if exist; returns nullptr otherwise.
1001      */
GetBundleUserMgr()1002     virtual sptr<IBundleUserMgr> GetBundleUserMgr()
1003     {
1004         return nullptr;
1005     }
1006     /**
1007      * @brief Obtains the VerifyManager.
1008      * @return Returns a pointer to VerifyManager class if exist; returns nullptr otherwise.
1009      */
GetVerifyManager()1010     virtual sptr<IVerifyManager> GetVerifyManager()
1011     {
1012         return nullptr;
1013     }
1014     /**
1015      * @brief Obtains the DistributedBundleInfo based on a given bundle name and networkId.
1016      * @param networkId Indicates the networkId of remote device.
1017      * @param bundleName Indicates the application bundle name to be queried.
1018      * @param distributedBundleInfo Indicates the obtained DistributedBundleInfo object.
1019      * @return Returns true if the DistributedBundleInfo is successfully obtained; returns false otherwise.
1020      */
GetDistributedBundleInfo(const std::string & networkId,const std::string & bundleName,DistributedBundleInfo & distributedBundleInfo)1021     virtual bool GetDistributedBundleInfo(const std::string &networkId, const std::string &bundleName,
1022         DistributedBundleInfo &distributedBundleInfo)
1023     {
1024         return false;
1025     }
1026     /**
1027      * @brief Get app privilege level.
1028      * @param bundleName Indicates the bundle name of the app privilege level.
1029      * @param userId Indicates the user id.
1030      * @return Returns app privilege level.
1031      */
1032     virtual std::string GetAppPrivilegeLevel(
1033         const std::string &bundleName, int32_t userId = Constants::UNSPECIFIED_USERID)
1034     {
1035         return Constants::EMPTY_STRING;
1036     }
1037     /**
1038      * @brief Query extension info.
1039      * @param Want Indicates the information of extension info.
1040      * @param flag Indicates the query flag which will fliter any specified stuff in the extension info.
1041      * @param userId Indicates the userId in the system.
1042      * @param extensionInfos Indicates the obtained extensions.
1043      * @return Returns true if this function is successfully called; returns false otherwise.
1044      */
QueryExtensionAbilityInfos(const Want & want,const int32_t & flag,const int32_t & userId,std::vector<ExtensionAbilityInfo> & extensionInfos)1045     virtual bool QueryExtensionAbilityInfos(const Want &want, const int32_t &flag, const int32_t &userId,
1046         std::vector<ExtensionAbilityInfo> &extensionInfos)
1047     {
1048         return true;
1049     }
1050     /**
1051      * @brief Query extension info.
1052      * @param Want Indicates the information of extension info.
1053      * @param flags Indicates the query flag which will filter any specified stuff in the extension info.
1054      * @param userId Indicates the userId in the system.
1055      * @param extensionInfos Indicates the obtained extensions.
1056      * @return Returns ERR_OK if this function is successfully called; returns errCode otherwise.
1057      */
QueryExtensionAbilityInfosV9(const Want & want,int32_t flags,int32_t userId,std::vector<ExtensionAbilityInfo> & extensionInfos)1058     virtual ErrCode QueryExtensionAbilityInfosV9(const Want &want, int32_t flags, int32_t userId,
1059         std::vector<ExtensionAbilityInfo> &extensionInfos)
1060     {
1061         return ERR_BUNDLE_MANAGER_INTERNAL_ERROR;
1062     }
1063     /**
1064      * @brief Query extension info.
1065      * @param Want Indicates the information of extension info.
1066      * @param extensionType Indicates the type of the extension.
1067      * @param flag Indicates the query flag which will fliter any specified stuff in the extension info.
1068      * @param userId Indicates the userId in the system.
1069      * @param extensionInfos Indicates the obtained extensions.
1070      * @return Returns true if this function is successfully called; returns false otherwise.
1071      */
QueryExtensionAbilityInfos(const Want & want,const ExtensionAbilityType & extensionType,const int32_t & flag,const int32_t & userId,std::vector<ExtensionAbilityInfo> & extensionInfos)1072     virtual bool QueryExtensionAbilityInfos(const Want &want, const ExtensionAbilityType &extensionType,
1073         const int32_t &flag, const int32_t &userId, std::vector<ExtensionAbilityInfo> &extensionInfos)
1074     {
1075         return true;
1076     }
1077     /**
1078      * @brief Query extension info.
1079      * @param Want Indicates the information of extension info.
1080      * @param extensionType Indicates the type of the extension.
1081      * @param flags Indicates the query flag which will filter any specified stuff in the extension info.
1082      * @param userId Indicates the userId in the system.
1083      * @param extensionInfos Indicates the obtained extensions.
1084      * @return Returns ERR_OK if this function is successfully called; returns errCode otherwise.
1085      */
QueryExtensionAbilityInfosV9(const Want & want,const ExtensionAbilityType & extensionType,int32_t flags,int32_t userId,std::vector<ExtensionAbilityInfo> & extensionInfos)1086     virtual ErrCode QueryExtensionAbilityInfosV9(const Want &want, const ExtensionAbilityType &extensionType,
1087         int32_t flags, int32_t userId, std::vector<ExtensionAbilityInfo> &extensionInfos)
1088     {
1089         return ERR_BUNDLE_MANAGER_INTERNAL_ERROR;
1090     }
QueryExtensionAbilityInfos(const ExtensionAbilityType & extensionType,const int32_t & userId,std::vector<ExtensionAbilityInfo> & extensionInfos)1091     virtual bool QueryExtensionAbilityInfos(const ExtensionAbilityType &extensionType, const int32_t &userId,
1092         std::vector<ExtensionAbilityInfo> &extensionInfos)
1093     {
1094         return true;
1095     }
1096 
VerifyCallingPermission(const std::string & permission)1097     virtual bool VerifyCallingPermission(const std::string &permission)
1098     {
1099         return true;
1100     }
1101 
1102     /**
1103      * @brief Verify whether the calling app is system app. Only for BMS usage.
1104      *
1105      * @param beginApiVersion Indicates version since this api became to be system api.
1106      * @param bundleName Indicates bundle name of the calling hap.
1107      * @return Returns true if the hap passes the verification; returns false otherwise.
1108      */
1109     virtual bool VerifySystemApi(int32_t beginApiVersion = Constants::INVALID_API_VERSION)
1110     {
1111         return true;
1112     }
1113 
1114     /**
1115      * @brief Obtains the dependent module names.
1116      *
1117      * @param bundleName Indicates the bundle name to be queried.
1118      * @param moduleName Indicates the module name to be queried.
1119      * @param dependentModuleNames Indicates the obtained dependent module names.
1120      * @return Returns true if this function is successfully called; returns false otherwise.
1121      */
GetAllDependentModuleNames(const std::string & bundleName,const std::string & moduleName,std::vector<std::string> & dependentModuleNames)1122     virtual bool GetAllDependentModuleNames(const std::string &bundleName, const std::string &moduleName,
1123         std::vector<std::string> &dependentModuleNames)
1124     {
1125         return false;
1126     }
1127 
QueryExtensionAbilityInfoByUri(const std::string & uri,int32_t userId,ExtensionAbilityInfo & extensionAbilityInfo)1128     virtual bool QueryExtensionAbilityInfoByUri(const std::string &uri, int32_t userId,
1129         ExtensionAbilityInfo &extensionAbilityInfo)
1130     {
1131         return false;
1132     }
1133 
ImplicitQueryInfoByPriority(const Want & want,int32_t flags,int32_t userId,AbilityInfo & abilityInfo,ExtensionAbilityInfo & extensionInfo)1134     virtual bool ImplicitQueryInfoByPriority(const Want &want, int32_t flags, int32_t userId,
1135         AbilityInfo &abilityInfo, ExtensionAbilityInfo &extensionInfo)
1136     {
1137         return false;
1138     }
1139 
ImplicitQueryInfos(const Want & want,int32_t flags,int32_t userId,bool withDefault,std::vector<AbilityInfo> & abilityInfos,std::vector<ExtensionAbilityInfo> & extensionInfos,bool & findDefaultApp)1140     virtual bool ImplicitQueryInfos(const Want &want, int32_t flags, int32_t userId, bool withDefault,
1141         std::vector<AbilityInfo> &abilityInfos, std::vector<ExtensionAbilityInfo> &extensionInfos,
1142         bool &findDefaultApp)
1143     {
1144         return false;
1145     }
1146 
1147     /**
1148      * @brief Obtains the AbilityInfo based on a given bundle name.
1149      * @param bundleName Indicates the bundle name to be queried.
1150      * @param abilityName Indicates the ability name to be queried.
1151      * @param abilityInfo Indicates the obtained AbilityInfo object.
1152      * @return Returns true if the abilityInfo is successfully obtained; returns false otherwise.
1153      */
GetAbilityInfo(const std::string & bundleName,const std::string & abilityName,AbilityInfo & abilityInfo)1154     virtual bool GetAbilityInfo(
1155         const std::string &bundleName, const std::string &abilityName, AbilityInfo &abilityInfo)
1156     {
1157         return false;
1158     }
1159     /**
1160      * @brief Obtains the AbilityInfo based on a given bundle name.
1161      * @param bundleName Indicates the bundle name to be queried.
1162      * @param moduleName Indicates the module name to be queried.
1163      * @param abilityName Indicates the ability name to be queried.
1164      * @param abilityInfo Indicates the obtained AbilityInfo object.
1165      * @return Returns true if the abilityInfo is successfully obtained; returns false otherwise.
1166      */
GetAbilityInfo(const std::string & bundleName,const std::string & moduleName,const std::string & abilityName,AbilityInfo & abilityInfo)1167     virtual bool GetAbilityInfo(
1168         const std::string &bundleName, const std::string &moduleName,
1169         const std::string &abilityName, AbilityInfo &abilityInfo)
1170     {
1171         return false;
1172     }
1173     /**
1174      * @brief Obtain sandbox application bundleInfo.
1175      * @param bundleName Indicates the bundle name of the sandbox application to be install.
1176      * @param appIndex Indicates application index of the sandbox application.
1177      * @param userId Indicates the sandbox application is installed under which user id.
1178      * @return Returns ERR_OK if the get sandbox application budnelInfo successfully; returns errcode otherwise.
1179      */
GetSandboxBundleInfo(const std::string & bundleName,int32_t appIndex,int32_t userId,BundleInfo & info)1180     virtual ErrCode GetSandboxBundleInfo(
1181         const std::string &bundleName, int32_t appIndex, int32_t userId, BundleInfo &info)
1182     {
1183         return ERR_APPEXECFWK_SANDBOX_INSTALL_INTERNAL_ERROR;
1184     }
1185 
1186     /**
1187      * @brief Obtains the value of upgradeFlag based on a given bundle name and module name.
1188      * @param bundleName Indicates the bundle name to be queried.
1189      * @param moduleName Indicates the module name to be queried.
1190      * @return Returns true if the isRemovable is successfully obtained; returns false otherwise.
1191      */
GetModuleUpgradeFlag(const std::string & bundleName,const std::string & moduleName)1192     virtual bool GetModuleUpgradeFlag(const std::string &bundleName, const std::string &moduleName)
1193     {
1194         return false;
1195     }
1196     /**
1197      * @brief Sets whether to enable upgradeFlag based on a given bundle name and module name.
1198      * @param bundleName Indicates the bundle name to be queried.
1199      * @param moduleName Indicates the module name to be queried.
1200      * @param isEnable Specifies whether to enable the isRemovable of InnerModuleInfo.
1201      *                 The value true means to enable it, and the value false means to disable it
1202      * @return Returns ERR_OK if the isRemovable is successfully obtained; returns ErrCode otherwise.
1203      */
SetModuleUpgradeFlag(const std::string & bundleName,const std::string & moduleName,int32_t upgradeFlag)1204     virtual ErrCode SetModuleUpgradeFlag(
1205         const std::string &bundleName, const std::string &moduleName, int32_t upgradeFlag)
1206     {
1207         return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
1208     }
1209 
CheckAbilityEnableInstall(const Want & want,int32_t missionId,int32_t userId,const sptr<IRemoteObject> & callback)1210     virtual bool CheckAbilityEnableInstall(
1211         const Want &want, int32_t missionId, int32_t userId, const sptr<IRemoteObject> &callback)
1212     {
1213         return false;
1214     }
1215 
ObtainCallingBundleName(std::string & bundleName)1216     virtual bool ObtainCallingBundleName(std::string &bundleName)
1217     {
1218         return false;
1219     }
1220 
GetDefaultAppProxy()1221     virtual sptr<IDefaultApp> GetDefaultAppProxy()
1222     {
1223         return nullptr;
1224     }
1225 
GetAppControlProxy()1226     virtual sptr<IAppControlMgr> GetAppControlProxy()
1227     {
1228         return nullptr;
1229     }
1230 
1231     virtual bool GetBundleStats(const std::string &bundleName, int32_t userId, std::vector<int64_t> &bundleStats,
1232         int32_t appIndex = 0, uint32_t statFlag = 0)
1233     {
1234         return false;
1235     }
1236 
GetAllBundleStats(int32_t userId,std::vector<int64_t> & bundleStats)1237     virtual bool GetAllBundleStats(int32_t userId, std::vector<int64_t> &bundleStats)
1238     {
1239         return false;
1240     }
1241 
GetExtendResourceManager()1242     virtual sptr<IExtendResourceManager> GetExtendResourceManager()
1243     {
1244         return nullptr;
1245     }
1246 
GetSandboxAbilityInfo(const Want & want,int32_t appIndex,int32_t flags,int32_t userId,AbilityInfo & info)1247     virtual ErrCode GetSandboxAbilityInfo(const Want &want, int32_t appIndex, int32_t flags, int32_t userId,
1248         AbilityInfo &info)
1249     {
1250         return ERR_APPEXECFWK_SANDBOX_QUERY_PARAM_ERROR;
1251     }
1252 
GetSandboxExtAbilityInfos(const Want & want,int32_t appIndex,int32_t flags,int32_t userId,std::vector<ExtensionAbilityInfo> & einfos)1253     virtual ErrCode GetSandboxExtAbilityInfos(const Want &want, int32_t appIndex, int32_t flags, int32_t userId,
1254         std::vector<ExtensionAbilityInfo> &einfos)
1255     {
1256         return ERR_APPEXECFWK_SANDBOX_QUERY_PARAM_ERROR;
1257     }
1258 
GetSandboxHapModuleInfo(const AbilityInfo & abilityInfo,int32_t appIndex,int32_t userId,HapModuleInfo & info)1259     virtual ErrCode GetSandboxHapModuleInfo(const AbilityInfo &abilityInfo, int32_t appIndex, int32_t userId,
1260         HapModuleInfo &info)
1261     {
1262         return ERR_APPEXECFWK_SANDBOX_QUERY_PARAM_ERROR;
1263     }
1264 
1265     virtual ErrCode GetMediaData(const std::string &bundleName, const std::string &moduleName,
1266         const std::string &abilityName, std::unique_ptr<uint8_t[]> &mediaDataPtr, size_t &len,
1267         int32_t userId = Constants::UNSPECIFIED_USERID)
1268     {
1269         return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
1270     }
1271 
GetQuickFixManagerProxy()1272     virtual sptr<IQuickFixManager> GetQuickFixManagerProxy()
1273     {
1274         return nullptr;
1275     }
1276 
1277     virtual std::string GetStringById(const std::string &bundleName, const std::string &moduleName, uint32_t resId,
1278         int32_t userId, const std::string &localeInfo = Constants::EMPTY_STRING)
1279     {
1280         return Constants::EMPTY_STRING;
1281     }
1282 
GetIconById(const std::string & bundleName,const std::string & moduleName,uint32_t resId,uint32_t density,int32_t userId)1283     virtual std::string GetIconById(
1284         const std::string &bundleName, const std::string &moduleName, uint32_t resId, uint32_t density, int32_t userId)
1285     {
1286         return Constants::EMPTY_STRING;
1287     }
1288 
SetDebugMode(bool isDebug)1289     virtual ErrCode SetDebugMode(bool isDebug)
1290     {
1291         return ERR_BUNDLEMANAGER_SET_DEBUG_MODE_INTERNAL_ERROR;
1292     }
1293 
GetOverlayManagerProxy()1294     virtual sptr<IOverlayManager> GetOverlayManagerProxy()
1295     {
1296         return nullptr;
1297     }
1298 
ProcessPreload(const Want & want)1299     virtual bool ProcessPreload(const Want &want)
1300     {
1301         return false;
1302     }
1303 
GetAppProvisionInfo(const std::string & bundleName,int32_t userId,AppProvisionInfo & appProvisionInfo)1304     virtual ErrCode GetAppProvisionInfo(const std::string &bundleName, int32_t userId,
1305         AppProvisionInfo &appProvisionInfo)
1306     {
1307         return ERR_OK;
1308     }
1309 
GetProvisionMetadata(const std::string & bundleName,int32_t userId,std::vector<Metadata> & provisionMetadatas)1310     virtual ErrCode GetProvisionMetadata(const std::string &bundleName, int32_t userId,
1311         std::vector<Metadata> &provisionMetadatas)
1312     {
1313         return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
1314     }
1315 
1316     virtual ErrCode GetBaseSharedBundleInfos(const std::string &bundleName,
1317         std::vector<BaseSharedBundleInfo> &baseSharedBundleInfos,
1318         GetDependentBundleInfoFlag flag = GetDependentBundleInfoFlag::GET_APP_CROSS_HSP_BUNDLE_INFO)
1319     {
1320         return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
1321     }
1322 
GetAllSharedBundleInfo(std::vector<SharedBundleInfo> & sharedBundles)1323     virtual ErrCode GetAllSharedBundleInfo(std::vector<SharedBundleInfo> &sharedBundles)
1324     {
1325         return ERR_OK;
1326     }
1327 
GetSharedBundleInfo(const std::string & bundleName,const std::string & moduleName,std::vector<SharedBundleInfo> & sharedBundles)1328     virtual ErrCode GetSharedBundleInfo(const std::string &bundleName, const std::string &moduleName,
1329         std::vector<SharedBundleInfo> &sharedBundles)
1330     {
1331         return ERR_OK;
1332     }
1333 
GetSharedBundleInfoBySelf(const std::string & bundleName,SharedBundleInfo & sharedBundleInfo)1334     virtual ErrCode GetSharedBundleInfoBySelf(const std::string &bundleName, SharedBundleInfo &sharedBundleInfo)
1335     {
1336         return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
1337     }
1338 
GetSharedDependencies(const std::string & bundleName,const std::string & moduleName,std::vector<Dependency> & dependencies)1339     virtual ErrCode GetSharedDependencies(const std::string &bundleName, const std::string &moduleName,
1340         std::vector<Dependency> &dependencies)
1341     {
1342         return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
1343     }
1344 
1345     virtual ErrCode GetAllProxyDataInfos(
1346         std::vector<ProxyData> &proxyDatas, int32_t userId = Constants::UNSPECIFIED_USERID)
1347     {
1348         return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
1349     }
1350 
1351     virtual ErrCode GetProxyDataInfos(const std::string &bundleName, const std::string &moduleName,
1352         std::vector<ProxyData> &proxyDatas, int32_t userId = Constants::UNSPECIFIED_USERID)
1353     {
1354         return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
1355     }
1356 
GetSpecifiedDistributionType(const std::string & bundleName,std::string & specifiedDistributionType)1357     virtual ErrCode GetSpecifiedDistributionType(const std::string &bundleName, std::string &specifiedDistributionType)
1358     {
1359         return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
1360     }
1361 
GetAdditionalInfo(const std::string & bundleName,std::string & additionalInfo)1362     virtual ErrCode GetAdditionalInfo(const std::string &bundleName, std::string &additionalInfo)
1363     {
1364         return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
1365     }
1366 
SetExtNameOrMIMEToApp(const std::string & bundleName,const std::string & moduleName,const std::string & abilityName,const std::string & extName,const std::string & mimeType)1367     virtual ErrCode SetExtNameOrMIMEToApp(const std::string &bundleName, const std::string &moduleName,
1368         const std::string &abilityName, const std::string &extName, const std::string &mimeType)
1369     {
1370         return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
1371     }
1372 
DelExtNameOrMIMEToApp(const std::string & bundleName,const std::string & moduleName,const std::string & abilityName,const std::string & extName,const std::string & mimeType)1373     virtual ErrCode DelExtNameOrMIMEToApp(const std::string &bundleName, const std::string &moduleName,
1374         const std::string &abilityName, const std::string &extName, const std::string &mimeType)
1375     {
1376         return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
1377     }
1378 
QueryDataGroupInfos(const std::string & bundleName,int32_t userId,std::vector<DataGroupInfo> & infos)1379     virtual bool QueryDataGroupInfos(const std::string &bundleName, int32_t userId, std::vector<DataGroupInfo> &infos)
1380     {
1381         return false;
1382     }
1383 
GetGroupDir(const std::string & dataGroupId,std::string & dir)1384     virtual bool GetGroupDir(const std::string &dataGroupId, std::string &dir)
1385     {
1386         return false;
1387     }
1388 
QueryAppGalleryBundleName(std::string & bundleName)1389     virtual bool QueryAppGalleryBundleName(std::string &bundleName)
1390     {
1391         return false;
1392     }
1393 
1394     /**
1395      * @brief Query extension info with type name.
1396      * @param Want Indicates the information of extension info.
1397      * @param extensionTypeName Indicates the type of the extension.
1398      * @param flag Indicates the query flag which will fliter any specified stuff in the extension info.
1399      * @param userId Indicates the userId in the system.
1400      * @param extensionInfos Indicates the obtained extensions.
1401      * @return Returns ERR_OK if this function is successfully called; returns other ErrCode otherwise.
1402      */
QueryExtensionAbilityInfosWithTypeName(const Want & want,const std::string & extensionTypeName,const int32_t flag,const int32_t userId,std::vector<ExtensionAbilityInfo> & extensionInfos)1403     virtual ErrCode QueryExtensionAbilityInfosWithTypeName(const Want &want, const std::string &extensionTypeName,
1404         const int32_t flag, const int32_t userId, std::vector<ExtensionAbilityInfo> &extensionInfos)
1405     {
1406         return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
1407     }
1408 
1409     /**
1410      * @brief Query extension info only with type name.
1411      * @param extensionTypeName Indicates the type of the extension.
1412      * @param flag Indicates the query flag which will fliter any specified stuff in the extension info.
1413      * @param userId Indicates the userId in the system.
1414      * @param extensionInfos Indicates the obtained extensions.
1415      * @return Returns ERR_OK if this function is successfully called; returns other ErrCode otherwise.
1416      */
QueryExtensionAbilityInfosOnlyWithTypeName(const std::string & extensionTypeName,const uint32_t flag,const int32_t userId,std::vector<ExtensionAbilityInfo> & extensionInfos)1417     virtual ErrCode QueryExtensionAbilityInfosOnlyWithTypeName(const std::string &extensionTypeName,
1418         const uint32_t flag, const int32_t userId, std::vector<ExtensionAbilityInfo> &extensionInfos)
1419     {
1420         return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
1421     }
1422 
ResetAOTCompileStatus(const std::string & bundleName,const std::string & moduleName,int32_t triggerMode)1423     virtual ErrCode ResetAOTCompileStatus(const std::string &bundleName, const std::string &moduleName,
1424         int32_t triggerMode)
1425     {
1426         return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
1427     }
1428 
1429     virtual ErrCode GetJsonProfile(ProfileType profileType, const std::string &bundleName,
1430         const std::string &moduleName, std::string &profile, int32_t userId = Constants::UNSPECIFIED_USERID)
1431     {
1432         return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
1433     }
1434 
GetBundleResourceProxy()1435     virtual sptr<IBundleResource> GetBundleResourceProxy()
1436     {
1437         return nullptr;
1438     }
1439 
GetRecoverableApplicationInfo(std::vector<RecoverableApplicationInfo> & recoverableApplications)1440     virtual ErrCode GetRecoverableApplicationInfo(std::vector<RecoverableApplicationInfo> &recoverableApplications)
1441     {
1442         return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
1443     }
1444 
GetUninstalledBundleInfo(const std::string bundleName,BundleInfo & bundleInfo)1445     virtual ErrCode GetUninstalledBundleInfo(const std::string bundleName, BundleInfo &bundleInfo)
1446     {
1447         return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
1448     }
1449 
SetAdditionalInfo(const std::string & bundleName,const std::string & additionalInfo)1450     virtual ErrCode SetAdditionalInfo(const std::string &bundleName, const std::string &additionalInfo)
1451     {
1452         return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
1453     }
1454 
CreateBundleDataDir(int32_t userId)1455     virtual ErrCode CreateBundleDataDir(int32_t userId)
1456     {
1457         return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
1458     }
1459 
1460     /**
1461      * @brief Get preinstalled application infos.
1462      * @param preinstalledApplicationInfos Indicates all of the obtained PreinstalledApplicationInfo objects.
1463      * @return Returns ERR_OK if this function is successfully called; returns other ErrCode otherwise.
1464      */
GetAllPreinstalledApplicationInfos(std::vector<PreinstalledApplicationInfo> & preinstalledApplicationInfos)1465     virtual ErrCode GetAllPreinstalledApplicationInfos(
1466         std::vector<PreinstalledApplicationInfo> &preinstalledApplicationInfos)
1467     {
1468         return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
1469     }
1470 
1471     /**
1472      * @brief Check whether the link can be opened.
1473      * @param link link Indicates the link to be opened.
1474      * @param canOpen Indicates whether the link can be opened.
1475      * @return Returns result of the operation.
1476      */
CanOpenLink(const std::string & link,bool & canOpen)1477     virtual ErrCode CanOpenLink(
1478         const std::string &link, bool &canOpen)
1479     {
1480         return ERR_BUNDLE_MANAGER_INTERNAL_ERROR;
1481     }
1482 
GetOdid(std::string & odid)1483     virtual ErrCode GetOdid(std::string &odid)
1484     {
1485         return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
1486     }
1487 
1488     virtual ErrCode GetAllBundleInfoByDeveloperId(const std::string &developerId,
1489         std::vector<BundleInfo> &bundleInfos, int32_t userId = Constants::UNSPECIFIED_USERID)
1490     {
1491         return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
1492     }
1493 
1494     virtual ErrCode GetDeveloperIds(const std::string &appDistributionType,
1495         std::vector<std::string> &developerIdList, int32_t userId = Constants::UNSPECIFIED_USERID)
1496     {
1497         return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
1498     }
1499 
1500     virtual ErrCode SwitchUninstallState(const std::string &bundleName, const bool &state,
1501         bool isNeedSendNotify = true)
1502     {
1503         return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
1504     }
1505 
1506     virtual ErrCode QueryAbilityInfoByContinueType(const std::string &bundleName, const std::string &continueType,
1507         AbilityInfo &abilityInfo, int32_t userId = Constants::UNSPECIFIED_USERID)
1508     {
1509         return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
1510     }
1511 
QueryCloneAbilityInfo(const ElementName & element,int32_t flags,int32_t appIndex,AbilityInfo & abilityInfo,int32_t userId)1512     virtual ErrCode QueryCloneAbilityInfo(const ElementName &element,
1513         int32_t flags, int32_t appIndex, AbilityInfo &abilityInfo, int32_t userId)
1514     {
1515         return ERR_BUNDLE_MANAGER_INTERNAL_ERROR;
1516     }
1517 
1518     virtual ErrCode GetCloneBundleInfo(const std::string &bundleName, int32_t flag, int32_t appIndex,
1519         BundleInfo &bundleInfo, int32_t userId = Constants::UNSPECIFIED_USERID)
1520     {
1521         return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
1522     }
1523 
1524     virtual ErrCode GetCloneAppIndexes(const std::string &bundleName, std::vector<int32_t> &appIndexes,
1525         int32_t userId = Constants::UNSPECIFIED_USERID)
1526     {
1527         return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
1528     }
1529 
GetLaunchWant(Want & want)1530     virtual ErrCode GetLaunchWant(Want &want)
1531     {
1532         return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
1533     }
1534 
1535     virtual ErrCode QueryCloneExtensionAbilityInfoWithAppIndex(const ElementName &elementName, int32_t flags,
1536         int32_t appIndex, ExtensionAbilityInfo &extensionAbilityInfo,
1537         int32_t userId = Constants::UNSPECIFIED_USERID)
1538     {
1539         return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
1540     }
1541 
GetSignatureInfoByBundleName(const std::string & bundleName,SignatureInfo & signatureInfo)1542     virtual ErrCode GetSignatureInfoByBundleName(const std::string &bundleName, SignatureInfo &signatureInfo)
1543     {
1544         return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
1545     }
1546 
AddDesktopShortcutInfo(const ShortcutInfo & shortcutInfo,int32_t userId)1547     virtual ErrCode AddDesktopShortcutInfo(const ShortcutInfo &shortcutInfo, int32_t userId)
1548     {
1549         return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
1550     }
1551 
DeleteDesktopShortcutInfo(const ShortcutInfo & shortcutInfo,int32_t userId)1552     virtual ErrCode DeleteDesktopShortcutInfo(const ShortcutInfo &shortcutInfo, int32_t userId)
1553     {
1554         return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
1555     }
1556 
GetAllDesktopShortcutInfo(int32_t userId,std::vector<ShortcutInfo> & shortcutInfos)1557     virtual ErrCode GetAllDesktopShortcutInfo(int32_t userId, std::vector<ShortcutInfo> &shortcutInfos)
1558     {
1559         return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
1560     }
1561 
GetCompatibleDeviceTypeNative(std::string & deviceType)1562     virtual ErrCode GetCompatibleDeviceTypeNative(std::string &deviceType)
1563     {
1564         return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
1565     }
1566 
GetCompatibleDeviceType(const std::string & bundleName,std::string & deviceType)1567     virtual ErrCode GetCompatibleDeviceType(const std::string &bundleName, std::string &deviceType)
1568     {
1569         return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
1570     }
1571 
GetOdidByBundleName(const std::string & bundleName,std::string & odid)1572     virtual ErrCode GetOdidByBundleName(const std::string &bundleName, std::string &odid)
1573     {
1574         return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
1575     }
1576 
1577     /**
1578      * @brief Obtains BundleInfo of all continuable bundles available in the system.
1579      * @param flags Indicates the flag used to specify information contained in the BundleInfo that will be returned.
1580      * @param bundleInfos Indicates all of the obtained BundleInfo objects.
1581      * @param userId Indicates the user ID.
1582      * @return Returns true if the BundleInfos is successfully obtained; returns false otherwise.
1583      */
1584     virtual bool GetBundleInfosForContinuation(int32_t flags,
1585         std::vector<BundleInfo> &bundleInfos, int32_t userId = Constants::UNSPECIFIED_USERID)
1586     {
1587         return false;
1588     }
1589 
1590     /**
1591      * @brief Get a list of application package names that continue the specified package name.
1592      * @param continueBundleName The package name that is being continued.
1593      * @param bundleNames Continue the list of specified package names.
1594      * @param userId Indicates the user ID.
1595      * @return Returns ERR_OK if successfully obtained; returns error code otherwise.
1596      */
1597     virtual ErrCode GetContinueBundleNames(const std::string &continueBundleName, std::vector<std::string> &bundleNames,
1598         int32_t userId = Constants::UNSPECIFIED_USERID)
1599     {
1600         return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
1601     }
1602 
IsBundleInstalled(const std::string & bundleName,int32_t userId,int32_t appIndex,bool & isInstalled)1603     virtual ErrCode IsBundleInstalled(const std::string &bundleName, int32_t userId,
1604         int32_t appIndex, bool &isInstalled)
1605     {
1606         return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
1607     }
1608 
GetBundleNameByAppId(const std::string & appId,std::string & bundleName)1609     virtual ErrCode GetBundleNameByAppId(const std::string &appId, std::string &bundleName)
1610     {
1611         return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
1612     }
1613 
GetDirByBundleNameAndAppIndex(const std::string & bundleName,const int32_t appIndex,std::string & dataDir)1614     virtual ErrCode GetDirByBundleNameAndAppIndex(const std::string &bundleName, const int32_t appIndex,
1615         std::string &dataDir)
1616     {
1617         return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
1618     }
1619 
GetAllBundleDirs(int32_t userId,std::vector<BundleDir> & bundleDirs)1620     virtual ErrCode GetAllBundleDirs(int32_t userId, std::vector<BundleDir> &bundleDirs)
1621     {
1622         return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
1623     }
1624 };
1625 
1626 #define WRITE_PARCEL(func)                                             \
1627     do {                                                               \
1628         if (!(func)) {                                                 \
1629             APP_LOGE("write parcel failed, func : %{public}s", #func); \
1630             return ERR_APPEXECFWK_PARCEL_ERROR;                        \
1631         }                                                              \
1632     } while (0)
1633 }  // namespace AppExecFwk
1634 }  // namespace OHOS
1635 #endif  // FOUNDATION_APPEXECFWK_INTERFACES_INNERKITS_APPEXECFWK_CORE_INCLUDE_BUNDLEMGR_BUNDLE_MGR_INTERFACE_H
1636