• 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 GetBundleInstaller 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 HandleGetBundleInstaller(MessageParcel &data, MessageParcel &reply);
417     /**
418      * @brief Handles the GetBundleUserMgr 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 HandleGetBundleUserMgr(MessageParcel &data, MessageParcel &reply);
424     /**
425      * @brief Handles the IsApplicationEnabled 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 HandleIsApplicationEnabled(MessageParcel &data, MessageParcel &reply);
431     /**
432      * @brief Handles the SetApplicationEnabled 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 HandleSetApplicationEnabled(MessageParcel &data, MessageParcel &reply);
438     /**
439      * @brief Handles the IsAbilityEnabled 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 HandleIsAbilityEnabled(MessageParcel &data, MessageParcel &reply);
445     /**
446      * @brief Handles the SetAbilityEnabled 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 HandleSetAbilityEnabled(MessageParcel &data, MessageParcel &reply);
452     /**
453      * @brief Handles the GetAllFormsInfo 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 HandleGetAllFormsInfo(MessageParcel &data, MessageParcel &reply);
459     /**
460      * @brief Handles the GetFormsInfoByApp 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 HandleGetFormsInfoByApp(MessageParcel &data, MessageParcel &reply);
466     /**
467      * @brief Handles the HandleGetFormsInfoByModule 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 HandleGetFormsInfoByModule(MessageParcel &data, MessageParcel &reply);
473     /**
474      * @brief Handles the HandleGetShortcutInfo 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 HandleGetShortcutInfos(MessageParcel &data, MessageParcel &reply);
480     /**
481      * @brief Handles the HandleGetShortcutInfo 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_code of result.
485      */
486     ErrCode HandleGetShortcutInfoV9(MessageParcel &data, MessageParcel &reply);
487     /**
488      * @brief Handles the HandleGetAllCommonEventInfo 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 HandleGetAllCommonEventInfo(MessageParcel &data, MessageParcel &reply);
494     /**
495      * @brief Handles the GetDistributedBundleInfo 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 HandleGetDistributedBundleInfo(MessageParcel &data, MessageParcel &reply);
501     /**
502      * @brief Handles the HandleGetAppPrivilegeLevel 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_OK if called successfully; returns error code otherwise.
506      */
507     ErrCode HandleGetAppPrivilegeLevel(MessageParcel &data, MessageParcel &reply);
508     /**
509      * @brief Handles the HandleQueryExtAbilityInfosWithoutType 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 HandleQueryExtAbilityInfosWithoutType(MessageParcel &data, MessageParcel &reply);
515     /**
516      * @brief Handles the HandleQueryExtAbilityInfosWithoutTypeV9 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 HandleQueryExtAbilityInfosWithoutTypeV9(MessageParcel &data, MessageParcel &reply);
522     /**
523      * @brief Handles the HandleQueryExtensionInfo 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 HandleQueryExtAbilityInfos(MessageParcel &data, MessageParcel &reply);
529     /**
530      * @brief Handles the HandleQueryExtAbilityInfosV9 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 HandleQueryExtAbilityInfosV9(MessageParcel &data, MessageParcel &reply);
536 
537     ErrCode HandleQueryExtAbilityInfosByType(MessageParcel &data, MessageParcel &reply);
538 
539     ErrCode HandleVerifyCallingPermission(MessageParcel &data, MessageParcel &reply);
540 
541     ErrCode HandleQueryExtensionAbilityInfoByUri(MessageParcel &data, MessageParcel &reply);
542 
543     ErrCode HandleGetAppIdByBundleName(MessageParcel &data, MessageParcel &reply);
544 
545     ErrCode HandleGetAppType(MessageParcel &data, MessageParcel &reply);
546 
547     ErrCode HandleGetUidByBundleName(MessageParcel &data, MessageParcel &reply);
548 
549     ErrCode HandleGetUidByDebugBundleName(MessageParcel &data, MessageParcel &reply);
550 
551     ErrCode HandleGetAbilityInfo(MessageParcel &data, MessageParcel &reply);
552 
553     ErrCode HandleGetAbilityInfoWithModuleName(MessageParcel &data, MessageParcel &reply);
554 
555     /**
556      * @brief Handles the HandleGetModuleUpgradeFlag function called from a IBundleMgr proxy object.
557      * @param data Indicates the data to be read.
558      * @param reply Indicates the reply to be sent;
559      * @return Returns ERR_OK if called successfully; returns error code otherwise.
560      */
561     ErrCode HandleGetModuleUpgradeFlag(MessageParcel &data, MessageParcel &reply);
562     /**
563      * @brief Handles the HandleSetModuleUpgradeFlag function called from a IBundleMgr proxy object.
564      * @param data Indicates the data to be read.
565      * @param reply Indicates the reply to be sent;
566      * @return Returns ERR_OK if called successfully; returns error code otherwise.
567      */
568     ErrCode HandleSetModuleUpgradeFlag(MessageParcel &data, MessageParcel &reply);
569     /**
570      * @brief Handles the HandleIsModuleRemovable function called from a IBundleMgr proxy object.
571      * @param data Indicates the data to be read.
572      * @param reply Indicates the reply to be sent;
573      * @return Returns ERR_OK if called successfully; returns error code otherwise.
574      */
575     ErrCode HandleIsModuleRemovable(MessageParcel &data, MessageParcel &reply);
576     /**
577      * @brief Handles the HandleSetModuleRemovable 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 HandleSetModuleRemovable(MessageParcel &data, MessageParcel &reply);
583 
584     ErrCode HandleImplicitQueryInfoByPriority(MessageParcel &data, MessageParcel &reply);
585 
586     ErrCode HandleImplicitQueryInfos(MessageParcel &data, MessageParcel &reply);
587 
588     ErrCode HandleGetAllDependentModuleNames(MessageParcel &data, MessageParcel &reply);
589 
590     ErrCode HandleGetSandboxBundleInfo(MessageParcel &data, MessageParcel &reply);
591 
592     ErrCode HandleObtainCallingBundleName(MessageParcel &data, MessageParcel &reply);
593 
594     ErrCode HandleGetBundleStats(MessageParcel &data, MessageParcel &reply);
595 
596     ErrCode HandleCheckAbilityEnableInstall(MessageParcel &data, MessageParcel &reply);
597 
598     ErrCode HandleGetSandboxAbilityInfo(MessageParcel &data, MessageParcel &reply);
599 
600     ErrCode HandleGetSandboxExtAbilityInfos(MessageParcel &data, MessageParcel &reply);
601 
602     ErrCode HandleGetSandboxHapModuleInfo(MessageParcel &data, MessageParcel &reply);
603 
604     ErrCode HandleGetMediaData(MessageParcel &data, MessageParcel &reply);
605 
606     ErrCode HandleGetStringById(MessageParcel &data, MessageParcel &reply);
607 
608     ErrCode HandleGetIconById(MessageParcel &data, MessageParcel &reply);
609 
610 #ifdef BUNDLE_FRAMEWORK_DEFAULT_APP
611     ErrCode HandleGetDefaultAppProxy(MessageParcel &data, MessageParcel &reply);
612 #endif
613 
614 #ifdef BUNDLE_FRAMEWORK_APP_CONTROL
615     ErrCode HandleGetAppControlProxy(MessageParcel &data, MessageParcel &reply);
616 #endif
617 
618     ErrCode HandleGetQuickFixManagerProxy(MessageParcel &data, MessageParcel &reply);
619 
620     ErrCode HandleSetDebugMode(MessageParcel &data, MessageParcel &reply);
621 
622     ErrCode HandleVerifySystemApi(MessageParcel &data, MessageParcel &reply);
623 
624     ErrCode HandleGetOverlayManagerProxy(MessageParcel &data, MessageParcel &reply);
625 
626     ErrCode HandleProcessPreload(MessageParcel &data, MessageParcel &reply);
627 
628     ErrCode HandleGetAppProvisionInfo(MessageParcel &data, MessageParcel &reply);
629 
630     ErrCode HandleGetProvisionMetadata(MessageParcel &data, MessageParcel &reply);
631 
632     ErrCode HandleGetBaseSharedBundleInfos(MessageParcel &data, MessageParcel &reply);
633 
634     ErrCode HandleGetAllSharedBundleInfo(MessageParcel &data, MessageParcel &reply);
635 
636     ErrCode HandleGetSharedBundleInfo(MessageParcel &data, MessageParcel &reply);
637 
638     ErrCode HandleGetSharedBundleInfoBySelf(MessageParcel &data, MessageParcel &reply);
639 
640     ErrCode HandleGetSharedDependencies(MessageParcel &data, MessageParcel &reply);
641 
642     ErrCode HandleGetProxyDataInfos(MessageParcel &data, MessageParcel &reply);
643 
644     ErrCode HandleGetAllProxyDataInfos(MessageParcel &data, MessageParcel &reply);
645 
646     ErrCode HandleGetSpecifiedDistributionType(MessageParcel &data, MessageParcel &reply);
647 
648     ErrCode HandleGetAdditionalInfo(MessageParcel &data, MessageParcel &reply);
649 
650     ErrCode HandleSetExtNameOrMIMEToApp(MessageParcel &data, MessageParcel &reply);
651 
652     ErrCode HandleDelExtNameOrMIMEToApp(MessageParcel &data, MessageParcel &reply);
653 
654     ErrCode HandleQueryDataGroupInfos(MessageParcel &data, MessageParcel &reply);
655 
656     ErrCode HandleGetPreferenceDirByGroupId(MessageParcel &data, MessageParcel &reply);
657 
658     ErrCode HandleQueryAppGalleryBundleName(MessageParcel &data, MessageParcel &reply);
659 private:
660     /**
661      * @brief Write a parcelabe vector objects to the proxy node.
662      * @param parcelableVector Indicates the objects to be write.
663      * @param reply Indicates the reply to be sent;
664      * @return Returns true if objects send successfully; returns false otherwise.
665      */
666     template<typename T>
667     bool WriteParcelableVector(std::vector<T> &parcelableVector, MessageParcel &reply);
668 
669     template<typename T>
670     bool WriteVectorToParcelIntelligent(std::vector<T> &parcelableVector, MessageParcel &reply);
671     /**
672      * @brief Allocat ashmem num.
673      * @return Returns ashmem num.
674      */
675     int32_t AllocatAshmemNum();
676     void init();
677 
678     template<typename T>
679     bool WriteParcelableIntoAshmem(
680         T &parcelable, const char *ashmemName, MessageParcel &reply);
681 
682     template<typename T>
683     ErrCode WriteBigParcelable(
684         T &parcelable, const char *ashmemName, MessageParcel &reply);
685 
686     using BundleMgrHostFunc = ErrCode (BundleMgrHost::*)(MessageParcel &, MessageParcel &);
687     std::unordered_map<uint32_t, BundleMgrHostFunc> funcMap_;
688 
689     std::mutex bundleAshmemMutex_;
690     int32_t ashmemNum_ = 0;
691     DISALLOW_COPY_AND_MOVE(BundleMgrHost);
692 };
693 }  // namespace AppExecFwk
694 }  // namespace OHOS
695 #endif  // FOUNDATION_APPEXECFWK_INTERFACES_INNERKITS_APPEXECFWK_CORE_INCLUDE_BUNDLEMGR_BUNDLE_MGR_HOST_H
696