• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2025 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 #include "bundle_manager_helper.h"
17 
18 #include "app_log_wrapper.h"
19 #include "bundle_mgr_client.h"
20 #include "bundle_mgr_interface.h"
21 #include "bundle_mgr_proxy.h"
22 #include "bundle_errors.h"
23 #include "business_error.h"
24 #include "common_func.h"
25 #include "ipc_skeleton.h"
26 #include "verify_manager_client.h"
27 
28 namespace OHOS {
29 namespace AppExecFwk {
30 
InnerBatchQueryAbilityInfos(const std::vector<OHOS::AAFwk::Want> & wants,int32_t flags,int32_t userId,std::vector<AbilityInfo> & abilityInfos)31 ErrCode BundleManagerHelper::InnerBatchQueryAbilityInfos(
32     const std::vector<OHOS::AAFwk::Want>& wants, int32_t flags, int32_t userId, std::vector<AbilityInfo>& abilityInfos)
33 {
34     auto iBundleMgr = CommonFunc::GetBundleMgr();
35     if (iBundleMgr == nullptr) {
36         APP_LOGE("iBundleMgr is null");
37         return ERROR_BUNDLE_SERVICE_EXCEPTION;
38     }
39     ErrCode ret = iBundleMgr->BatchQueryAbilityInfos(wants, flags, userId, abilityInfos);
40     APP_LOGD("BatchQueryAbilityInfos ErrCode : %{public}d", ret);
41     return CommonFunc::ConvertErrCode(ret);
42 }
43 
InnerGetDynamicIcon(const std::string & bundleName,std::string & moduleName)44 ErrCode BundleManagerHelper::InnerGetDynamicIcon(const std::string& bundleName, std::string& moduleName)
45 {
46     auto extResourceManager = CommonFunc::GetExtendResourceManager();
47     if (extResourceManager == nullptr) {
48         APP_LOGE("extResourceManager is null");
49         return ERROR_BUNDLE_SERVICE_EXCEPTION;
50     }
51     ErrCode ret = extResourceManager->GetDynamicIcon(bundleName, moduleName);
52     if (ret != ERR_OK) {
53         APP_LOGE_NOFUNC("GetDynamicIcon failed");
54     }
55     return CommonFunc::ConvertErrCode(ret);
56 }
57 
InnerIsAbilityEnabled(const AbilityInfo & abilityInfo,bool & isEnable,int32_t appIndex)58 ErrCode BundleManagerHelper::InnerIsAbilityEnabled(const AbilityInfo& abilityInfo, bool& isEnable, int32_t appIndex)
59 {
60     auto bundleMgr = CommonFunc::GetBundleMgr();
61     if (bundleMgr == nullptr) {
62         APP_LOGE("CommonFunc::GetBundleMgr failed");
63         return ERROR_BUNDLE_SERVICE_EXCEPTION;
64     }
65     ErrCode ret = ERR_OK;
66     if (appIndex != 0) {
67         ret = bundleMgr->IsCloneAbilityEnabled(abilityInfo, appIndex, isEnable);
68     } else {
69         ret = bundleMgr->IsAbilityEnabled(abilityInfo, isEnable);
70     }
71     return CommonFunc::ConvertErrCode(ret);
72 }
73 
InnerSetAbilityEnabled(const AbilityInfo & abilityInfo,bool & isEnable,int32_t appIndex)74 ErrCode BundleManagerHelper::InnerSetAbilityEnabled(const AbilityInfo& abilityInfo, bool& isEnable, int32_t appIndex)
75 {
76     auto bundleMgr = CommonFunc::GetBundleMgr();
77     if (bundleMgr == nullptr) {
78         APP_LOGE("CommonFunc::GetBundleMgr failed");
79         return ERROR_BUNDLE_SERVICE_EXCEPTION;
80     }
81     ErrCode ret = ERR_OK;
82     if (appIndex != 0) {
83         ret = bundleMgr->SetCloneAbilityEnabled(abilityInfo, appIndex, isEnable);
84     } else {
85         ret = bundleMgr->SetAbilityEnabled(abilityInfo, isEnable);
86     }
87     return CommonFunc::ConvertErrCode(ret);
88 }
89 
InnerSetApplicationEnabled(const std::string & bundleName,bool & isEnable,int32_t appIndex)90 ErrCode BundleManagerHelper::InnerSetApplicationEnabled(const std::string& bundleName, bool& isEnable, int32_t appIndex)
91 {
92     auto bundleMgr = CommonFunc::GetBundleMgr();
93     if (bundleMgr == nullptr) {
94         APP_LOGE("CommonFunc::GetBundleMgr failed");
95         return ERROR_BUNDLE_SERVICE_EXCEPTION;
96     }
97     ErrCode ret = ERR_OK;
98     if (appIndex == 0) {
99         ret = bundleMgr->SetApplicationEnabled(bundleName, isEnable);
100     } else {
101         ret = bundleMgr->SetCloneApplicationEnabled(bundleName, appIndex, isEnable);
102     }
103     return CommonFunc::ConvertErrCode(ret);
104 }
105 
InnerEnableDynamicIcon(const std::string & bundleName,const std::string & moduleName,int32_t appIndex,int32_t userId,bool isDefault)106 ErrCode BundleManagerHelper::InnerEnableDynamicIcon(
107     const std::string& bundleName, const std::string& moduleName, int32_t appIndex, int32_t userId, bool isDefault)
108 {
109     auto extResourceManager = CommonFunc::GetExtendResourceManager();
110     if (extResourceManager == nullptr) {
111         APP_LOGE("extResourceManager is null");
112         return ERROR_BUNDLE_SERVICE_EXCEPTION;
113     }
114     ErrCode ret = ERR_OK;
115     if (isDefault) {
116         ret = extResourceManager->EnableDynamicIcon(bundleName, moduleName);
117     } else {
118         ret = extResourceManager->EnableDynamicIcon(bundleName, moduleName, userId, appIndex);
119     }
120     if (ret != ERR_OK) {
121         APP_LOGE("EnableDynamicIcon failed %{public}d", ret);
122     }
123 
124     return CommonFunc::ConvertErrCode(ret);
125 }
126 
InnerGetAppCloneIdentity(int32_t uid,std::string & bundleName,int32_t & appIndex)127 ErrCode BundleManagerHelper::InnerGetAppCloneIdentity(int32_t uid, std::string& bundleName, int32_t& appIndex)
128 {
129     auto iBundleMgr = CommonFunc::GetBundleMgr();
130     if (iBundleMgr == nullptr) {
131         APP_LOGE("iBundleMgr is null");
132         return ERROR_BUNDLE_SERVICE_EXCEPTION;
133     }
134     ErrCode ret = iBundleMgr->GetNameAndIndexForUid(uid, bundleName, appIndex);
135     APP_LOGD("GetNameAndIndexForUid ErrCode : %{public}d", ret);
136     return CommonFunc::ConvertErrCode(ret);
137 }
138 
InnerGetBundleArchiveInfo(std::string & hapFilePath,int32_t flags,BundleInfo & bundleInfo)139 ErrCode BundleManagerHelper::InnerGetBundleArchiveInfo(std::string& hapFilePath, int32_t flags, BundleInfo& bundleInfo)
140 {
141     auto iBundleMgr = CommonFunc::GetBundleMgr();
142     if (iBundleMgr == nullptr) {
143         APP_LOGE("iBundleMgr is null");
144         return ERROR_BUNDLE_SERVICE_EXCEPTION;
145     }
146     ErrCode ret = iBundleMgr->GetBundleArchiveInfoV9(hapFilePath, flags, bundleInfo);
147     APP_LOGD("GetBundleArchiveInfoV9 ErrCode : %{public}d", ret);
148     return CommonFunc::ConvertErrCode(ret);
149 }
150 
GetAbilityFromBundleInfo(const BundleInfo & bundleInfo,const std::string & abilityName,const std::string & moduleName,AbilityInfo & targetAbilityInfo)151 ErrCode BundleManagerHelper::GetAbilityFromBundleInfo(const BundleInfo& bundleInfo, const std::string& abilityName,
152     const std::string& moduleName, AbilityInfo& targetAbilityInfo)
153 {
154     bool ifExists = false;
155     for (const auto& hapModuleInfo : bundleInfo.hapModuleInfos) {
156         for (const auto& abilityInfo : hapModuleInfo.abilityInfos) {
157             if (abilityInfo.name == abilityName && abilityInfo.moduleName == moduleName) {
158                 if (!abilityInfo.enabled) {
159                     APP_LOGI("ability disabled");
160                     return ERR_BUNDLE_MANAGER_ABILITY_DISABLED;
161                 }
162                 ifExists = true;
163                 targetAbilityInfo = abilityInfo;
164                 break;
165             }
166         }
167         if (ifExists) {
168             break;
169         }
170     }
171     if (!ifExists) {
172         APP_LOGE("ability not exist");
173         return ERR_BUNDLE_MANAGER_ABILITY_NOT_EXIST;
174     }
175     return ERR_OK;
176 }
177 
GetExtensionFromBundleInfo(const BundleInfo & bundleInfo,const std::string & abilityName,const std::string & moduleName,ExtensionAbilityInfo & targetExtensionInfo)178 ErrCode BundleManagerHelper::GetExtensionFromBundleInfo(const BundleInfo& bundleInfo, const std::string& abilityName,
179     const std::string& moduleName, ExtensionAbilityInfo& targetExtensionInfo)
180 {
181     bool ifExists = false;
182     for (const auto& hapModuleInfo : bundleInfo.hapModuleInfos) {
183         for (const auto& extensionInfo : hapModuleInfo.extensionInfos) {
184             if (extensionInfo.name == abilityName && extensionInfo.moduleName == moduleName) {
185                 ifExists = true;
186                 targetExtensionInfo = extensionInfo;
187                 break;
188             }
189             if (!extensionInfo.enabled) {
190                 APP_LOGI("extension disabled");
191                 return ERR_BUNDLE_MANAGER_ABILITY_DISABLED;
192             }
193         }
194         if (ifExists) {
195             break;
196         }
197     }
198     if (!ifExists) {
199         APP_LOGE("ability not exist");
200         return ERR_BUNDLE_MANAGER_ABILITY_NOT_EXIST;
201     }
202     return ERR_OK;
203 }
204 
InnerGetPermissionDef(const std::string & permissionName,PermissionDef & permissionDef)205 ErrCode BundleManagerHelper::InnerGetPermissionDef(const std::string& permissionName, PermissionDef& permissionDef)
206 {
207     auto iBundleMgr = CommonFunc::GetBundleMgr();
208     if (iBundleMgr == nullptr) {
209         APP_LOGE("can not get iBundleMgr");
210         return ERROR_BUNDLE_SERVICE_EXCEPTION;
211     }
212     ErrCode ret = iBundleMgr->GetPermissionDef(permissionName, permissionDef);
213     APP_LOGD("GetPermissionDef ErrCode : %{public}d", ret);
214     return CommonFunc::ConvertErrCode(ret);
215 }
216 
InnerCleanBundleCacheCallback(const std::string & bundleName,int32_t appIndex,const OHOS::sptr<CleanCacheCallback> cleanCacheCallback)217 ErrCode BundleManagerHelper::InnerCleanBundleCacheCallback(
218     const std::string &bundleName, int32_t appIndex, const OHOS::sptr<CleanCacheCallback> cleanCacheCallback)
219 {
220     if (cleanCacheCallback == nullptr) {
221         APP_LOGE("callback nullptr");
222         return ERROR_BUNDLE_SERVICE_EXCEPTION;
223     }
224     auto iBundleMgr = CommonFunc::GetBundleMgr();
225     if (iBundleMgr == nullptr) {
226         APP_LOGE("can not get iBundleMgr");
227         return ERROR_BUNDLE_SERVICE_EXCEPTION;
228     }
229     int32_t userId = IPCSkeleton::GetCallingUid() / Constants::BASE_USER_RANGE;
230     ErrCode result = iBundleMgr->CleanBundleCacheFiles(bundleName, cleanCacheCallback, userId, appIndex);
231     if (result != ERR_OK) {
232         APP_LOGE("call error, bundleName is %{public}s, userId is %{public}d, appIndex is %{public}d",
233             bundleName.c_str(), userId, appIndex);
234     }
235     return CommonFunc::ConvertErrCode(result);
236 }
237 
InnerGetAppProvisionInfo(const std::string & bundleName,int32_t userId,AppProvisionInfo & appProvisionInfo)238 ErrCode BundleManagerHelper::InnerGetAppProvisionInfo(
239     const std::string& bundleName, int32_t userId, AppProvisionInfo& appProvisionInfo)
240 {
241     auto iBundleMgr = CommonFunc::GetBundleMgr();
242     if (iBundleMgr == nullptr) {
243         APP_LOGE("iBundleMgr is null");
244         return ERROR_BUNDLE_SERVICE_EXCEPTION;
245     }
246     ErrCode ret = iBundleMgr->GetAppProvisionInfo(bundleName, userId, appProvisionInfo);
247     APP_LOGD("GetAppProvisionInfo ErrCode : %{public}d", ret);
248     return CommonFunc::ConvertErrCode(ret);
249 }
250 
InnerGetAllPreinstalledApplicationInfos(std::vector<PreinstalledApplicationInfo> & preinstalledApplicationInfos)251 ErrCode BundleManagerHelper::InnerGetAllPreinstalledApplicationInfos(
252     std::vector<PreinstalledApplicationInfo>& preinstalledApplicationInfos)
253 {
254     auto iBundleMgr = CommonFunc::GetBundleMgr();
255     if (iBundleMgr == nullptr) {
256         APP_LOGE("IBundleMgr is null");
257         return ERROR_BUNDLE_SERVICE_EXCEPTION;
258     }
259     ErrCode ret = iBundleMgr->GetAllPreinstalledApplicationInfos(preinstalledApplicationInfos);
260     APP_LOGD("GetAllPreinstalledApplicationInfos ErrCode : %{public}d", ret);
261     return CommonFunc::ConvertErrCode(ret);
262 }
263 
InnerGetAllAppCloneBundleInfo(const std::string & bundleName,int32_t bundleFlags,int32_t userId,std::vector<BundleInfo> & bundleInfos)264 ErrCode BundleManagerHelper::InnerGetAllAppCloneBundleInfo(
265     const std::string& bundleName, int32_t bundleFlags, int32_t userId, std::vector<BundleInfo>& bundleInfos)
266 {
267     auto iBundleMgr = CommonFunc::GetBundleMgr();
268     if (iBundleMgr == nullptr) {
269         APP_LOGE("can not get iBundleMgr");
270         return ERROR_BUNDLE_SERVICE_EXCEPTION;
271     }
272     BundleInfo bundleInfoMain;
273     ErrCode ret = iBundleMgr->GetCloneBundleInfo(bundleName, bundleFlags, 0, bundleInfoMain, userId);
274     APP_LOGD("GetMainBundleInfo appIndex = 0, ret=%{public}d", ret);
275     if (ret == ERR_OK) {
276         bundleInfos.emplace_back(bundleInfoMain);
277     }
278     if (ret != ERR_OK && ret != ERR_BUNDLE_MANAGER_APPLICATION_DISABLED && ret != ERR_BUNDLE_MANAGER_BUNDLE_DISABLED) {
279         return CommonFunc::ConvertErrCode(ret);
280     }
281     // handle clone apps
282     std::vector<int32_t> appIndexes;
283     ErrCode getCloneIndexesRet = iBundleMgr->GetCloneAppIndexes(bundleName, appIndexes, userId);
284     if (getCloneIndexesRet != ERR_OK) {
285         if (ret == ERR_OK) {
286             return SUCCESS;
287         }
288         return CommonFunc::ConvertErrCode(ret);
289     }
290     for (int32_t appIndex : appIndexes) {
291         BundleInfo bundleInfo;
292         ret = iBundleMgr->GetCloneBundleInfo(bundleName, bundleFlags, appIndex, bundleInfo, userId);
293         if (ret == ERR_OK) {
294             bundleInfos.emplace_back(bundleInfo);
295         }
296     }
297     if (bundleInfos.empty()) {
298         return ERROR_BUNDLE_IS_DISABLED;
299     }
300     return SUCCESS;
301 }
302 
InnerGetAllSharedBundleInfo(std::vector<SharedBundleInfo> & sharedBundles)303 ErrCode BundleManagerHelper::InnerGetAllSharedBundleInfo(std::vector<SharedBundleInfo>& sharedBundles)
304 {
305     auto iBundleMgr = CommonFunc::GetBundleMgr();
306     if (iBundleMgr == nullptr) {
307         APP_LOGE("iBundleMgr is null");
308         return ERROR_BUNDLE_SERVICE_EXCEPTION;
309     }
310     ErrCode ret = iBundleMgr->GetAllSharedBundleInfo(sharedBundles);
311     APP_LOGD("GetAllSharedBundleInfo ErrCode : %{public}d", ret);
312     return CommonFunc::ConvertErrCode(ret);
313 }
314 
InnerGetSharedBundleInfo(const std::string & bundleName,const std::string & moduleName,std::vector<SharedBundleInfo> & sharedBundles)315 ErrCode BundleManagerHelper::InnerGetSharedBundleInfo(
316     const std::string& bundleName, const std::string& moduleName, std::vector<SharedBundleInfo>& sharedBundles)
317 {
318     auto iBundleMgr = CommonFunc::GetBundleMgr();
319     if (iBundleMgr == nullptr) {
320         APP_LOGE("iBundleMgr is null");
321         return ERROR_BUNDLE_SERVICE_EXCEPTION;
322     }
323     ErrCode ret = iBundleMgr->GetSharedBundleInfo(bundleName, moduleName, sharedBundles);
324     APP_LOGD("GetSharedBundleInfo ErrCode : %{public}d", ret);
325     return CommonFunc::ConvertErrCode(ret);
326 }
327 
InnerGetExtResource(const std::string & bundleName,std::vector<std::string> & moduleNames)328 ErrCode BundleManagerHelper::InnerGetExtResource(const std::string& bundleName, std::vector<std::string>& moduleNames)
329 {
330     auto extResourceManager = CommonFunc::GetExtendResourceManager();
331     if (extResourceManager == nullptr) {
332         APP_LOGE("extResourceManager is null");
333         return ERROR_BUNDLE_SERVICE_EXCEPTION;
334     }
335 
336     ErrCode ret = extResourceManager->GetExtResource(bundleName, moduleNames);
337     if (ret != ERR_OK) {
338         APP_LOGE("GetExtResource failed");
339     }
340     APP_LOGD("GetExtResource ErrCode : %{public}d", ret);
341     return CommonFunc::ConvertErrCode(ret);
342 }
343 
InnerDisableDynamicIcon(const std::string & bundleName,int32_t appIndex,int32_t userId,bool isDefault)344 ErrCode BundleManagerHelper::InnerDisableDynamicIcon(
345     const std::string& bundleName, int32_t appIndex, int32_t userId, bool isDefault)
346 {
347     auto extResourceManager = CommonFunc::GetExtendResourceManager();
348     if (extResourceManager == nullptr) {
349         APP_LOGE("extResourceManager is null");
350         return ERROR_BUNDLE_SERVICE_EXCEPTION;
351     }
352 
353     ErrCode ret = ERR_OK;
354     if (isDefault) {
355         ret = extResourceManager->DisableDynamicIcon(bundleName);
356     } else {
357         ret = extResourceManager->DisableDynamicIcon(bundleName, userId, appIndex);
358     }
359     if (ret != ERR_OK) {
360         APP_LOGE("DisableDynamicIcon failed %{public}d", ret);
361     }
362 
363     return CommonFunc::ConvertErrCode(ret);
364 }
365 
InnerGetDynamicIconInfo(const std::string & bundleName,std::vector<DynamicIconInfo> & dynamicIconInfos)366 ErrCode BundleManagerHelper::InnerGetDynamicIconInfo(
367     const std::string& bundleName, std::vector<DynamicIconInfo>& dynamicIconInfos)
368 {
369     auto extResourceManager = CommonFunc::GetExtendResourceManager();
370     if (extResourceManager == nullptr) {
371         APP_LOGE("extResourceManager is null");
372         return ERROR_BUNDLE_SERVICE_EXCEPTION;
373     }
374     ErrCode ret = extResourceManager->GetDynamicIconInfo(bundleName, dynamicIconInfos);
375     if (ret != ERR_OK) {
376         APP_LOGE_NOFUNC("-n %{public}s GetDynamicIcon failed %{public}d", bundleName.c_str(), ret);
377     }
378 
379     return CommonFunc::ConvertErrCode(ret);
380 }
381 
InnerGetAllDynamicIconInfo(const int32_t userId,std::vector<DynamicIconInfo> & dynamicIconInfos)382 ErrCode BundleManagerHelper::InnerGetAllDynamicIconInfo(
383     const int32_t userId, std::vector<DynamicIconInfo>& dynamicIconInfos)
384 {
385     auto extResourceManager = CommonFunc::GetExtendResourceManager();
386     if (extResourceManager == nullptr) {
387         APP_LOGE("extResourceManager is null");
388         return ERROR_BUNDLE_SERVICE_EXCEPTION;
389     }
390     ErrCode ret = extResourceManager->GetAllDynamicIconInfo(userId, dynamicIconInfos);
391     if (ret != ERR_OK) {
392         APP_LOGE_NOFUNC("GetDynamicIcon failed %{public}d", ret);
393     }
394 
395     return CommonFunc::ConvertErrCode(ret);
396 }
397 
InnerVerify(const std::vector<std::string> & abcPaths,bool flag)398 ErrCode BundleManagerHelper::InnerVerify(const std::vector<std::string>& abcPaths, bool flag)
399 {
400     ErrCode ret = VerifyManagerClient::GetInstance().Verify(abcPaths);
401     if (ret == ERR_OK && flag) {
402         VerifyManagerClient::GetInstance().RemoveFiles(abcPaths);
403     }
404     if (ret != ERR_OK) {
405         APP_LOGE("VerifyAbc %{public}d", ret);
406     }
407     return CommonFunc::ConvertErrCode(ret);
408 }
409 
InnerDeleteAbc(const std::string & path)410 ErrCode BundleManagerHelper::InnerDeleteAbc(const std::string& path)
411 {
412     ErrCode ret = VerifyManagerClient::GetInstance().DeleteAbc(path);
413     if (ret == ERR_APPEXECFWK_NULL_PTR) {
414         APP_LOGE("VerifyAbc failed due to iBundleMgr is null");
415         return ERROR_BUNDLE_SERVICE_EXCEPTION;
416     }
417     if (ret != ERR_OK) {
418         APP_LOGE("DeleteAbc %{public}d", ret);
419     }
420     return CommonFunc::ConvertErrCode(ret);
421 }
422 
InnerGetRecoverableApplicationInfo(std::vector<RecoverableApplicationInfo> & recoverableApplications)423 ErrCode BundleManagerHelper::InnerGetRecoverableApplicationInfo(
424     std::vector<RecoverableApplicationInfo>& recoverableApplications)
425 {
426     auto iBundleMgr = CommonFunc::GetBundleMgr();
427     if (iBundleMgr == nullptr) {
428         APP_LOGE("iBundleMgr is null");
429         return ERROR_BUNDLE_SERVICE_EXCEPTION;
430     }
431     ErrCode ret = iBundleMgr->GetRecoverableApplicationInfo(recoverableApplications);
432     APP_LOGD("GetRecoverableApplicationInfo ErrCode : %{public}d", ret);
433     return CommonFunc::ConvertErrCode(ret);
434 }
435 
InnerGetAllPluginInfo(std::string & hostBundleName,int32_t userId,std::vector<PluginBundleInfo> & pluginBundleInfos)436 ErrCode BundleManagerHelper::InnerGetAllPluginInfo(
437     std::string& hostBundleName, int32_t userId, std::vector<PluginBundleInfo>& pluginBundleInfos)
438 {
439     auto iBundleMgr = CommonFunc::GetBundleMgr();
440     if (iBundleMgr == nullptr) {
441         APP_LOGE("iBundleMgr is null");
442         return ERROR_BUNDLE_SERVICE_EXCEPTION;
443     }
444     ErrCode ret = iBundleMgr->GetAllPluginInfo(hostBundleName, userId, pluginBundleInfos);
445     APP_LOGD("GetAllPluginInfo ErrCode : %{public}d", ret);
446     return CommonFunc::ConvertErrCode(ret);
447 }
448 
InnerGetAbilityInfos(const std::string & uri,uint32_t flags,std::vector<AbilityInfo> & abilityInfos)449 ErrCode BundleManagerHelper::InnerGetAbilityInfos(
450     const std::string& uri, uint32_t flags, std::vector<AbilityInfo>& abilityInfos)
451 {
452     auto iBundleMgr = CommonFunc::GetBundleMgr();
453     if (iBundleMgr == nullptr) {
454         APP_LOGE("iBundleMgr is null");
455         return ERROR_BUNDLE_SERVICE_EXCEPTION;
456     }
457     ErrCode ret = iBundleMgr->GetAbilityInfos(uri, flags, abilityInfos);
458     APP_LOGD("GetAbilityInfos ErrCode : %{public}d", ret);
459     return CommonFunc::ConvertErrCode(ret);
460 }
461 } // AppExecFwk
462 } // OHOS