• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2023 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_HOST_H
17 #define FOUNDATION_APPEXECFWK_INTERFACES_INNERKITS_APPEXECFWK_CORE_INCLUDE_BUNDLEMGR_BUNDLE_MGR_HOST_H
18 
19 #include <mutex>
20 
21 #include "iremote_stub.h"
22 #include "nocopyable.h"
23 
24 #include "appexecfwk_errors.h"
25 #include "bundle_mgr_interface.h"
26 #include "bundle_mgr_proxy.h"
27 
28 namespace OHOS {
29 namespace AppExecFwk {
30 class BundleMgrHost : public IRemoteStub<IBundleMgr> {
31 public:
32     BundleMgrHost();
33     virtual ~BundleMgrHost() = default;
34 
35     int OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override;
36 
37 private:
38     /**
39      * @brief Handles the GetApplicationInfo function called from a IBundleMgr proxy object.
40      * @param data Indicates the data to be read.
41      * @param reply Indicates the reply to be sent;
42      * @return Returns ERR_OK if called successfully; returns error code otherwise.
43      */
44     ErrCode HandleGetApplicationInfo(MessageParcel &data, MessageParcel &reply);
45     /**
46      * @brief Handles the GetApplicationInfo function called from a IBundleMgr proxy object.
47      * @param data Indicates the data to be read.
48      * @param reply Indicates the reply to be sent;
49      * @return Returns ERR_OK if called successfully; returns error code otherwise.
50      */
51     ErrCode HandleGetApplicationInfoWithIntFlags(MessageParcel &data, MessageParcel &reply);
52     /**
53      * @brief Handles the GetApplicationInfoV9 function called from a IBundleMgr proxy object.
54      * @param data Indicates the data to be read.
55      * @param reply Indicates the reply to be sent;
56      * @return Returns ERR_OK if called successfully; returns error code otherwise.
57      */
58     ErrCode HandleGetApplicationInfoWithIntFlagsV9(MessageParcel &data, MessageParcel &reply);
59     /**
60      * @brief Handles the GetApplicationInfos function called from a IBundleMgr proxy object.
61      * @param data Indicates the data to be read.
62      * @param reply Indicates the reply to be sent;
63      * @return Returns ERR_OK if called successfully; returns error code otherwise.
64      */
65     ErrCode HandleGetApplicationInfos(MessageParcel &data, MessageParcel &reply);
66     /**
67      * @brief Handles the GetApplicationInfos function called from a IBundleMgr proxy object.
68      * @param data Indicates the data to be read.
69      * @param reply Indicates the reply to be sent;
70      * @return Returns ERR_OK if called successfully; returns error code otherwise.
71      */
72     ErrCode HandleGetApplicationInfosWithIntFlags(MessageParcel &data, MessageParcel &reply);
73     /**
74      * @brief Handles the GetApplicationsInfoV9 function called from a IBundleMgr proxy object.
75      * @param data Indicates the data to be read.
76      * @param reply Indicates the reply to be sent;
77      * @return Returns ERR_OK if called successfully; returns error code otherwise.
78      */
79     ErrCode HandleGetApplicationInfosWithIntFlagsV9(MessageParcel &data, MessageParcel &reply);
80     /**
81      * @brief Handles the GetBundleInfo function called from a IBundleMgr proxy object.
82      * @param data Indicates the data to be read.
83      * @param reply Indicates the reply to be sent;
84      * @return Returns ERR_OK if called successfully; returns error code otherwise.
85      */
86     ErrCode HandleGetBundleInfo(MessageParcel &data, MessageParcel &reply);
87     /**
88      * @brief Handles the GetBundleInfo function called from a IBundleMgr proxy object.
89      * @param data Indicates the data to be read.
90      * @param reply Indicates the reply to be sent;
91      * @return Returns ERR_OK if called successfully; returns error code otherwise.
92      */
93     ErrCode HandleGetBundleInfoForSelf(MessageParcel &data, MessageParcel &reply);
94     /**
95      * @brief Handles the GetDependentBundleInfo function called from a IBundleMgr proxy object.
96      * @param data Indicates the data to be read.
97      * @param reply Indicates the reply to be sent;
98      * @return Returns ERR_OK if called successfully; returns error code otherwise.
99      */
100     virtual ErrCode HandleGetDependentBundleInfo(MessageParcel &data, MessageParcel &reply);
101     /**
102      * @brief Handles the GetBundlePackInfo function called from a IBundleMgr proxy object.
103      * @param data Indicates the data to be read.
104      * @param reply Indicates the reply to be sent;
105      * @return Returns ERR_OK if called successfully; returns error code otherwise.
106      */
107     ErrCode HandleGetBundlePackInfo(MessageParcel &data, MessageParcel &reply);
108     /**
109      * @brief Handles the GetBundlePackInfo function called from a IBundleMgr proxy object.
110      * @param data Indicates the data to be read.
111      * @param reply Indicates the reply to be sent;
112      * @return Returns ERR_OK if called successfully; returns error code otherwise.
113      */
114     ErrCode HandleGetBundlePackInfoWithIntFlags(MessageParcel &data, MessageParcel &reply);
115     /**
116      * @brief Handles the GetBundleInfo function called from a IBundleMgr proxy object.
117      * @param data Indicates the data to be read.
118      * @param reply Indicates the reply to be sent;
119      * @return Returns ERR_OK if called successfully; returns error code otherwise.
120      */
121     ErrCode HandleGetBundleInfoWithIntFlags(MessageParcel &data, MessageParcel &reply);
122     /**
123      * @brief Handles the GetBundleInfo function called from a IBundleMgr proxy object.
124      * @param data Indicates the data to be read.
125      * @param reply Indicates the reply to be sent;
126      * @return Returns ERR_OK if called successfully; returns error code otherwise.
127      */
128     ErrCode HandleGetBundleInfoWithIntFlagsV9(MessageParcel &data, MessageParcel &reply);
129     /**
130      * @brief Handles the GetBundleInfos function called from a IBundleMgr proxy object.
131      * @param data Indicates the data to be read.
132      * @param reply Indicates the reply to be sent;
133      * @return Returns ERR_OK if called successfully; returns error code otherwise.
134      */
135     ErrCode HandleGetBundleInfos(MessageParcel &data, MessageParcel &reply);
136     /**
137      * @brief Handles the GetBundleInfos function called from a IBundleMgr proxy object.
138      * @param data Indicates the data to be read.
139      * @param reply Indicates the reply to be sent;
140      * @return Returns ERR_OK if called successfully; returns error code otherwise.
141      */
142     ErrCode HandleGetBundleInfosWithIntFlags(MessageParcel &data, MessageParcel &reply);
143     /**
144      * @brief Handles the GetBundleInfo function called from a IBundleMgr proxy object.
145      * @param data Indicates the data to be read.
146      * @param reply Indicates the reply to be sent;
147      * @return Returns ERR_OK if called successfully; returns error code otherwise.
148      */
149     ErrCode HandleGetBundleInfosWithIntFlagsV9(MessageParcel &data, MessageParcel &reply);
150     /**
151      * @brief Handles the GetBundleNameForUid function called from a IBundleMgr proxy object.
152      * @param data Indicates the data to be read.
153      * @param reply Indicates the reply to be sent;
154      * @return Returns ERR_OK if called successfully; returns error code otherwise.
155      */
156     ErrCode HandleGetBundleNameForUid(MessageParcel &data, MessageParcel &reply);
157     /**
158      * @brief Handles the GetBundlesForUid function called from a IBundleMgr proxy object.
159      * @param data Indicates the data to be read.
160      * @param reply Indicates the reply to be sent;
161      * @return Returns ERR_OK if called successfully; returns error code otherwise.
162      */
163     ErrCode HandleGetBundlesForUid(MessageParcel &data, MessageParcel &reply);
164     /**
165      * @brief Handles the GetNameForUid function called from a IBundleMgr proxy object.
166      * @param data Indicates the data to be read.
167      * @param reply Indicates the reply to be sent;
168      * @return Returns ERR_OK if called successfully; returns error code otherwise.
169      */
170     ErrCode HandleGetNameForUid(MessageParcel &data, MessageParcel &reply);
171     /**
172      * @brief Handles the GetBundleGids function called from a IBundleMgr proxy object.
173      * @param data Indicates the data to be read.
174      * @param reply Indicates the reply to be sent;
175      * @return Returns ERR_OK if called successfully; returns error code otherwise.
176      */
177     ErrCode HandleGetBundleGids(MessageParcel &data, MessageParcel &reply);
178     /**
179      * @brief Handles the GetBundleGidsByUid function called from a IBundleMgr proxy object.
180      * @param data Indicates the data to be read.
181      * @param reply Indicates the reply to be sent;
182      * @return Returns ERR_OK if called successfully; returns error code otherwise.
183      */
184     ErrCode HandleGetBundleGidsByUid(MessageParcel &data, MessageParcel &reply);
185     /**
186      * @brief Handles the GetBundleInfosByMetaData function called from a IBundleMgr proxy object.
187      * @param data Indicates the data to be read.
188      * @param reply Indicates the reply to be sent;
189      * @return Returns ERR_OK if called successfully; returns error code otherwise.
190      */
191     ErrCode HandleGetBundleInfosByMetaData(MessageParcel &data, MessageParcel &reply);
192     /**
193      * @brief Handles the QueryAbilityInfo function called from a IBundleMgr proxy object.
194      * @param data Indicates the data to be read.
195      * @param reply Indicates the reply to be sent;
196      * @return Returns ERR_OK if called successfully; returns error code otherwise.
197      */
198     ErrCode HandleQueryAbilityInfo(MessageParcel &data, MessageParcel &reply);
199 
200      /**
201      * @brief Handles the QueryAbilityInfo function called from a IBundleMgr proxy object with callback.
202      * @param data Indicates the data to be read.
203      * @param reply Indicates the reply to be sent;
204      * @return Returns ERR_OK if called successfully; returns error code otherwise.
205      */
206     ErrCode HandleQueryAbilityInfoWithCallback(MessageParcel &data, MessageParcel &reply);
207 
208      /**
209      * @brief Handles the SilentInstall function called from a IBundleMgr proxy.
210      * @param data Indicates the data to be read.
211      * @param reply Indicates the reply to be sent;
212      * @return Returns ERR_OK if called successfully; returns error code otherwise.
213      */
214     ErrCode HandleSilentInstall(MessageParcel &data, MessageParcel &reply);
215 
216     /**
217      * @brief Handles the UpgradeAtomicService function called from a IBundleMgr proxy object.
218      * @param data Indicates the data to be read.
219      * @param reply Indicates the reply to be sent;
220      * @return Returns ERR_OK if called successfully; returns error code otherwise.
221      */
222     ErrCode HandleUpgradeAtomicService(MessageParcel &data, MessageParcel &reply);
223 
224     /**
225      * @brief Handles the QueryAbilityInfo function called from a IBundleMgr proxy object.
226      * @param data Indicates the data to be read.
227      * @param reply Indicates the reply to be sent;
228      * @return Returns ERR_OK if called successfully; returns error code otherwise.
229      */
230     ErrCode HandleQueryAbilityInfoMutiparam(MessageParcel &data, MessageParcel &reply);
231     /**
232      * @brief Handles the QueryAbilityInfos function called from a IBundleMgr proxy object.
233      * @param data Indicates the data to be read.
234      * @param reply Indicates the reply to be sent;
235      * @return Returns ERR_OK if called successfully; returns error code otherwise.
236      */
237     ErrCode HandleQueryAbilityInfos(MessageParcel &data, MessageParcel &reply);
238     /**
239      * @brief Handles the QueryAbilityInfoByUri function called from a IBundleMgr proxy object.
240      * @param data Indicates the data to be read.
241      * @param reply Indicates the reply to be sent;
242      * @return Returns ERR_OK if called successfully; returns error code otherwise.
243      */
244     ErrCode HandleQueryAbilityInfoByUri(MessageParcel &data, MessageParcel &reply);
245     /**
246      * @brief Handles the QueryAbilityInfoByUri function called from a IBundleMgr proxy object.
247      * @param data Indicates the data to be read.
248      * @param reply Indicates the reply to be sent;
249      * @return Returns ERR_OK if called successfully; returns error code otherwise.
250      */
251     ErrCode HandleQueryAbilityInfosByUri(MessageParcel &data, MessageParcel &reply);
252     /**
253      * @brief Handles the QueryAbilityInfosMutiparam function called from a IBundleMgr proxy object.
254      * @param data Indicates the data to be read.
255      * @param reply Indicates the reply to be sent;
256      * @return Returns ERR_OK if called successfully; returns error code otherwise.
257      */
258     ErrCode HandleQueryAbilityInfosMutiparam(MessageParcel &data, MessageParcel &reply);
259     /**
260      * @brief Handles the QueryAbilityInfosV9 function called from a IBundleMgr proxy object.
261      * @param data Indicates the data to be read.
262      * @param reply Indicates the reply to be sent;
263      * @return Returns ERR_OK if called successfully; returns error code otherwise.
264      */
265     ErrCode HandleQueryAbilityInfosV9(MessageParcel &data, MessageParcel &reply);
266     /**
267      * @brief Handles the HandleQueryLauncherAbilityInfos function called from a IBundleMgr proxy object.
268      * @param data Indicates the data to be read.
269      * @param reply Indicates the reply to be sent;
270      * @return Returns ERR_OK if called successfully; returns error code otherwise.
271      */
272     ErrCode HandleQueryLauncherAbilityInfos(MessageParcel &data, MessageParcel &reply);
273     /**
274      * @brief Handles the HandleQueryAllAbilityInfos function called from a IBundleMgr proxy object.
275      * @param data Indicates the data to be read.
276      * @param reply Indicates the reply to be sent;
277      * @return Returns ERR_OK if called successfully; returns error code otherwise.
278      */
279     ErrCode HandleQueryAllAbilityInfos(MessageParcel &data, MessageParcel &reply);
280     /**
281      * @brief Handles the QueryAbilityInfoByUri function called from a IBundleMgr proxy object.
282      * @param data Indicates the data to be read.
283      * @param reply Indicates the reply to be sent;
284      * @return Returns ERR_OK if called successfully; returns error code otherwise.
285      */
286     ErrCode HandleQueryAbilityInfoByUriForUserId(MessageParcel &data, MessageParcel &reply);
287     /**
288      * @brief Handles the QueryKeepAliveBundleInfos function called from a IBundleMgr proxy object.
289      * @param data Indicates the data to be read.
290      * @param reply Indicates the reply to be sent;
291      * @return Returns ERR_OK if called successfully; returns error code otherwise.
292      */
293     ErrCode HandleQueryKeepAliveBundleInfos(MessageParcel &data, MessageParcel &reply);
294     /**
295      * @brief Handles the GetAbilityLabel function called from a IBundleMgr proxy object.
296      * @param data Indicates the data to be read.
297      * @param reply Indicates the reply to be sent;
298      * @return Returns ERR_OK if called successfully; returns error code otherwise.
299      */
300     ErrCode HandleGetAbilityLabel(MessageParcel &data, MessageParcel &reply);
301     /**
302      * @brief Handles the GetAbilityLabel function called from a IBundleMgr proxy object.
303      * @param data Indicates the data to be read.
304      * @param reply Indicates the reply to be sent;
305      * @return Returns ERR_OK if called successfully; returns error code otherwise.
306      */
307     ErrCode HandleGetAbilityLabelWithModuleName(MessageParcel &data, MessageParcel &reply);
308     /**
309      * @brief Handles the CheckIsSystemAppByUid function called from a IBundleMgr proxy object.
310      * @param data Indicates the data to be read.
311      * @param reply Indicates the reply to be sent;
312      * @return Returns ERR_OK if called successfully; returns error code otherwise.
313      */
314     ErrCode HandleCheckIsSystemAppByUid(MessageParcel &data, MessageParcel &reply);
315     /**
316      * @brief Handles the GetBundleArchiveInfo function called from a IBundleMgr proxy object.
317      * @param data Indicates the data to be read.
318      * @param reply Indicates the reply to be sent;
319      * @return Returns ERR_OK if called successfully; returns error code otherwise.
320      */
321     ErrCode HandleGetBundleArchiveInfo(MessageParcel &data, MessageParcel &reply);
322     /**
323      * @brief Handles the GetBundleArchiveInfo function called from a IBundleMgr proxy object.
324      * @param data Indicates the data to be read.
325      * @param reply Indicates the reply to be sent;
326      * @return Returns ERR_OK if called successfully; returns error code otherwise.
327      */
328     ErrCode HandleGetBundleArchiveInfoWithIntFlags(MessageParcel &data, MessageParcel &reply);
329     /**
330      * @brief Handles the GetBundleArchiveInfo function called from a IBundleMgr proxy object.
331      * @param data Indicates the data to be read.
332      * @param reply Indicates the reply to be sent;
333      * @return Returns ERR_OK if called successfully; returns error code otherwise.
334      */
335     ErrCode HandleGetBundleArchiveInfoWithIntFlagsV9(MessageParcel &data, MessageParcel &reply);
336     /**
337      * @brief Handles the GetHapModuleInfo function called from a IBundleMgr proxy object.
338      * @param data Indicates the data to be read.
339      * @param reply Indicates the reply to be sent;
340      * @return Returns ERR_OK if called successfully; returns error code otherwise.
341      */
342     ErrCode HandleGetHapModuleInfo(MessageParcel &data, MessageParcel &reply);
343     /**
344      * @brief Handles the GetHapModuleInfo function called from a IBundleMgr proxy object.
345      * @param data Indicates the data to be read.
346      * @param reply Indicates the reply to be sent;
347      * @return Returns ERR_OK if called successfully; returns error code otherwise.
348      */
349     ErrCode HandleGetHapModuleInfoWithUserId(MessageParcel &data, MessageParcel &reply);
350     /**
351      * @brief Handles the GetLaunchWantForBundle function called from a IBundleMgr proxy object.
352      * @param data Indicates the data to be read.
353      * @param reply Indicates the reply to be sent;
354      * @return Returns ERR_OK if called successfully; returns error code otherwise.
355      */
356     ErrCode HandleGetLaunchWantForBundle(MessageParcel &data, MessageParcel &reply);
357     /**
358      * @brief Handles the GetPermissionDef function called from a IBundleMgr proxy object.
359      * @param data Indicates the data to be read.
360      * @param reply Indicates the reply to be sent;
361      * @return Returns ERR_OK if called successfully; returns error code otherwise.
362      */
363     ErrCode HandleGetPermissionDef(MessageParcel &data, MessageParcel &reply);
364     /**
365      * @brief Handles the CleanBundleCacheFiles function called from a IBundleMgr proxy object.
366      * @param data Indicates the data to be read.
367      * @param reply Indicates the reply to be sent;
368      * @return Returns ERR_OK if called successfully; returns error code otherwise.
369      */
370     ErrCode HandleCleanBundleCacheFiles(MessageParcel &data, MessageParcel &reply);
371     /**
372      * @brief Handles the CleanBundleDataFiles function called from a IBundleMgr proxy object.
373      * @param data Indicates the data to be read.
374      * @param reply Indicates the reply to be sent;
375      * @return Returns ERR_OK if called successfully; returns error code otherwise.
376      */
377     ErrCode HandleCleanBundleDataFiles(MessageParcel &data, MessageParcel &reply);
378     /**
379      * @brief Handles the RegisterBundleStatusCallback function called from a IBundleMgr proxy object.
380      * @param data Indicates the data to be read.
381      * @param reply Indicates the reply to be sent;
382      * @return Returns ERR_OK if called successfully; returns error code otherwise.
383      */
384     ErrCode HandleRegisterBundleStatusCallback(MessageParcel &data, MessageParcel &reply);
385 
386     ErrCode HandleRegisterBundleEventCallback(MessageParcel &data, MessageParcel &reply);
387 
388     ErrCode HandleUnregisterBundleEventCallback(MessageParcel &data, MessageParcel &reply);
389     /**
390      * @brief Handles the ClearBundleStatusCallback function called from a IBundleMgr proxy object.
391      * @param data Indicates the data to be read.
392      * @param reply Indicates the reply to be sent;
393      * @return Returns ERR_OK if called successfully; returns error code otherwise.
394      */
395     ErrCode HandleClearBundleStatusCallback(MessageParcel &data, MessageParcel &reply);
396     /**
397      * @brief Handles the UnregisterBundleStatusCallback function called from a IBundleMgr proxy object.
398      * @param data Indicates the data to be read.
399      * @param reply Indicates the reply to be sent;
400      * @return Returns ERR_OK if called successfully; returns error code otherwise.
401      */
402     ErrCode HandleUnregisterBundleStatusCallback(MessageParcel &data, MessageParcel &reply);
403     /**
404      * @brief Handles the DumpInfos function called from a IBundleMgr proxy object.
405      * @param data Indicates the data to be read.
406      * @param reply Indicates the reply to be sent;
407      * @return Returns ERR_OK if called successfully; returns error code otherwise.
408      */
409     ErrCode HandleDumpInfos(MessageParcel &data, MessageParcel &reply);
410     /**
411      * @brief Handles the CompileProcessAOT function called from a IBundleMgr proxy object.
412      * @param data Indicates the data to be read.
413      * @param reply Indicates the reply to be sent;
414      * @return Returns ERR_OK if called successfully; returns error code otherwise.
415      */
416     ErrCode HandleCompileProcessAOT(MessageParcel &data, MessageParcel &reply);
417     /**
418      * @brief Handles the CompileReset function called from a IBundleMgr proxy object.
419      * @param data Indicates the data to be read.
420      * @param reply Indicates the reply to be sent;
421      * @return Returns ERR_OK if called successfully; returns error code otherwise.
422      */
423     ErrCode HandleCompileReset(MessageParcel &data, MessageParcel &reply);
424     /**
425      * @brief Handles the GetBundleInstaller function called from a IBundleMgr proxy object.
426      * @param data Indicates the data to be read.
427      * @param reply Indicates the reply to be sent;
428      * @return Returns ERR_OK if called successfully; returns error code otherwise.
429      */
430     ErrCode HandleGetBundleInstaller(MessageParcel &data, MessageParcel &reply);
431     /**
432      * @brief Handles the GetBundleUserMgr function called from a IBundleMgr proxy object.
433      * @param data Indicates the data to be read.
434      * @param reply Indicates the reply to be sent;
435      * @return Returns ERR_OK if called successfully; returns error code otherwise.
436      */
437     ErrCode HandleGetBundleUserMgr(MessageParcel &data, MessageParcel &reply);
438     /**
439      * @brief Handles the GetVerifyManager function called from a IBundleMgr proxy object.
440      * @param data Indicates the data to be read.
441      * @param reply Indicates the reply to be sent;
442      * @return Returns ERR_OK if called successfully; returns error code otherwise.
443      */
444     ErrCode HandleGetVerifyManager(MessageParcel &data, MessageParcel &reply);
445     /**
446      * @brief Handles the IsApplicationEnabled function called from a IBundleMgr proxy object.
447      * @param data Indicates the data to be read.
448      * @param reply Indicates the reply to be sent;
449      * @return Returns ERR_OK if called successfully; returns error code otherwise.
450      */
451     ErrCode HandleIsApplicationEnabled(MessageParcel &data, MessageParcel &reply);
452     /**
453      * @brief Handles the SetApplicationEnabled function called from a IBundleMgr proxy object.
454      * @param data Indicates the data to be read.
455      * @param reply Indicates the reply to be sent;
456      * @return Returns ERR_OK if called successfully; returns error code otherwise.
457      */
458     ErrCode HandleSetApplicationEnabled(MessageParcel &data, MessageParcel &reply);
459     /**
460      * @brief Handles the IsAbilityEnabled function called from a IBundleMgr proxy object.
461      * @param data Indicates the data to be read.
462      * @param reply Indicates the reply to be sent;
463      * @return Returns ERR_OK if called successfully; returns error code otherwise.
464      */
465     ErrCode HandleIsAbilityEnabled(MessageParcel &data, MessageParcel &reply);
466     /**
467      * @brief Handles the SetAbilityEnabled function called from a IBundleMgr proxy object.
468      * @param data Indicates the data to be read.
469      * @param reply Indicates the reply to be sent;
470      * @return Returns ERR_OK if called successfully; returns error code otherwise.
471      */
472     ErrCode HandleSetAbilityEnabled(MessageParcel &data, MessageParcel &reply);
473     /**
474      * @brief Handles the GetAllFormsInfo function called from a IBundleMgr proxy object.
475      * @param data Indicates the data to be read.
476      * @param reply Indicates the reply to be sent;
477      * @return Returns ERR_OK if called successfully; returns error code otherwise.
478      */
479     ErrCode HandleGetAllFormsInfo(MessageParcel &data, MessageParcel &reply);
480     /**
481      * @brief Handles the GetFormsInfoByApp function called from a IBundleMgr proxy object.
482      * @param data Indicates the data to be read.
483      * @param reply Indicates the reply to be sent;
484      * @return Returns ERR_OK if called successfully; returns error code otherwise.
485      */
486     ErrCode HandleGetFormsInfoByApp(MessageParcel &data, MessageParcel &reply);
487     /**
488      * @brief Handles the HandleGetFormsInfoByModule function called from a IBundleMgr proxy object.
489      * @param data Indicates the data to be read.
490      * @param reply Indicates the reply to be sent;
491      * @return Returns ERR_OK if called successfully; returns error code otherwise.
492      */
493     ErrCode HandleGetFormsInfoByModule(MessageParcel &data, MessageParcel &reply);
494     /**
495      * @brief Handles the HandleGetShortcutInfo function called from a IBundleMgr proxy object.
496      * @param data Indicates the data to be read.
497      * @param reply Indicates the reply to be sent;
498      * @return Returns ERR_OK if called successfully; returns error code otherwise.
499      */
500     ErrCode HandleGetShortcutInfos(MessageParcel &data, MessageParcel &reply);
501     /**
502      * @brief Handles the HandleGetShortcutInfo function called from a IBundleMgr proxy object.
503      * @param data Indicates the data to be read.
504      * @param reply Indicates the reply to be sent;
505      * @return Returns err_code of result.
506      */
507     ErrCode HandleGetShortcutInfoV9(MessageParcel &data, MessageParcel &reply);
508     /**
509      * @brief Handles the HandleGetAllCommonEventInfo function called from a IBundleMgr proxy object.
510      * @param data Indicates the data to be read.
511      * @param reply Indicates the reply to be sent;
512      * @return Returns ERR_OK if called successfully; returns error code otherwise.
513      */
514     ErrCode HandleGetAllCommonEventInfo(MessageParcel &data, MessageParcel &reply);
515     /**
516      * @brief Handles the GetDistributedBundleInfo function called from a IBundleMgr proxy object.
517      * @param data Indicates the data to be read.
518      * @param reply Indicates the reply to be sent;
519      * @return Returns ERR_OK if called successfully; returns error code otherwise.
520      */
521     ErrCode HandleGetDistributedBundleInfo(MessageParcel &data, MessageParcel &reply);
522     /**
523      * @brief Handles the HandleGetAppPrivilegeLevel function called from a IBundleMgr proxy object.
524      * @param data Indicates the data to be read.
525      * @param reply Indicates the reply to be sent;
526      * @return Returns ERR_OK if called successfully; returns error code otherwise.
527      */
528     ErrCode HandleGetAppPrivilegeLevel(MessageParcel &data, MessageParcel &reply);
529     /**
530      * @brief Handles the HandleQueryExtAbilityInfosWithoutType function called from a IBundleMgr proxy object.
531      * @param data Indicates the data to be read.
532      * @param reply Indicates the reply to be sent;
533      * @return Returns ERR_OK if called successfully; returns error code otherwise.
534      */
535     ErrCode HandleQueryExtAbilityInfosWithoutType(MessageParcel &data, MessageParcel &reply);
536     /**
537      * @brief Handles the HandleQueryExtAbilityInfosWithoutTypeV9 function called from a IBundleMgr proxy object.
538      * @param data Indicates the data to be read.
539      * @param reply Indicates the reply to be sent;
540      * @return Returns ERR_OK if called successfully; returns error code otherwise.
541      */
542     ErrCode HandleQueryExtAbilityInfosWithoutTypeV9(MessageParcel &data, MessageParcel &reply);
543     /**
544      * @brief Handles the HandleQueryExtensionInfo function called from a IBundleMgr proxy object.
545      * @param data Indicates the data to be read.
546      * @param reply Indicates the reply to be sent;
547      * @return Returns ERR_OK if called successfully; returns error code otherwise.
548      */
549     ErrCode HandleQueryExtAbilityInfos(MessageParcel &data, MessageParcel &reply);
550     /**
551      * @brief Handles the HandleQueryExtAbilityInfosV9 function called from a IBundleMgr proxy object.
552      * @param data Indicates the data to be read.
553      * @param reply Indicates the reply to be sent;
554      * @return Returns ERR_OK if called successfully; returns error code otherwise.
555      */
556     ErrCode HandleQueryExtAbilityInfosV9(MessageParcel &data, MessageParcel &reply);
557 
558     ErrCode HandleQueryExtAbilityInfosByType(MessageParcel &data, MessageParcel &reply);
559 
560     ErrCode HandleVerifyCallingPermission(MessageParcel &data, MessageParcel &reply);
561 
562     ErrCode HandleQueryExtensionAbilityInfoByUri(MessageParcel &data, MessageParcel &reply);
563 
564     ErrCode HandleGetAppIdByBundleName(MessageParcel &data, MessageParcel &reply);
565 
566     ErrCode HandleGetAppType(MessageParcel &data, MessageParcel &reply);
567 
568     ErrCode HandleGetUidByBundleName(MessageParcel &data, MessageParcel &reply);
569 
570     ErrCode HandleGetUidByDebugBundleName(MessageParcel &data, MessageParcel &reply);
571 
572     ErrCode HandleGetAbilityInfo(MessageParcel &data, MessageParcel &reply);
573 
574     ErrCode HandleGetAbilityInfoWithModuleName(MessageParcel &data, MessageParcel &reply);
575 
576     /**
577      * @brief Handles the HandleGetModuleUpgradeFlag function called from a IBundleMgr proxy object.
578      * @param data Indicates the data to be read.
579      * @param reply Indicates the reply to be sent;
580      * @return Returns ERR_OK if called successfully; returns error code otherwise.
581      */
582     ErrCode HandleGetModuleUpgradeFlag(MessageParcel &data, MessageParcel &reply);
583     /**
584      * @brief Handles the HandleSetModuleUpgradeFlag function called from a IBundleMgr proxy object.
585      * @param data Indicates the data to be read.
586      * @param reply Indicates the reply to be sent;
587      * @return Returns ERR_OK if called successfully; returns error code otherwise.
588      */
589     ErrCode HandleSetModuleUpgradeFlag(MessageParcel &data, MessageParcel &reply);
590     /**
591      * @brief Handles the HandleIsModuleRemovable function called from a IBundleMgr proxy object.
592      * @param data Indicates the data to be read.
593      * @param reply Indicates the reply to be sent;
594      * @return Returns ERR_OK if called successfully; returns error code otherwise.
595      */
596     ErrCode HandleIsModuleRemovable(MessageParcel &data, MessageParcel &reply);
597     /**
598      * @brief Handles the HandleSetModuleRemovable function called from a IBundleMgr proxy object.
599      * @param data Indicates the data to be read.
600      * @param reply Indicates the reply to be sent;
601      * @return Returns ERR_OK if called successfully; returns error code otherwise.
602      */
603     ErrCode HandleSetModuleRemovable(MessageParcel &data, MessageParcel &reply);
604 
605     ErrCode HandleImplicitQueryInfoByPriority(MessageParcel &data, MessageParcel &reply);
606 
607     ErrCode HandleImplicitQueryInfos(MessageParcel &data, MessageParcel &reply);
608 
609     ErrCode HandleGetAllDependentModuleNames(MessageParcel &data, MessageParcel &reply);
610 
611     ErrCode HandleGetSandboxBundleInfo(MessageParcel &data, MessageParcel &reply);
612 
613     ErrCode HandleObtainCallingBundleName(MessageParcel &data, MessageParcel &reply);
614 
615     ErrCode HandleGetBundleStats(MessageParcel &data, MessageParcel &reply);
616 
617     ErrCode HandleGetAllBundleStats(MessageParcel &data, MessageParcel &reply);
618 
619     ErrCode HandleCheckAbilityEnableInstall(MessageParcel &data, MessageParcel &reply);
620 
621     ErrCode HandleGetSandboxAbilityInfo(MessageParcel &data, MessageParcel &reply);
622 
623     ErrCode HandleGetSandboxExtAbilityInfos(MessageParcel &data, MessageParcel &reply);
624 
625     ErrCode HandleGetSandboxHapModuleInfo(MessageParcel &data, MessageParcel &reply);
626 
627     ErrCode HandleGetMediaData(MessageParcel &data, MessageParcel &reply);
628 
629     ErrCode HandleGetStringById(MessageParcel &data, MessageParcel &reply);
630 
631     ErrCode HandleGetIconById(MessageParcel &data, MessageParcel &reply);
632 
633 #ifdef BUNDLE_FRAMEWORK_DEFAULT_APP
634     ErrCode HandleGetDefaultAppProxy(MessageParcel &data, MessageParcel &reply);
635 #endif
636 
637 #ifdef BUNDLE_FRAMEWORK_APP_CONTROL
638     ErrCode HandleGetAppControlProxy(MessageParcel &data, MessageParcel &reply);
639 #endif
640 
641     ErrCode HandleGetQuickFixManagerProxy(MessageParcel &data, MessageParcel &reply);
642 
643     ErrCode HandleSetDebugMode(MessageParcel &data, MessageParcel &reply);
644 
645     ErrCode HandleVerifySystemApi(MessageParcel &data, MessageParcel &reply);
646 
647     ErrCode HandleGetOverlayManagerProxy(MessageParcel &data, MessageParcel &reply);
648 
649     ErrCode HandleProcessPreload(MessageParcel &data, MessageParcel &reply);
650 
651     ErrCode HandleGetAppProvisionInfo(MessageParcel &data, MessageParcel &reply);
652 
653     ErrCode HandleGetProvisionMetadata(MessageParcel &data, MessageParcel &reply);
654 
655     ErrCode HandleGetBaseSharedBundleInfos(MessageParcel &data, MessageParcel &reply);
656 
657     ErrCode HandleGetAllSharedBundleInfo(MessageParcel &data, MessageParcel &reply);
658 
659     ErrCode HandleGetSharedBundleInfo(MessageParcel &data, MessageParcel &reply);
660 
661     ErrCode HandleGetSharedBundleInfoBySelf(MessageParcel &data, MessageParcel &reply);
662 
663     ErrCode HandleGetSharedDependencies(MessageParcel &data, MessageParcel &reply);
664 
665     ErrCode HandleGetProxyDataInfos(MessageParcel &data, MessageParcel &reply);
666 
667     ErrCode HandleGetAllProxyDataInfos(MessageParcel &data, MessageParcel &reply);
668 
669     ErrCode HandleGetSpecifiedDistributionType(MessageParcel &data, MessageParcel &reply);
670 
671     ErrCode HandleGetAdditionalInfo(MessageParcel &data, MessageParcel &reply);
672 
673     ErrCode HandleSetExtNameOrMIMEToApp(MessageParcel &data, MessageParcel &reply);
674 
675     ErrCode HandleDelExtNameOrMIMEToApp(MessageParcel &data, MessageParcel &reply);
676 
677     ErrCode HandleQueryDataGroupInfos(MessageParcel &data, MessageParcel &reply);
678 
679     ErrCode HandleGetPreferenceDirByGroupId(MessageParcel &data, MessageParcel &reply);
680 
681     ErrCode HandleQueryAppGalleryBundleName(MessageParcel &data, MessageParcel &reply);
682 
683     /**
684      * @brief Handles the HandleQueryExtensionAbilityInfosWithTypeName function called from a IBundleMgr proxy object.
685      * @param data Indicates the data to be read.
686      * @param reply Indicates the reply to be sent;
687      * @return Returns ERR_OK if called successfully; returns error code otherwise.
688      */
689     ErrCode HandleQueryExtensionAbilityInfosWithTypeName(MessageParcel &data, MessageParcel &reply);
690 
691     /**
692      * @brief Handles the HandleQueryExtensionAbilityInfosWithoutWant function called from a IBundleMgr proxy object.
693      * @param data Indicates the data to be read.
694      * @param reply Indicates the reply to be sent;
695      * @return Returns ERR_OK if called successfully; returns error code otherwise.
696      */
697     ErrCode HandleQueryExtensionAbilityInfosOnlyWithTypeName(MessageParcel &data, MessageParcel &reply);
698     ErrCode HandleResetAOTCompileStatus(MessageParcel &data, MessageParcel &reply);
699 
700     ErrCode HandleGetJsonProfile(MessageParcel &data, MessageParcel &reply);
701 
702     ErrCode HandleGetBundleResourceProxy(MessageParcel &data, MessageParcel &reply);
703     ErrCode HandleSetAdditionalInfo(MessageParcel &data, MessageParcel &reply);
704 
705     ErrCode HandleGetRecoverableApplicationInfo(MessageParcel &data, MessageParcel &reply);
706 
707     ErrCode HandleGetUninstalledBundleInfo(MessageParcel &data, MessageParcel &reply);
708 
709     ErrCode HandleCreateBundleDataDir(MessageParcel &data, MessageParcel &reply);
710 
711 private:
712     /**
713      * @brief Write a parcelabe vector objects to the proxy node.
714      * @param parcelableVector Indicates the objects to be write.
715      * @param reply Indicates the reply to be sent;
716      * @return Returns true if objects send successfully; returns false otherwise.
717      */
718     template<typename T>
719     bool WriteParcelableVector(std::vector<T> &parcelableVector, MessageParcel &reply);
720 
721     template<typename T>
722     bool WriteVectorToParcelIntelligent(std::vector<T> &parcelableVector, MessageParcel &reply);
723     /**
724      * @brief Allocat ashmem num.
725      * @return Returns ashmem num.
726      */
727     int32_t AllocatAshmemNum();
728     void init();
729 
730     template<typename T>
731     bool WriteParcelableIntoAshmem(
732         T &parcelable, const char *ashmemName, MessageParcel &reply);
733 
734     template<typename T>
735     ErrCode WriteBigParcelable(
736         T &parcelable, const char *ashmemName, MessageParcel &reply);
737 
738     template<typename T>
739     ErrCode WriteParcelInfo(const T &parcelInfo, MessageParcel &reply) const;
740 
741     template<typename T>
742     ErrCode WriteParcelInfoIntelligent(const T &parcelInfo, MessageParcel &reply) const;
743 
744     ErrCode WriteBigString(const std::string &str, MessageParcel &reply) const;
745 
746     using BundleMgrHostFunc = ErrCode (BundleMgrHost::*)(MessageParcel &, MessageParcel &);
747     std::unordered_map<uint32_t, BundleMgrHostFunc> funcMap_;
748 
749     std::mutex bundleAshmemMutex_;
750     int32_t ashmemNum_ = 0;
751     DISALLOW_COPY_AND_MOVE(BundleMgrHost);
752 };
753 }  // namespace AppExecFwk
754 }  // namespace OHOS
755 #endif  // FOUNDATION_APPEXECFWK_INTERFACES_INNERKITS_APPEXECFWK_CORE_INCLUDE_BUNDLEMGR_BUNDLE_MGR_HOST_H
756