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_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 BatchGetBundleInfo 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 HandleBatchGetBundleInfo(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 HandleGetBundleInfos(MessageParcel &data, MessageParcel &reply);
143     /**
144      * @brief Handles the GetBundleInfos 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 HandleGetBundleInfosWithIntFlags(MessageParcel &data, MessageParcel &reply);
150     /**
151      * @brief Handles the GetBundleInfo 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 HandleGetBundleInfosWithIntFlagsV9(MessageParcel &data, MessageParcel &reply);
157     /**
158      * @brief Handles the GetBundleNameForUid 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 HandleGetBundleNameForUid(MessageParcel &data, MessageParcel &reply);
164     /**
165      * @brief Handles the GetBundlesForUid 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 HandleGetBundlesForUid(MessageParcel &data, MessageParcel &reply);
171     /**
172      * @brief Handles the GetNameForUid 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 HandleGetNameForUid(MessageParcel &data, MessageParcel &reply);
178     /**
179      * @brief Handles the GetNameAndIndexForUid 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 HandleGetNameAndIndexForUid(MessageParcel &data, MessageParcel &reply);
185     /**
186      * @brief Handles the GetBundleGids 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 HandleGetBundleGids(MessageParcel &data, MessageParcel &reply);
192     /**
193      * @brief Handles the GetBundleGidsByUid 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 HandleGetBundleGidsByUid(MessageParcel &data, MessageParcel &reply);
199     /**
200      * @brief Handles the GetBundleInfosByMetaData function called from a IBundleMgr proxy object.
201      * @param data Indicates the data to be read.
202      * @param reply Indicates the reply to be sent;
203      * @return Returns ERR_OK if called successfully; returns error code otherwise.
204      */
205     ErrCode HandleGetBundleInfosByMetaData(MessageParcel &data, MessageParcel &reply);
206     /**
207      * @brief Handles the QueryAbilityInfo function called from a IBundleMgr proxy object.
208      * @param data Indicates the data to be read.
209      * @param reply Indicates the reply to be sent;
210      * @return Returns ERR_OK if called successfully; returns error code otherwise.
211      */
212     ErrCode HandleQueryAbilityInfo(MessageParcel &data, MessageParcel &reply);
213 
214      /**
215      * @brief Handles the QueryAbilityInfo function called from a IBundleMgr proxy object with callback.
216      * @param data Indicates the data to be read.
217      * @param reply Indicates the reply to be sent;
218      * @return Returns ERR_OK if called successfully; returns error code otherwise.
219      */
220     ErrCode HandleQueryAbilityInfoWithCallback(MessageParcel &data, MessageParcel &reply);
221 
222      /**
223      * @brief Handles the SilentInstall function called from a IBundleMgr proxy.
224      * @param data Indicates the data to be read.
225      * @param reply Indicates the reply to be sent;
226      * @return Returns ERR_OK if called successfully; returns error code otherwise.
227      */
228     ErrCode HandleSilentInstall(MessageParcel &data, MessageParcel &reply);
229 
230     /**
231      * @brief Handles the UpgradeAtomicService function called from a IBundleMgr proxy object.
232      * @param data Indicates the data to be read.
233      * @param reply Indicates the reply to be sent;
234      * @return Returns ERR_OK if called successfully; returns error code otherwise.
235      */
236     ErrCode HandleUpgradeAtomicService(MessageParcel &data, MessageParcel &reply);
237 
238     /**
239      * @brief Handles the QueryAbilityInfo 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 HandleQueryAbilityInfoMutiparam(MessageParcel &data, MessageParcel &reply);
245     /**
246      * @brief Handles the QueryAbilityInfos 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 HandleQueryAbilityInfos(MessageParcel &data, MessageParcel &reply);
252     /**
253      * @brief Handles the QueryAbilityInfoByUri 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 HandleQueryAbilityInfoByUri(MessageParcel &data, MessageParcel &reply);
259     /**
260      * @brief Handles the QueryAbilityInfoByUri 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 HandleQueryAbilityInfosByUri(MessageParcel &data, MessageParcel &reply);
266     /**
267      * @brief Handles the QueryAbilityInfosMutiparam 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 HandleQueryAbilityInfosMutiparam(MessageParcel &data, MessageParcel &reply);
273     /**
274      * @brief Handles the QueryAbilityInfosV9 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 HandleQueryAbilityInfosV9(MessageParcel &data, MessageParcel &reply);
280     /**
281      * @brief Handles the BatchQueryAbilityInfos 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 HandleBatchQueryAbilityInfos(MessageParcel &data, MessageParcel &reply);
287     /**
288      * @brief Handles the HandleQueryLauncherAbilityInfos 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 HandleQueryLauncherAbilityInfos(MessageParcel &data, MessageParcel &reply);
294     /**
295      * @brief Handles the HandleQueryAllAbilityInfos 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 HandleQueryAllAbilityInfos(MessageParcel &data, MessageParcel &reply);
301     /**
302      * @brief Handles the QueryAbilityInfoByUri 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 HandleQueryAbilityInfoByUriForUserId(MessageParcel &data, MessageParcel &reply);
308     /**
309      * @brief Handles the QueryKeepAliveBundleInfos 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 HandleQueryKeepAliveBundleInfos(MessageParcel &data, MessageParcel &reply);
315     /**
316      * @brief Handles the GetAbilityLabel 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 HandleGetAbilityLabel(MessageParcel &data, MessageParcel &reply);
322     /**
323      * @brief Handles the GetAbilityLabel 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 HandleGetAbilityLabelWithModuleName(MessageParcel &data, MessageParcel &reply);
329     /**
330      * @brief Handles the CheckIsSystemAppByUid 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 HandleCheckIsSystemAppByUid(MessageParcel &data, MessageParcel &reply);
336     /**
337      * @brief Handles the GetBundleArchiveInfo 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 HandleGetBundleArchiveInfo(MessageParcel &data, MessageParcel &reply);
343     /**
344      * @brief Handles the GetBundleArchiveInfo 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 HandleGetBundleArchiveInfoWithIntFlags(MessageParcel &data, MessageParcel &reply);
350     /**
351      * @brief Handles the GetBundleArchiveInfo 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 HandleGetBundleArchiveInfoWithIntFlagsV9(MessageParcel &data, MessageParcel &reply);
357     /**
358      * @brief Handles the GetHapModuleInfo 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 HandleGetHapModuleInfo(MessageParcel &data, MessageParcel &reply);
364     /**
365      * @brief Handles the GetHapModuleInfo 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 HandleGetHapModuleInfoWithUserId(MessageParcel &data, MessageParcel &reply);
371     /**
372      * @brief Handles the GetLaunchWantForBundle 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 HandleGetLaunchWantForBundle(MessageParcel &data, MessageParcel &reply);
378     /**
379      * @brief Handles the GetPermissionDef 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 HandleGetPermissionDef(MessageParcel &data, MessageParcel &reply);
385     /**
386      * @brief Handles the CleanBundleCacheFilesAutomatic function called from a IBundleMgr proxy object.
387      * @param data Indicates the data to be read.
388      * @param reply Indicates the reply to be sent;
389      * @return Returns ERR_OK if called successfully; returns error code otherwise.
390      */
391     ErrCode HandleCleanBundleCacheFilesAutomatic(MessageParcel &data, MessageParcel &reply);
392     /**
393      * @brief Handles the CleanBundleCacheFiles function called from a IBundleMgr proxy object.
394      * @param data Indicates the data to be read.
395      * @param reply Indicates the reply to be sent;
396      * @return Returns ERR_OK if called successfully; returns error code otherwise.
397      */
398     ErrCode HandleCleanBundleCacheFiles(MessageParcel &data, MessageParcel &reply);
399     /**
400      * @brief Handles the CleanBundleDataFiles function called from a IBundleMgr proxy object.
401      * @param data Indicates the data to be read.
402      * @param reply Indicates the reply to be sent;
403      * @return Returns ERR_OK if called successfully; returns error code otherwise.
404      */
405     ErrCode HandleCleanBundleDataFiles(MessageParcel &data, MessageParcel &reply);
406     /**
407      * @brief Handles the RegisterBundleStatusCallback function called from a IBundleMgr proxy object.
408      * @param data Indicates the data to be read.
409      * @param reply Indicates the reply to be sent;
410      * @return Returns ERR_OK if called successfully; returns error code otherwise.
411      */
412     ErrCode HandleRegisterBundleStatusCallback(MessageParcel &data, MessageParcel &reply);
413 
414     ErrCode HandleRegisterBundleEventCallback(MessageParcel &data, MessageParcel &reply);
415 
416     ErrCode HandleUnregisterBundleEventCallback(MessageParcel &data, MessageParcel &reply);
417     /**
418      * @brief Handles the ClearBundleStatusCallback 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 HandleClearBundleStatusCallback(MessageParcel &data, MessageParcel &reply);
424     /**
425      * @brief Handles the UnregisterBundleStatusCallback 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 HandleUnregisterBundleStatusCallback(MessageParcel &data, MessageParcel &reply);
431     /**
432      * @brief Handles the DumpInfos 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 HandleDumpInfos(MessageParcel &data, MessageParcel &reply);
438     /**
439      * @brief Handles the CompileProcessAOT 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 HandleCompileProcessAOT(MessageParcel &data, MessageParcel &reply);
445     /**
446      * @brief Handles the CompileReset 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 HandleCompileReset(MessageParcel &data, MessageParcel &reply);
452     /**
453      * @brief Handles the CopyAp 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 HandleCopyAp(MessageParcel &data, MessageParcel &reply);
459     /**
460      * @brief Handles the GetBundleInstaller 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 HandleGetBundleInstaller(MessageParcel &data, MessageParcel &reply);
466     /**
467      * @brief Handles the GetBundleUserMgr 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 HandleGetBundleUserMgr(MessageParcel &data, MessageParcel &reply);
473     /**
474      * @brief Handles the GetVerifyManager 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 HandleGetVerifyManager(MessageParcel &data, MessageParcel &reply);
480     /**
481      * @brief Handles the IsApplicationEnabled 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 HandleIsApplicationEnabled(MessageParcel &data, MessageParcel &reply);
487     /**
488      * @brief Handles the IsCloneApplicationEnabled 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 HandleIsCloneApplicationEnabled(MessageParcel &data, MessageParcel &reply);
494     /**
495      * @brief Handles the SetApplicationEnabled 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 HandleSetApplicationEnabled(MessageParcel &data, MessageParcel &reply);
501     /**
502      * @brief Handles the SetCloneApplicationEnabled 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 HandleSetCloneApplicationEnabled(MessageParcel &data, MessageParcel &reply);
508     /**
509      * @brief Handles the IsAbilityEnabled 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 HandleIsAbilityEnabled(MessageParcel &data, MessageParcel &reply);
515     /**
516      * @brief Handles the IsCloneAbilityEnabled 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 HandleIsCloneAbilityEnabled(MessageParcel &data, MessageParcel &reply);
522     /**
523      * @brief Handles the SetAbilityEnabled 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 HandleSetAbilityEnabled(MessageParcel &data, MessageParcel &reply);
529     /**
530      * @brief Handles the SetCloneAbilityEnabled 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 HandleSetCloneAbilityEnabled(MessageParcel &data, MessageParcel &reply);
536     /**
537      * @brief Handles the GetAllFormsInfo 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 HandleGetAllFormsInfo(MessageParcel &data, MessageParcel &reply);
543     /**
544      * @brief Handles the GetFormsInfoByApp 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 HandleGetFormsInfoByApp(MessageParcel &data, MessageParcel &reply);
550     /**
551      * @brief Handles the HandleGetFormsInfoByModule 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 HandleGetFormsInfoByModule(MessageParcel &data, MessageParcel &reply);
557     /**
558      * @brief Handles the HandleGetShortcutInfo function called from a IBundleMgr proxy object.
559      * @param data Indicates the data to be read.
560      * @param reply Indicates the reply to be sent;
561      * @return Returns ERR_OK if called successfully; returns error code otherwise.
562      */
563     ErrCode HandleGetShortcutInfos(MessageParcel &data, MessageParcel &reply);
564     /**
565      * @brief Handles the HandleGetShortcutInfo function called from a IBundleMgr proxy object.
566      * @param data Indicates the data to be read.
567      * @param reply Indicates the reply to be sent;
568      * @return Returns err_code of result.
569      */
570     ErrCode HandleGetShortcutInfoV9(MessageParcel &data, MessageParcel &reply);
571     /**
572      * @brief Handles the HandleGetAllCommonEventInfo function called from a IBundleMgr proxy object.
573      * @param data Indicates the data to be read.
574      * @param reply Indicates the reply to be sent;
575      * @return Returns ERR_OK if called successfully; returns error code otherwise.
576      */
577     ErrCode HandleGetAllCommonEventInfo(MessageParcel &data, MessageParcel &reply);
578     /**
579      * @brief Handles the GetDistributedBundleInfo function called from a IBundleMgr proxy object.
580      * @param data Indicates the data to be read.
581      * @param reply Indicates the reply to be sent;
582      * @return Returns ERR_OK if called successfully; returns error code otherwise.
583      */
584     ErrCode HandleGetDistributedBundleInfo(MessageParcel &data, MessageParcel &reply);
585     /**
586      * @brief Handles the HandleGetAppPrivilegeLevel function called from a IBundleMgr proxy object.
587      * @param data Indicates the data to be read.
588      * @param reply Indicates the reply to be sent;
589      * @return Returns ERR_OK if called successfully; returns error code otherwise.
590      */
591     ErrCode HandleGetAppPrivilegeLevel(MessageParcel &data, MessageParcel &reply);
592     /**
593      * @brief Handles the HandleQueryExtAbilityInfosWithoutType function called from a IBundleMgr proxy object.
594      * @param data Indicates the data to be read.
595      * @param reply Indicates the reply to be sent;
596      * @return Returns ERR_OK if called successfully; returns error code otherwise.
597      */
598     ErrCode HandleQueryExtAbilityInfosWithoutType(MessageParcel &data, MessageParcel &reply);
599     /**
600      * @brief Handles the HandleQueryExtAbilityInfosWithoutTypeV9 function called from a IBundleMgr proxy object.
601      * @param data Indicates the data to be read.
602      * @param reply Indicates the reply to be sent;
603      * @return Returns ERR_OK if called successfully; returns error code otherwise.
604      */
605     ErrCode HandleQueryExtAbilityInfosWithoutTypeV9(MessageParcel &data, MessageParcel &reply);
606     /**
607      * @brief Handles the HandleQueryExtensionInfo function called from a IBundleMgr proxy object.
608      * @param data Indicates the data to be read.
609      * @param reply Indicates the reply to be sent;
610      * @return Returns ERR_OK if called successfully; returns error code otherwise.
611      */
612     ErrCode HandleQueryExtAbilityInfos(MessageParcel &data, MessageParcel &reply);
613     /**
614      * @brief Handles the HandleQueryExtAbilityInfosV9 function called from a IBundleMgr proxy object.
615      * @param data Indicates the data to be read.
616      * @param reply Indicates the reply to be sent;
617      * @return Returns ERR_OK if called successfully; returns error code otherwise.
618      */
619     ErrCode HandleQueryExtAbilityInfosV9(MessageParcel &data, MessageParcel &reply);
620 
621     ErrCode HandleQueryExtAbilityInfosByType(MessageParcel &data, MessageParcel &reply);
622 
623     ErrCode HandleVerifyCallingPermission(MessageParcel &data, MessageParcel &reply);
624 
625     ErrCode HandleQueryExtensionAbilityInfoByUri(MessageParcel &data, MessageParcel &reply);
626 
627     ErrCode HandleGetAppIdByBundleName(MessageParcel &data, MessageParcel &reply);
628 
629     ErrCode HandleGetAppType(MessageParcel &data, MessageParcel &reply);
630 
631     ErrCode HandleGetUidByBundleName(MessageParcel &data, MessageParcel &reply);
632 
633     ErrCode HandleGetUidByDebugBundleName(MessageParcel &data, MessageParcel &reply);
634 
635     ErrCode HandleGetAbilityInfo(MessageParcel &data, MessageParcel &reply);
636 
637     ErrCode HandleGetAbilityInfoWithModuleName(MessageParcel &data, MessageParcel &reply);
638 
639     /**
640      * @brief Handles the HandleGetModuleUpgradeFlag function called from a IBundleMgr proxy object.
641      * @param data Indicates the data to be read.
642      * @param reply Indicates the reply to be sent;
643      * @return Returns ERR_OK if called successfully; returns error code otherwise.
644      */
645     ErrCode HandleGetModuleUpgradeFlag(MessageParcel &data, MessageParcel &reply);
646     /**
647      * @brief Handles the HandleSetModuleUpgradeFlag function called from a IBundleMgr proxy object.
648      * @param data Indicates the data to be read.
649      * @param reply Indicates the reply to be sent;
650      * @return Returns ERR_OK if called successfully; returns error code otherwise.
651      */
652     ErrCode HandleSetModuleUpgradeFlag(MessageParcel &data, MessageParcel &reply);
653     /**
654      * @brief Handles the HandleIsModuleRemovable function called from a IBundleMgr proxy object.
655      * @param data Indicates the data to be read.
656      * @param reply Indicates the reply to be sent;
657      * @return Returns ERR_OK if called successfully; returns error code otherwise.
658      */
659     ErrCode HandleIsModuleRemovable(MessageParcel &data, MessageParcel &reply);
660     /**
661      * @brief Handles the HandleSetModuleRemovable function called from a IBundleMgr proxy object.
662      * @param data Indicates the data to be read.
663      * @param reply Indicates the reply to be sent;
664      * @return Returns ERR_OK if called successfully; returns error code otherwise.
665      */
666     ErrCode HandleSetModuleRemovable(MessageParcel &data, MessageParcel &reply);
667 
668     ErrCode HandleImplicitQueryInfoByPriority(MessageParcel &data, MessageParcel &reply);
669 
670     ErrCode HandleImplicitQueryInfos(MessageParcel &data, MessageParcel &reply);
671 
672     ErrCode HandleGetAllDependentModuleNames(MessageParcel &data, MessageParcel &reply);
673 
674     ErrCode HandleGetSandboxBundleInfo(MessageParcel &data, MessageParcel &reply);
675 
676     ErrCode HandleObtainCallingBundleName(MessageParcel &data, MessageParcel &reply);
677 
678     ErrCode HandleGetBundleStats(MessageParcel &data, MessageParcel &reply);
679 
680     ErrCode HandleGetAllBundleStats(MessageParcel &data, MessageParcel &reply);
681 
682     ErrCode HandleGetExtendResourceManager(MessageParcel &data, MessageParcel &reply);
683 
684     ErrCode HandleCheckAbilityEnableInstall(MessageParcel &data, MessageParcel &reply);
685 
686     ErrCode HandleGetSandboxAbilityInfo(MessageParcel &data, MessageParcel &reply);
687 
688     ErrCode HandleGetSandboxExtAbilityInfos(MessageParcel &data, MessageParcel &reply);
689 
690     ErrCode HandleGetSandboxHapModuleInfo(MessageParcel &data, MessageParcel &reply);
691 
692     ErrCode HandleGetMediaData(MessageParcel &data, MessageParcel &reply);
693 
694     ErrCode HandleGetStringById(MessageParcel &data, MessageParcel &reply);
695 
696     ErrCode HandleGetIconById(MessageParcel &data, MessageParcel &reply);
697 
698 #ifdef BUNDLE_FRAMEWORK_DEFAULT_APP
699     ErrCode HandleGetDefaultAppProxy(MessageParcel &data, MessageParcel &reply);
700 #endif
701 
702 #ifdef BUNDLE_FRAMEWORK_APP_CONTROL
703     ErrCode HandleGetAppControlProxy(MessageParcel &data, MessageParcel &reply);
704 #endif
705 
706     ErrCode HandleGetQuickFixManagerProxy(MessageParcel &data, MessageParcel &reply);
707 
708     ErrCode HandleSetDebugMode(MessageParcel &data, MessageParcel &reply);
709 
710     ErrCode HandleVerifySystemApi(MessageParcel &data, MessageParcel &reply);
711 
712     ErrCode HandleGetOverlayManagerProxy(MessageParcel &data, MessageParcel &reply);
713 
714     ErrCode HandleProcessPreload(MessageParcel &data, MessageParcel &reply);
715 
716     ErrCode HandleGetAppProvisionInfo(MessageParcel &data, MessageParcel &reply);
717 
718     ErrCode HandleGetProvisionMetadata(MessageParcel &data, MessageParcel &reply);
719 
720     ErrCode HandleGetBaseSharedBundleInfos(MessageParcel &data, MessageParcel &reply);
721 
722     ErrCode HandleGetAllSharedBundleInfo(MessageParcel &data, MessageParcel &reply);
723 
724     ErrCode HandleGetSharedBundleInfo(MessageParcel &data, MessageParcel &reply);
725 
726     ErrCode HandleGetSharedBundleInfoBySelf(MessageParcel &data, MessageParcel &reply);
727 
728     ErrCode HandleGetSharedDependencies(MessageParcel &data, MessageParcel &reply);
729 
730     ErrCode HandleGetProxyDataInfos(MessageParcel &data, MessageParcel &reply);
731 
732     ErrCode HandleGetAllProxyDataInfos(MessageParcel &data, MessageParcel &reply);
733 
734     ErrCode HandleGetSpecifiedDistributionType(MessageParcel &data, MessageParcel &reply);
735 
736     ErrCode HandleGetAdditionalInfo(MessageParcel &data, MessageParcel &reply);
737 
738     ErrCode HandleSetExtNameOrMIMEToApp(MessageParcel &data, MessageParcel &reply);
739 
740     ErrCode HandleDelExtNameOrMIMEToApp(MessageParcel &data, MessageParcel &reply);
741 
742     ErrCode HandleQueryDataGroupInfos(MessageParcel &data, MessageParcel &reply);
743 
744     ErrCode HandleGetPreferenceDirByGroupId(MessageParcel &data, MessageParcel &reply);
745 
746     ErrCode HandleQueryAppGalleryBundleName(MessageParcel &data, MessageParcel &reply);
747 
748     /**
749      * @brief Handles the HandleQueryExtensionAbilityInfosWithTypeName function called from a IBundleMgr proxy object.
750      * @param data Indicates the data to be read.
751      * @param reply Indicates the reply to be sent;
752      * @return Returns ERR_OK if called successfully; returns error code otherwise.
753      */
754     ErrCode HandleQueryExtensionAbilityInfosWithTypeName(MessageParcel &data, MessageParcel &reply);
755 
756     /**
757      * @brief Handles the HandleQueryExtensionAbilityInfosWithoutWant function called from a IBundleMgr proxy object.
758      * @param data Indicates the data to be read.
759      * @param reply Indicates the reply to be sent;
760      * @return Returns ERR_OK if called successfully; returns error code otherwise.
761      */
762     ErrCode HandleQueryExtensionAbilityInfosOnlyWithTypeName(MessageParcel &data, MessageParcel &reply);
763     ErrCode HandleResetAOTCompileStatus(MessageParcel &data, MessageParcel &reply);
764 
765     ErrCode HandleGetJsonProfile(MessageParcel &data, MessageParcel &reply);
766 
767     ErrCode HandleGetBundleResourceProxy(MessageParcel &data, MessageParcel &reply);
768     ErrCode HandleSetAdditionalInfo(MessageParcel &data, MessageParcel &reply);
769 
770     ErrCode HandleGetRecoverableApplicationInfo(MessageParcel &data, MessageParcel &reply);
771 
772     ErrCode HandleGetUninstalledBundleInfo(MessageParcel &data, MessageParcel &reply);
773 
774     ErrCode HandleCreateBundleDataDir(MessageParcel &data, MessageParcel &reply);
775 
776     /**
777      * @brief Handles the GetAllPreinstalledApplicationInfos function called from a IBundleMgr proxy object.
778      * @param data Indicates the data to be read.
779      * @param reply Indicates the reply to be sent;
780      * @return Returns ERR_OK if called successfully; returns error code otherwise.
781      */
782     ErrCode HandleGetAllPreinstalledApplicationInfos(MessageParcel &data, MessageParcel &reply);
783 
784     /**
785      * @brief Handles the CanOpenLink function called from a IBundleMgr proxy object.
786      * @param data Indicates the data to be read.
787      * @param reply Indicates the reply to be sent;
788      * @return Returns ERR_OK if called successfully; returns error code otherwise.
789      */
790     ErrCode HandleCanOpenLink(MessageParcel &data, MessageParcel &reply);
791 
792     ErrCode HandleGetOdid(MessageParcel &data, MessageParcel &reply);
793 
794     ErrCode HandleGetAllBundleInfoByDeveloperId(MessageParcel &data, MessageParcel &reply);
795 
796     ErrCode HandleGetDeveloperIds(MessageParcel &data, MessageParcel &reply);
797 
798     ErrCode HandleSwitchUninstallState(MessageParcel &data, MessageParcel &reply);
799 
800     ErrCode HandleQueryAbilityInfoByContinueType(MessageParcel &data, MessageParcel &reply);
801 
802     ErrCode HandleQueryCloneAbilityInfo(MessageParcel &data, MessageParcel &reply);
803 
804     ErrCode HandleGetCloneBundleInfo(MessageParcel &data, MessageParcel &reply);
805 
806     ErrCode HandleGetCloneAppIndexes(MessageParcel &data, MessageParcel &reply);
807 
808     ErrCode HandleGetLaunchWant(MessageParcel &data, MessageParcel &reply);
809 
810     ErrCode HandleQueryCloneExtensionAbilityInfoWithAppIndex(MessageParcel &data, MessageParcel &reply);
811 
812     ErrCode HandleGetSignatureInfoByBundleName(MessageParcel &data, MessageParcel &reply);
813 
814     ErrCode HandleAddDesktopShortcutInfo(MessageParcel &data, MessageParcel &reply);
815 
816     ErrCode HandleDeleteDesktopShortcutInfo(MessageParcel &data, MessageParcel &reply);
817 
818     ErrCode HandleGetAllDesktopShortcutInfo(MessageParcel &data, MessageParcel &reply);
819 
820     ErrCode HandleGetCompatibleDeviceTypeNative(MessageParcel &data, MessageParcel &reply);
821 
822     ErrCode HandleGetCompatibleDeviceType(MessageParcel &data, MessageParcel &reply);
823 
824     ErrCode HandleGetOdidByBundleName(MessageParcel &data, MessageParcel &reply);
825 
826     /**
827      * @brief Handles the GetBundleInfosForContinuation function called from a IBundleMgr proxy object.
828      * @param data Indicates the data to be read.
829      * @param reply Indicates the reply to be sent;
830      * @return Returns ERR_OK if called successfully; returns error code otherwise.
831      */
832     ErrCode HandleGetBundleInfosForContinuation(MessageParcel &data, MessageParcel &reply);
833 
834     /**
835      * @brief Handles the GetContinueBundleNames function called from a IBundleMgr proxy object.
836      * @param data Indicates the data to be read.
837      * @param reply Indicates the reply to be sent;
838      * @return Returns ERR_OK if called successfully; returns error code otherwise.
839      */
840     ErrCode HandleGetContinueBundleNames(MessageParcel &data, MessageParcel &reply);
841 
842     ErrCode HandleIsBundleInstalled(MessageParcel &data, MessageParcel &reply);
843 
844     ErrCode HandleGetBundleNameByAppId(MessageParcel &data, MessageParcel &reply);
845 
846     ErrCode HandleGetDirByBundleNameAndAppIndex(MessageParcel &data, MessageParcel &reply);
847     ErrCode HandleGetAllBundleDirs(MessageParcel &data, MessageParcel &reply);
848 
849 private:
850     /**
851      * @brief Write a parcelabe vector objects to the proxy node.
852      * @param parcelableVector Indicates the objects to be write.
853      * @param reply Indicates the reply to be sent;
854      * @return Returns true if objects send successfully; returns false otherwise.
855      */
856     template<typename T>
857     bool WriteParcelableVector(std::vector<T> &parcelableVector, MessageParcel &reply);
858 
859     template<typename T>
860     bool WriteVectorToParcelIntelligent(std::vector<T> &parcelableVector, MessageParcel &reply);
861     /**
862      * @brief Allocat ashmem num.
863      * @return Returns ashmem num.
864      */
865     int32_t AllocatAshmemNum();
866 
867     template<typename T>
868     bool WriteParcelableIntoAshmem(
869         T &parcelable, const char *ashmemName, MessageParcel &reply);
870 
871     template<typename T>
872     ErrCode WriteBigParcelable(
873         T &parcelable, const char *ashmemName, MessageParcel &reply);
874 
875     template<typename T>
876     ErrCode WriteParcelInfo(const T &parcelInfo, MessageParcel &reply) const;
877 
878     template<typename T>
879     ErrCode WriteParcelInfoIntelligent(const T &parcelInfo, MessageParcel &reply) const;
880 
881     ErrCode WriteBigString(const std::string &str, MessageParcel &reply) const;
882 
883     template<typename T>
884     ErrCode ReadParcelInfoIntelligent(MessageParcel &data, T &parcelInfo);
885 
886     ErrCode WriteParcelableIntoAshmem(MessageParcel &tempParcel, MessageParcel &reply);
887 
888     std::mutex bundleAshmemMutex_;
889     int32_t ashmemNum_ = 0;
890     DISALLOW_COPY_AND_MOVE(BundleMgrHost);
891 };
892 }  // namespace AppExecFwk
893 }  // namespace OHOS
894 #endif  // FOUNDATION_APPEXECFWK_INTERFACES_INNERKITS_APPEXECFWK_CORE_INCLUDE_BUNDLEMGR_BUNDLE_MGR_HOST_H
895