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