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