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_INTERFACE_H 17 #define FOUNDATION_APPEXECFWK_INTERFACES_INNERKITS_APPEXECFWK_CORE_INCLUDE_BUNDLEMGR_BUNDLE_MGR_INTERFACE_H 18 19 #include "ability_info.h" 20 #include "appexecfwk_errors.h" 21 #include "application_info.h" 22 #include "app_provision_info.h" 23 #include "bundle_constants.h" 24 #include "bundle_event_callback_interface.h" 25 #include "bundle_info.h" 26 #include "bundle_pack_info.h" 27 #include "bundle_installer_interface.h" 28 #include "bundle_status_callback_interface.h" 29 #include "bundle_user_mgr_interface.h" 30 #include "clean_cache_callback_interface.h" 31 #include "common_event_info.h" 32 #include "data_group_info.h" 33 #include "../app_control/app_control_interface.h" 34 #include "../bundle_resource/bundle_resource_interface.h" 35 #include "../default_app/default_app_interface.h" 36 #include "../overlay/overlay_manager_interface.h" 37 #include "../quick_fix/quick_fix_manager_interface.h" 38 #include "../verify/verify_manager_interface.h" 39 #include "distributed_bundle_info.h" 40 #include "form_info.h" 41 #include "hap_module_info.h" 42 #include "permission_define.h" 43 #include "recoverable_application_info.h" 44 #include "shared/base_shared_bundle_info.h" 45 #include "shared/shared_bundle_info.h" 46 #include "shortcut_info.h" 47 #include "want.h" 48 49 namespace OHOS { 50 namespace AppExecFwk { 51 enum class DumpFlag { 52 DUMP_BUNDLE_LIST = 1, // corresponse to option "-bundle-list" 53 DUMP_BUNDLE_INFO, // corresponse to option "-bundle [name]" 54 DUMP_SHORTCUT_INFO, // corresponse to option "-bundle [name] -shortcut-info" 55 }; 56 57 class IBundleMgr : public IRemoteBroker { 58 public: 59 DECLARE_INTERFACE_DESCRIPTOR(u"ohos.appexecfwk.BundleMgr"); 60 61 using Want = OHOS::AAFwk::Want; 62 /** 63 * @brief Obtains the ApplicationInfo based on a given bundle name. 64 * @param appName Indicates the application bundle name to be queried. 65 * @param flag Indicates the flag used to specify information contained 66 * in the ApplicationInfo object that will be returned. 67 * @param userId Indicates the user ID. 68 * @param appInfo Indicates the obtained ApplicationInfo object. 69 * @return Returns true if the application is successfully obtained; returns false otherwise. 70 */ GetApplicationInfo(const std::string & appName,const ApplicationFlag flag,const int userId,ApplicationInfo & appInfo)71 virtual bool GetApplicationInfo( 72 const std::string &appName, const ApplicationFlag flag, const int userId, ApplicationInfo &appInfo) 73 { 74 return false; 75 } 76 /** 77 * @brief Obtains the ApplicationInfo based on a given bundle name. 78 * @param appName Indicates the application bundle name to be queried. 79 * @param flags Indicates the flag used to specify information contained 80 * in the ApplicationInfo object that will be returned. 81 * @param userId Indicates the user ID. 82 * @param appInfo Indicates the obtained ApplicationInfo object. 83 * @return Returns true if the application is successfully obtained; returns false otherwise. 84 */ GetApplicationInfo(const std::string & appName,int32_t flags,int32_t userId,ApplicationInfo & appInfo)85 virtual bool GetApplicationInfo( 86 const std::string &appName, int32_t flags, int32_t userId, ApplicationInfo &appInfo) 87 { 88 return false; 89 } 90 /** 91 * @brief Obtains the ApplicationInfo based on a given bundle name. 92 * @param appName Indicates the application bundle name to be queried. 93 * @param flag Indicates the flag used to specify information contained 94 * in the ApplicationInfo object that will be returned. 95 * @param userId Indicates the user ID. 96 * @param appInfo Indicates the obtained ApplicationInfo object. 97 * @return Returns ERR_OK if the application is successfully obtained; returns error code otherwise. 98 */ GetApplicationInfoV9(const std::string & appName,int32_t flag,int32_t userId,ApplicationInfo & appInfo)99 virtual ErrCode GetApplicationInfoV9( 100 const std::string &appName, int32_t flag, int32_t userId, ApplicationInfo &appInfo) 101 { 102 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 103 } 104 /** 105 * @brief Obtains information about all installed applications of a specified user. 106 * @param flag Indicates the flag used to specify information contained 107 * in the ApplicationInfo objects that will be returned. 108 * @param userId Indicates the user ID. 109 * @param appInfos Indicates all of the obtained ApplicationInfo objects. 110 * @return Returns true if the application is successfully obtained; returns false otherwise. 111 */ GetApplicationInfos(const ApplicationFlag flag,int userId,std::vector<ApplicationInfo> & appInfos)112 virtual bool GetApplicationInfos( 113 const ApplicationFlag flag, int userId, std::vector<ApplicationInfo> &appInfos) 114 { 115 return false; 116 } 117 /** 118 * @brief Obtains information about all installed applications of a specified user. 119 * @param flags Indicates the flag used to specify information contained 120 * in the ApplicationInfo objects that will be returned. 121 * @param userId Indicates the user ID. 122 * @param appInfos Indicates all of the obtained ApplicationInfo objects. 123 * @return Returns true if the application is successfully obtained; returns false otherwise. 124 */ GetApplicationInfos(int32_t flags,int32_t userId,std::vector<ApplicationInfo> & appInfos)125 virtual bool GetApplicationInfos( 126 int32_t flags, int32_t userId, std::vector<ApplicationInfo> &appInfos) 127 { 128 return false; 129 } 130 /** 131 * @brief Obtains information about all installed applications of a specified user. 132 * @param flags Indicates the flag used to specify information contained 133 * in the ApplicationInfo objects that will be returned. 134 * @param userId Indicates the user ID. 135 * @param appInfos Indicates all of the obtained ApplicationInfo objects. 136 * @return Returns ERR_OK if the application is successfully obtained; returns error code otherwise. 137 */ GetApplicationInfosV9(int32_t flags,int32_t userId,std::vector<ApplicationInfo> & appInfos)138 virtual ErrCode GetApplicationInfosV9( 139 int32_t flags, int32_t userId, std::vector<ApplicationInfo> &appInfos) 140 { 141 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 142 } 143 /** 144 * @brief Obtains the BundleInfo based on a given bundle name. 145 * @param bundleName Indicates the application bundle name to be queried. 146 * @param flag Indicates the information contained in the BundleInfo object to be returned. 147 * @param bundleInfo Indicates the obtained BundleInfo object. 148 * @param userId Indicates the user ID. 149 * @return Returns true if the BundleInfo is successfully obtained; returns false otherwise. 150 */ 151 virtual bool GetBundleInfo(const std::string &bundleName, const BundleFlag flag, 152 BundleInfo &bundleInfo, int32_t userId = Constants::UNSPECIFIED_USERID) 153 { 154 return false; 155 } 156 /** 157 * @brief Obtains the BundleInfo based on a given bundle name. 158 * @param bundleName Indicates the application bundle name to be queried. 159 * @param flags Indicates the information contained in the BundleInfo object to be returned. 160 * @param bundleInfo Indicates the obtained BundleInfo object. 161 * @param userId Indicates the user ID. 162 * @return Returns true if the BundleInfo is successfully obtained; returns false otherwise. 163 */ 164 virtual bool GetBundleInfo(const std::string &bundleName, int32_t flags, 165 BundleInfo &bundleInfo, int32_t userId = Constants::UNSPECIFIED_USERID) 166 { 167 return false; 168 } 169 /** 170 * @brief Obtains the BundleInfo based on a given bundle name. 171 * @param bundleName Indicates the application bundle name to be queried. 172 * @param flags Indicates the information contained in the BundleInfo object to be returned. 173 * @param bundleInfo Indicates the obtained BundleInfo object. 174 * @param userId Indicates the user ID. 175 * @return Returns ERR_OK if the BundleInfo is successfully obtained; returns error code otherwise. 176 */ GetBundleInfoV9(const std::string & bundleName,int32_t flags,BundleInfo & bundleInfo,int32_t userId)177 virtual ErrCode GetBundleInfoV9(const std::string &bundleName, int32_t flags, 178 BundleInfo &bundleInfo, int32_t userId) 179 { 180 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 181 } 182 /** 183 * @brief Obtains the BundleInfo for the calling app. 184 * @param bundleName Indicates the application bundle name to be queried. 185 * @param flags Indicates the information contained in the BundleInfo object to be returned. 186 * @param bundleInfo Indicates the obtained BundleInfo object. 187 * @param userId Indicates the user ID. 188 * @return Returns ERR_OK if the BundleInfo is successfully obtained; returns error code otherwise. 189 */ GetBundleInfoForSelf(int32_t flags,BundleInfo & bundleInfo)190 virtual ErrCode GetBundleInfoForSelf(int32_t flags, BundleInfo &bundleInfo) 191 { 192 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 193 } 194 /** 195 * @brief Obtains the BundleInfo based on a given bundle name, which the calling app depends on. 196 * @param sharedBundleName Indicates the bundle name to be queried. 197 * @param sharedBundleInfo Indicates the obtained BundleInfo object. 198 * @param flag Indicates the flag, GetDependentBundleInfoFlag. 199 * @return Returns ERR_OK if the BundleInfo is successfully obtained; returns error code otherwise. 200 */ 201 virtual ErrCode GetDependentBundleInfo(const std::string &sharedBundleName, BundleInfo &sharedBundleInfo, 202 GetDependentBundleInfoFlag flag = GetDependentBundleInfoFlag::GET_APP_CROSS_HSP_BUNDLE_INFO) 203 { 204 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 205 } 206 /** 207 * @brief Obtains the BundlePackInfo based on a given bundle name. 208 * @param bundleName Indicates the application bundle name to be queried. 209 * @param flags Indicates the information contained in the BundleInfo object to be returned. 210 * @param BundlePackInfo Indicates the obtained BundlePackInfo object. 211 * @param userId Indicates the user ID. 212 * @return Returns ERR_OK if the BundlePackInfo is successfully obtained; returns other ErrCode otherwise. 213 */ 214 virtual ErrCode GetBundlePackInfo(const std::string &bundleName, const BundlePackFlag flag, 215 BundlePackInfo &bundlePackInfo, int32_t userId = Constants::UNSPECIFIED_USERID) 216 { 217 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 218 } 219 220 /** 221 * @brief Obtains the BundlePackInfo based on a given bundle name. 222 * @param bundleName Indicates the application bundle name to be queried. 223 * @param flags Indicates the information contained in the BundleInfo object to be returned. 224 * @param BundlePackInfo Indicates the obtained BundlePackInfo object. 225 * @param userId Indicates the user ID. 226 * @return Returns ERR_OK if the BundlePackInfo is successfully obtained; returns other ErrCode otherwise. 227 */ 228 virtual ErrCode GetBundlePackInfo(const std::string &bundleName, int32_t flags, 229 BundlePackInfo &bundlePackInfo, int32_t userId = Constants::UNSPECIFIED_USERID) 230 { 231 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 232 } 233 234 /** 235 * @brief Obtains BundleInfo of all bundles available in the system. 236 * @param flag Indicates the flag used to specify information contained in the BundleInfo that will be returned. 237 * @param bundleInfos Indicates all of the obtained BundleInfo objects. 238 * @param userId Indicates the user ID. 239 * @return Returns true if the BundleInfos is successfully obtained; returns false otherwise. 240 */ 241 virtual bool GetBundleInfos(const BundleFlag flag, 242 std::vector<BundleInfo> &bundleInfos, int32_t userId = Constants::UNSPECIFIED_USERID) 243 { 244 return false; 245 } 246 /** 247 * @brief Obtains BundleInfo of all bundles available in the system. 248 * @param flags Indicates the flag used to specify information contained in the BundleInfo that will be returned. 249 * @param bundleInfos Indicates all of the obtained BundleInfo objects. 250 * @param userId Indicates the user ID. 251 * @return Returns true if the BundleInfos is successfully obtained; returns false otherwise. 252 */ 253 virtual bool GetBundleInfos(int32_t flags, 254 std::vector<BundleInfo> &bundleInfos, int32_t userId = Constants::UNSPECIFIED_USERID) 255 { 256 return false; 257 } 258 /** 259 * @brief Obtains BundleInfo of all bundles available in the system. 260 * @param flags Indicates the flag used to specify information contained in the BundleInfo that will be returned. 261 * @param bundleInfos Indicates all of the obtained BundleInfo objects. 262 * @param userId Indicates the user ID. 263 * @return Returns ERR_OK if the BundleInfos is successfully obtained; returns error code otherwise. 264 */ GetBundleInfosV9(int32_t flags,std::vector<BundleInfo> & bundleInfos,int32_t userId)265 virtual ErrCode GetBundleInfosV9(int32_t flags, std::vector<BundleInfo> &bundleInfos, int32_t userId) 266 { 267 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 268 } 269 /** 270 * @brief Obtains the application UID based on the given bundle name and user ID. 271 * @param bundleName Indicates the bundle name of the application. 272 * @param userId Indicates the user ID. 273 * @return Returns the uid if successfully obtained; returns -1 otherwise. 274 */ GetUidByBundleName(const std::string & bundleName,const int userId)275 virtual int GetUidByBundleName(const std::string &bundleName, const int userId) 276 { 277 return Constants::INVALID_UID; 278 } 279 /** 280 * @brief Obtains the debug application UID based on the given bundle name and user ID. 281 * @param bundleName Indicates the bundle name of the application. 282 * @param userId Indicates the user ID. 283 * @return Returns the uid if successfully obtained; returns -1 otherwise. 284 */ GetUidByDebugBundleName(const std::string & bundleName,const int userId)285 virtual int GetUidByDebugBundleName(const std::string &bundleName, const int userId) 286 { 287 return Constants::INVALID_UID; 288 } 289 /** 290 * @brief Obtains the application ID based on the given bundle name and user ID. 291 * @param bundleName Indicates the bundle name of the application. 292 * @param userId Indicates the user ID. 293 * @return Returns the application ID if successfully obtained; returns empty string otherwise. 294 */ GetAppIdByBundleName(const std::string & bundleName,const int userId)295 virtual std::string GetAppIdByBundleName(const std::string &bundleName, const int userId) 296 { 297 return Constants::EMPTY_STRING; 298 } 299 /** 300 * @brief Obtains the bundle name of a specified application based on the given UID. 301 * @param uid Indicates the uid. 302 * @param bundleName Indicates the obtained bundle name. 303 * @return Returns true if the bundle name is successfully obtained; returns false otherwise. 304 */ GetBundleNameForUid(const int uid,std::string & bundleName)305 virtual bool GetBundleNameForUid(const int uid, std::string &bundleName) 306 { 307 return false; 308 } 309 /** 310 * @brief Obtains all bundle names of a specified application based on the given application UID. 311 * @param uid Indicates the uid. 312 * @param bundleNames Indicates the obtained bundle names. 313 * @return Returns true if the bundle names is successfully obtained; returns false otherwise. 314 */ GetBundlesForUid(const int uid,std::vector<std::string> & bundleNames)315 virtual bool GetBundlesForUid(const int uid, std::vector<std::string> &bundleNames) 316 { 317 return false; 318 } 319 /** 320 * @brief Obtains the formal name associated with the given UID. 321 * @param uid Indicates the uid. 322 * @param name Indicates the obtained formal name. 323 * @return Returns ERR_OK if execute success; returns errCode otherwise. 324 */ GetNameForUid(const int uid,std::string & name)325 virtual ErrCode GetNameForUid(const int uid, std::string &name) 326 { 327 return ERR_BUNDLE_MANAGER_INTERNAL_ERROR; 328 } 329 /** 330 * @brief Obtains an array of all group IDs associated with a specified bundle. 331 * @param bundleName Indicates the bundle name. 332 * @param gids Indicates the group IDs associated with the specified bundle. 333 * @return Returns true if the gids is successfully obtained; returns false otherwise. 334 */ GetBundleGids(const std::string & bundleName,std::vector<int> & gids)335 virtual bool GetBundleGids(const std::string &bundleName, std::vector<int> &gids) 336 { 337 return false; 338 } 339 /** 340 * @brief Obtains an array of all group IDs associated with the given bundle name and UID. 341 * @param bundleName Indicates the bundle name. 342 * @param uid Indicates the uid. 343 * @param gids Indicates the group IDs associated with the specified bundle. 344 * @return Returns true if the gids is successfully obtained; returns false otherwise. 345 */ GetBundleGidsByUid(const std::string & bundleName,const int & uid,std::vector<int> & gids)346 virtual bool GetBundleGidsByUid(const std::string &bundleName, const int &uid, std::vector<int> &gids) 347 { 348 return false; 349 } 350 /** 351 * @brief Obtains the type of a specified application based on the given bundle name. 352 * @param bundleName Indicates the bundle name. 353 * @return Returns "system" if the bundle is a system application; returns "third-party" otherwise. 354 */ GetAppType(const std::string & bundleName)355 virtual std::string GetAppType(const std::string &bundleName) 356 { 357 return Constants::EMPTY_STRING; 358 } 359 /** 360 * @brief Check whether the app is system app by it's UID. 361 * @param uid Indicates the uid. 362 * @return Returns true if the bundle is a system application; returns false otherwise. 363 */ CheckIsSystemAppByUid(const int uid)364 virtual bool CheckIsSystemAppByUid(const int uid) 365 { 366 return false; 367 } 368 /** 369 * @brief Obtains the BundleInfo of application bundles based on the specified metaData. 370 * @param metaData Indicates the metadata to get in the bundle. 371 * @param bundleInfos Indicates all of the obtained BundleInfo objects. 372 * @return Returns true if the BundleInfos is successfully obtained; returns false otherwise. 373 */ GetBundleInfosByMetaData(const std::string & metaData,std::vector<BundleInfo> & bundleInfos)374 virtual bool GetBundleInfosByMetaData(const std::string &metaData, std::vector<BundleInfo> &bundleInfos) 375 { 376 return false; 377 } 378 /** 379 * @brief Query the AbilityInfo by the given Want. 380 * @param want Indicates the information of the ability. 381 * @param abilityInfo Indicates the obtained AbilityInfo object. 382 * @return Returns true if the AbilityInfo is successfully obtained; returns false otherwise. 383 */ QueryAbilityInfo(const Want & want,AbilityInfo & abilityInfo)384 virtual bool QueryAbilityInfo(const Want &want, AbilityInfo &abilityInfo) 385 { 386 return false; 387 } 388 /** 389 * @brief Query the AbilityInfo by the given Want. 390 * @param want Indicates the information of the ability. 391 * @param flags Indicates the information contained in the AbilityInfo object to be returned. 392 * @param userId Indicates the user ID. 393 * @param abilityInfo Indicates the obtained AbilityInfo object. 394 * @param callBack Indicates the callback to be invoked for return ability manager service the operation result. 395 * @return Returns true if the AbilityInfo is successfully obtained; returns false otherwise. 396 */ QueryAbilityInfo(const Want & want,int32_t flags,int32_t userId,AbilityInfo & abilityInfo,const sptr<IRemoteObject> & callBack)397 virtual bool QueryAbilityInfo(const Want &want, int32_t flags, int32_t userId, AbilityInfo &abilityInfo, 398 const sptr<IRemoteObject> &callBack) 399 { 400 return false; 401 } 402 /** 403 * @brief Silent install by the given Want. 404 * @param want Indicates the information of the want. 405 * @param userId Indicates the user ID. 406 * @param callBack Indicates the callback to be invoked for return the operation result. 407 * @return Returns true if silent install successfully; returns false otherwise. 408 */ SilentInstall(const Want & want,int32_t userId,const sptr<IRemoteObject> & callBack)409 virtual bool SilentInstall(const Want &want, int32_t userId, const sptr<IRemoteObject> &callBack) 410 { 411 return false; 412 } 413 /** 414 * @brief Upgrade atomic service 415 * @param want Indicates the information of the ability. 416 * @param userId Indicates the user ID. 417 */ UpgradeAtomicService(const Want & want,int32_t userId)418 virtual void UpgradeAtomicService(const Want &want, int32_t userId) 419 { 420 return; 421 } 422 /** 423 * @brief Query the AbilityInfo by the given Want. 424 * @param want Indicates the information of the ability. 425 * @param flags Indicates the information contained in the AbilityInfo object to be returned. 426 * @param userId Indicates the user ID. 427 * @param abilityInfo Indicates the obtained AbilityInfo object. 428 * @return Returns true if the AbilityInfo is successfully obtained; returns false otherwise. 429 */ QueryAbilityInfo(const Want & want,int32_t flags,int32_t userId,AbilityInfo & abilityInfo)430 virtual bool QueryAbilityInfo(const Want &want, int32_t flags, int32_t userId, AbilityInfo &abilityInfo) 431 { 432 return false; 433 } 434 /** 435 * @brief Query the AbilityInfo of list by the given Want. 436 * @param want Indicates the information of the ability. 437 * @param abilityInfos Indicates the obtained AbilityInfos object. 438 * @return Returns true if the AbilityInfos is successfully obtained; returns false otherwise. 439 */ QueryAbilityInfos(const Want & want,std::vector<AbilityInfo> & abilityInfos)440 virtual bool QueryAbilityInfos(const Want &want, std::vector<AbilityInfo> &abilityInfos) 441 { 442 return false; 443 } 444 /** 445 * @brief Query the AbilityInfo of list by the given Want. 446 * @param want Indicates the information of the ability. 447 * @param flags Indicates the information contained in the AbilityInfo object to be returned. 448 * @param userId Indicates the user ID. 449 * @param abilityInfos Indicates the obtained AbilityInfos object. 450 * @return Returns true if the AbilityInfos is successfully obtained; returns false otherwise. 451 */ QueryAbilityInfos(const Want & want,int32_t flags,int32_t userId,std::vector<AbilityInfo> & abilityInfos)452 virtual bool QueryAbilityInfos( 453 const Want &want, int32_t flags, int32_t userId, std::vector<AbilityInfo> &abilityInfos) 454 { 455 return false; 456 } 457 /** 458 * @brief Query the AbilityInfo of list by the given Want. 459 * @param want Indicates the information of the ability. 460 * @param flags Indicates the information contained in the AbilityInfo object to be returned. 461 * @param userId Indicates the user ID. 462 * @param abilityInfos Indicates the obtained AbilityInfos object. 463 * @return Returns ERR_OK if the AbilityInfos is successfully obtained; returns errCode otherwise. 464 */ QueryAbilityInfosV9(const Want & want,int32_t flags,int32_t userId,std::vector<AbilityInfo> & abilityInfos)465 virtual ErrCode QueryAbilityInfosV9( 466 const Want &want, int32_t flags, int32_t userId, std::vector<AbilityInfo> &abilityInfos) 467 { 468 return ERR_BUNDLE_MANAGER_INTERNAL_ERROR; 469 } 470 QueryLauncherAbilityInfos(const Want & want,int32_t userId,std::vector<AbilityInfo> & abilityInfo)471 virtual ErrCode QueryLauncherAbilityInfos( 472 const Want &want, int32_t userId, std::vector<AbilityInfo> &abilityInfo) 473 { 474 return ERR_BUNDLE_MANAGER_INTERNAL_ERROR; 475 } 476 /** 477 * @brief Query the AllAbilityInfos of list by the given userId. 478 * @param userId Indicates the information of the user. 479 * @param abilityInfos Indicates the obtained AbilityInfos object. 480 * @return Returns true if the AbilityInfos is successfully obtained; returns false otherwise. 481 */ QueryAllAbilityInfos(const Want & want,int32_t userId,std::vector<AbilityInfo> & abilityInfos)482 virtual bool QueryAllAbilityInfos(const Want &want, int32_t userId, std::vector<AbilityInfo> &abilityInfos) 483 { 484 return false; 485 } 486 /** 487 * @brief Query the AbilityInfo by ability.uri in config.json. 488 * @param abilityUri Indicates the uri of the ability. 489 * @param abilityInfo Indicates the obtained AbilityInfo object. 490 * @return Returns true if the AbilityInfo is successfully obtained; returns false otherwise. 491 */ QueryAbilityInfoByUri(const std::string & abilityUri,AbilityInfo & abilityInfo)492 virtual bool QueryAbilityInfoByUri(const std::string &abilityUri, AbilityInfo &abilityInfo) 493 { 494 return false; 495 } 496 /** 497 * @brief Query the AbilityInfo by ability.uri in config.json. 498 * @param abilityUri Indicates the uri of the ability. 499 * @param userId Indicates the user ID. 500 * @param abilityInfo Indicates the obtained AbilityInfo object. 501 * @return Returns true if the AbilityInfo is successfully obtained; returns false otherwise. 502 */ QueryAbilityInfoByUri(const std::string & abilityUri,int32_t userId,AbilityInfo & abilityInfo)503 virtual bool QueryAbilityInfoByUri(const std::string &abilityUri, int32_t userId, AbilityInfo &abilityInfo) 504 { 505 return true; 506 }; 507 /** 508 * @brief Query the AbilityInfo by ability.uri in config.json. 509 * @param abilityUri Indicates the uri of the ability. 510 * @param abilityInfos Indicates the obtained AbilityInfos object. 511 * @return Returns true if the AbilityInfo is successfully obtained; returns false otherwise. 512 */ QueryAbilityInfosByUri(const std::string & abilityUri,std::vector<AbilityInfo> & abilityInfos)513 virtual bool QueryAbilityInfosByUri(const std::string &abilityUri, std::vector<AbilityInfo> &abilityInfos) 514 { 515 return false; 516 } 517 /** 518 * @brief Obtains the BundleInfo of all keep-alive applications in the system. 519 * @param bundleInfos Indicates all of the obtained BundleInfo objects. 520 * @return Returns true if the BundleInfos is successfully obtained; returns false otherwise. 521 */ QueryKeepAliveBundleInfos(std::vector<BundleInfo> & bundleInfos)522 virtual bool QueryKeepAliveBundleInfos(std::vector<BundleInfo> &bundleInfos) 523 { 524 return false; 525 } 526 /** 527 * @brief Obtains the label of a specified ability. 528 * @param bundleName Indicates the bundle name. 529 * @param abilityName Indicates the ability name. 530 * @return Returns the label of the ability if exist; returns empty string otherwise. 531 */ GetAbilityLabel(const std::string & bundleName,const std::string & abilityName)532 virtual std::string GetAbilityLabel(const std::string &bundleName, const std::string &abilityName) 533 { 534 return Constants::EMPTY_STRING; 535 } 536 /** 537 * @brief Obtains the label of a specified ability. 538 * @param bundleName Indicates the bundle name. 539 * @param moduleName Indicates the module name. 540 * @param abilityName Indicates the ability name. 541 * @param label Indicates the obtained label. 542 * @return Returns ERR_OK if called successfully; returns error code otherwise. 543 */ GetAbilityLabel(const std::string & bundleName,const std::string & moduleName,const std::string & abilityName,std::string & label)544 virtual ErrCode GetAbilityLabel(const std::string &bundleName, const std::string &moduleName, 545 const std::string &abilityName, std::string &label) 546 { 547 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 548 } 549 /** 550 * @brief Obtains information about an application bundle contained in an ohos Ability Package (HAP). 551 * @param hapFilePath Indicates the absolute file path of the HAP. 552 * @param flag Indicates the information contained in the BundleInfo object to be returned. 553 * @param bundleInfo Indicates the obtained BundleInfo object. 554 * @return Returns true if the BundleInfo is successfully obtained; returns false otherwise. 555 */ GetBundleArchiveInfo(const std::string & hapFilePath,const BundleFlag flag,BundleInfo & bundleInfo)556 virtual bool GetBundleArchiveInfo( 557 const std::string &hapFilePath, const BundleFlag flag, BundleInfo &bundleInfo) 558 { 559 return false; 560 } 561 /** 562 * @brief Obtains information about an application bundle contained in an ohos Ability Package (HAP). 563 * @param hapFilePath Indicates the absolute file path of the HAP. 564 * @param flags Indicates the information contained in the BundleInfo object to be returned. 565 * @param bundleInfo Indicates the obtained BundleInfo object. 566 * @return Returns true if the BundleInfo is successfully obtained; returns false otherwise. 567 */ GetBundleArchiveInfo(const std::string & hapFilePath,int32_t flags,BundleInfo & bundleInfo)568 virtual bool GetBundleArchiveInfo( 569 const std::string &hapFilePath, int32_t flags, BundleInfo &bundleInfo) 570 { 571 return false; 572 } 573 /** 574 * @brief Obtains information about an application bundle contained in an ohos Ability Package (HAP). 575 * @param hapFilePath Indicates the absolute file path of the HAP. 576 * @param flags Indicates the information contained in the BundleInfo object to be returned. 577 * @param bundleInfo Indicates the obtained BundleInfo object. 578 * @return Returns ERR_OK if this function is successfully called; returns errCode otherwise. 579 */ GetBundleArchiveInfoV9(const std::string & hapFilePath,int32_t flags,BundleInfo & bundleInfo)580 virtual ErrCode GetBundleArchiveInfoV9( 581 const std::string &hapFilePath, int32_t flags, BundleInfo &bundleInfo) 582 { 583 return ERR_BUNDLE_MANAGER_INTERNAL_ERROR; 584 } 585 /** 586 * @brief Obtain the HAP module info of a specific ability. 587 * @param abilityInfo Indicates the ability. 588 * @param hapModuleInfo Indicates the obtained HapModuleInfo object. 589 * @return Returns true if the HapModuleInfo is successfully obtained; returns false otherwise. 590 */ GetHapModuleInfo(const AbilityInfo & abilityInfo,HapModuleInfo & hapModuleInfo)591 virtual bool GetHapModuleInfo(const AbilityInfo &abilityInfo, HapModuleInfo &hapModuleInfo) 592 { 593 return false; 594 } 595 /** 596 * @brief Obtain the HAP module info of a specific ability. 597 * @param abilityInfo Indicates the ability. 598 * @param userId Indicates the userId. 599 * @param hapModuleInfo Indicates the obtained HapModuleInfo object. 600 * @return Returns true if the HapModuleInfo is successfully obtained; returns false otherwise. 601 */ GetHapModuleInfo(const AbilityInfo & abilityInfo,int32_t userId,HapModuleInfo & hapModuleInfo)602 virtual bool GetHapModuleInfo(const AbilityInfo &abilityInfo, int32_t userId, HapModuleInfo &hapModuleInfo) 603 { 604 return false; 605 } 606 /** 607 * @brief Obtains the Want for starting the main ability of an application based on the given bundle name. 608 * @param bundleName Indicates the bundle name. 609 * @param want Indicates the obtained launch Want object. 610 * @param userId Indicates the userId. 611 * @return Returns ERR_OK if this function is successfully called; returns errCode otherwise. 612 */ 613 virtual ErrCode GetLaunchWantForBundle( 614 const std::string &bundleName, Want &want, int32_t userId = Constants::UNSPECIFIED_USERID) 615 { 616 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 617 } 618 /** 619 * @brief Obtains detailed information about a specified permission. 620 * @param permissionName Indicates the name of the ohos permission. 621 * @param permissionDef Indicates the object containing detailed information about the given ohos permission. 622 * @return Returns ERR_OK if the PermissionDef object is successfully obtained; returns other ErrCode otherwise. 623 */ GetPermissionDef(const std::string & permissionName,PermissionDef & permissionDef)624 virtual ErrCode GetPermissionDef(const std::string &permissionName, PermissionDef &permissionDef) 625 { 626 return ERR_OK; 627 } 628 /** 629 * @brief Clears cache data of a specified application. 630 * @param bundleName Indicates the bundle name of the application whose cache data is to be cleared. 631 * @param cleanCacheCallback Indicates the callback to be invoked for returning the operation result. 632 * @param userId description the user id. 633 * @return Returns ERR_OK if this function is successfully called; returns other ErrCode otherwise. 634 */ 635 virtual ErrCode CleanBundleCacheFiles( 636 const std::string &bundleName, const sptr<ICleanCacheCallback> cleanCacheCallback, 637 int32_t userId = Constants::UNSPECIFIED_USERID) 638 { 639 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 640 } 641 /** 642 * @brief Clears application running data of a specified application. 643 * @param bundleName Indicates the bundle name of the application whose data is to be cleared. 644 * @param userId Indicates the user id. 645 * @return Returns true if the data cleared successfully; returns false otherwise. 646 */ 647 virtual bool CleanBundleDataFiles(const std::string &bundleName, const int userId = 0) 648 { 649 return false; 650 } 651 /** 652 * @brief Register the specific bundle status callback. 653 * @param bundleStatusCallback Indicates the callback to be invoked for returning the bundle status changed result. 654 * @return Returns true if this function is successfully called; returns false otherwise. 655 */ RegisterBundleStatusCallback(const sptr<IBundleStatusCallback> & bundleStatusCallback)656 virtual bool RegisterBundleStatusCallback(const sptr<IBundleStatusCallback> &bundleStatusCallback) 657 { 658 return false; 659 } 660 RegisterBundleEventCallback(const sptr<IBundleEventCallback> & bundleEventCallback)661 virtual bool RegisterBundleEventCallback(const sptr<IBundleEventCallback> &bundleEventCallback) 662 { 663 return false; 664 } 665 UnregisterBundleEventCallback(const sptr<IBundleEventCallback> & bundleEventCallback)666 virtual bool UnregisterBundleEventCallback(const sptr<IBundleEventCallback> &bundleEventCallback) 667 { 668 return false; 669 } 670 /** 671 * @brief Clear the specific bundle status callback. 672 * @param bundleStatusCallback Indicates the callback to be cleared. 673 * @return Returns true if this function is successfully called; returns false otherwise. 674 */ ClearBundleStatusCallback(const sptr<IBundleStatusCallback> & bundleStatusCallback)675 virtual bool ClearBundleStatusCallback(const sptr<IBundleStatusCallback> &bundleStatusCallback) 676 { 677 return false; 678 } 679 /** 680 * @brief Unregister all the callbacks of status changed. 681 * @return Returns true if this function is successfully called; returns false otherwise. 682 */ UnregisterBundleStatusCallback()683 virtual bool UnregisterBundleStatusCallback() 684 { 685 return false; 686 } 687 688 /** 689 * @brief Obtains the value of isRemovable based on a given bundle name and module name. 690 * @param bundleName Indicates the bundle name to be queried. 691 * @param moduleName Indicates the module name to be queried. 692 * @param isRemovable Indicates the module whether is removable. 693 * @return Returns ERR_OK if the isRemovable is successfully obtained; returns other ErrCode otherwise. 694 */ IsModuleRemovable(const std::string & bundleName,const std::string & moduleName,bool & isRemovable)695 virtual ErrCode IsModuleRemovable(const std::string &bundleName, const std::string &moduleName, bool &isRemovable) 696 { 697 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 698 } 699 /** 700 * @brief Sets whether to enable isRemovable based on a given bundle name and module name. 701 * @param bundleName Indicates the bundle name to be queried. 702 * @param moduleName Indicates the module name to be queried. 703 * @param isEnable Specifies whether to enable the isRemovable of InnerModuleInfo. 704 * The value true means to enable it, and the value false means to disable it 705 * @return Returns true if the isRemovable is successfully obtained; returns false otherwise. 706 */ SetModuleRemovable(const std::string & bundleName,const std::string & moduleName,bool isEnable)707 virtual bool SetModuleRemovable( 708 const std::string &bundleName, const std::string &moduleName, bool isEnable) 709 { 710 return false; 711 } 712 713 /** 714 * @brief Dump the bundle informations with specific flags. 715 * @param flag Indicates the information contained in the dump result. 716 * @param bundleName Indicates the bundle name if needed. 717 * @param userId Indicates the user ID. 718 * @param result Indicates the dump information result. 719 * @return Returns true if the dump result is successfully obtained; returns false otherwise. 720 */ DumpInfos(const DumpFlag flag,const std::string & bundleName,int32_t userId,std::string & result)721 virtual bool DumpInfos( 722 const DumpFlag flag, const std::string &bundleName, int32_t userId, std::string &result) 723 { 724 return false; 725 } 726 /** 727 * @brief Compile the bundle informations with specific flags. 728 * @param bundleName Indicates the bundle name if needed. 729 * @param compileMode Indicates the mode name. 730 * @param isAllBundle Does it represent all bundlenames. 731 * @return Returns true if the compile result is successfully obtained; returns false otherwise. 732 */ CompileProcessAOT(const std::string & bundleName,const std::string & compileMode,bool isAllBundle)733 virtual ErrCode CompileProcessAOT( 734 const std::string &bundleName, const std::string &compileMode, bool isAllBundle) 735 { 736 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 737 } 738 /** 739 * @brief Reset the bundle informations with specific flags. 740 * @param bundleName Indicates the bundle name if needed. 741 * @param isAllBundle Does it represent all bundlenames. 742 * @return Returns true if the reset result is successfully obtained; returns false otherwise. 743 */ CompileReset(const std::string & bundleName,bool isAllBundle)744 virtual ErrCode CompileReset(const std::string &bundleName, bool isAllBundle) 745 { 746 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 747 } 748 /** 749 * @brief Checks whether a specified application is enabled. 750 * @param bundleName Indicates the bundle name of the application. 751 * @param isEnable Indicates the application status is enabled. 752 * @return Returns result of the operation. 753 */ IsApplicationEnabled(const std::string & bundleName,bool & isEnable)754 virtual ErrCode IsApplicationEnabled(const std::string &bundleName, bool &isEnable) 755 { 756 return ERR_OK; 757 } 758 /** 759 * @brief Sets whether to enable a specified application. 760 * @param bundleName Indicates the bundle name of the application. 761 * @param isEnable Specifies whether to enable the application. 762 * The value true means to enable it, and the value false means to disable it. 763 * @param userId description the user id. 764 * @return Returns result of the operation. 765 */ 766 virtual ErrCode SetApplicationEnabled(const std::string &bundleName, bool isEnable, 767 int32_t userId = Constants::UNSPECIFIED_USERID) 768 { 769 return ERR_OK; 770 } 771 /** 772 * @brief Sets whether to enable a specified ability. 773 * @param abilityInfo Indicates information about the ability to check. 774 * @param isEnable Indicates the ability status is enabled. 775 * @return Returns result of the operation. 776 */ IsAbilityEnabled(const AbilityInfo & abilityInfo,bool & isEnable)777 virtual ErrCode IsAbilityEnabled(const AbilityInfo &abilityInfo, bool &isEnable) 778 { 779 return ERR_OK; 780 } 781 /** 782 * @brief Sets whether to enable a specified ability. 783 * @param abilityInfo Indicates information about the ability. 784 * @param isEnabled Specifies whether to enable the ability. 785 * The value true means to enable it, and the value false means to disable it. 786 * @param userId description the user id. 787 * @return Returns result of the operation. 788 */ 789 virtual ErrCode SetAbilityEnabled(const AbilityInfo &abilityInfo, bool isEnabled, 790 int32_t userId = Constants::UNSPECIFIED_USERID) 791 { 792 return ERR_OK; 793 } 794 /** 795 * @brief Obtains the FormInfo objects provided by all applications on the device. 796 * @param formInfo list of FormInfo objects if obtained; returns an empty List if no FormInfo is available on the 797 * device. 798 * @return Returns true if this function is successfully called; returns false otherwise. 799 */ GetAllFormsInfo(std::vector<FormInfo> & formInfos)800 virtual bool GetAllFormsInfo(std::vector<FormInfo> &formInfos) 801 { 802 return false; 803 } 804 /** 805 * @brief Obtains the FormInfo objects provided by a specified application on the device. 806 * @param bundleName Indicates the bundle name of the application. 807 * @param formInfo list of FormInfo objects if obtained; returns an empty List if no FormInfo is available on the 808 * device. 809 * @return Returns true if this function is successfully called; returns false otherwise. 810 */ GetFormsInfoByApp(const std::string & bundleName,std::vector<FormInfo> & formInfos)811 virtual bool GetFormsInfoByApp(const std::string &bundleName, std::vector<FormInfo> &formInfos) 812 { 813 return false; 814 } 815 /** 816 * @brief Obtains the FormInfo objects provided by a specified. 817 * @param formInfo list of FormInfo objects if obtained; returns an empty List if no FormInfo is available on the 818 * device. 819 * @param moduleName Indicates the module name of the application. 820 * @param bundleName Indicates the bundle name of the application. 821 * @return Returns true if this function is successfully called; returns false otherwise. 822 */ GetFormsInfoByModule(const std::string & bundleName,const std::string & moduleName,std::vector<FormInfo> & formInfos)823 virtual bool GetFormsInfoByModule( 824 const std::string &bundleName, const std::string &moduleName, std::vector<FormInfo> &formInfos) 825 { 826 return false; 827 } 828 /** 829 * @brief Obtains the ShortcutInfo objects provided by a specified application on the device. 830 * @param bundleName Indicates the bundle name of the application. 831 * @param shortcutInfos List of ShortcutInfo objects if obtained. 832 * @return Returns true if this function is successfully called; returns false otherwise. 833 */ GetShortcutInfos(const std::string & bundleName,std::vector<ShortcutInfo> & shortcutInfos)834 virtual bool GetShortcutInfos(const std::string &bundleName, std::vector<ShortcutInfo> &shortcutInfos) 835 { 836 return false; 837 } 838 GetShortcutInfoV9(const std::string & bundleName,std::vector<ShortcutInfo> & shortcutInfos)839 virtual ErrCode GetShortcutInfoV9(const std::string &bundleName, std::vector<ShortcutInfo> &shortcutInfos) 840 { 841 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 842 } 843 /** 844 * @brief Obtains the CommonEventInfo objects provided by an event key on the device. 845 * @param eventKey Indicates the event of the subscribe. 846 * @param commonEventInfos List of CommonEventInfo objects if obtained. 847 * @return Returns true if this function is successfully called; returns false otherwise. 848 */ GetAllCommonEventInfo(const std::string & eventKey,std::vector<CommonEventInfo> & commonEventInfos)849 virtual bool GetAllCommonEventInfo(const std::string &eventKey, std::vector<CommonEventInfo> &commonEventInfos) 850 { 851 return false; 852 } 853 /** 854 * @brief Obtains the interface used to install and uninstall bundles. 855 * @return Returns a pointer to IBundleInstaller class if exist; returns nullptr otherwise. 856 */ GetBundleInstaller()857 virtual sptr<IBundleInstaller> GetBundleInstaller() 858 { 859 return nullptr; 860 } 861 /** 862 * @brief Obtains the interface used to create or delete user. 863 * @return Returns a pointer to IBundleUserMgr class if exist; returns nullptr otherwise. 864 */ GetBundleUserMgr()865 virtual sptr<IBundleUserMgr> GetBundleUserMgr() 866 { 867 return nullptr; 868 } 869 /** 870 * @brief Obtains the VerifyManager. 871 * @return Returns a pointer to VerifyManager class if exist; returns nullptr otherwise. 872 */ GetVerifyManager()873 virtual sptr<IVerifyManager> GetVerifyManager() 874 { 875 return nullptr; 876 } 877 /** 878 * @brief Obtains the DistributedBundleInfo based on a given bundle name and networkId. 879 * @param networkId Indicates the networkId of remote device. 880 * @param bundleName Indicates the application bundle name to be queried. 881 * @param distributedBundleInfo Indicates the obtained DistributedBundleInfo object. 882 * @return Returns true if the DistributedBundleInfo is successfully obtained; returns false otherwise. 883 */ GetDistributedBundleInfo(const std::string & networkId,const std::string & bundleName,DistributedBundleInfo & distributedBundleInfo)884 virtual bool GetDistributedBundleInfo(const std::string &networkId, const std::string &bundleName, 885 DistributedBundleInfo &distributedBundleInfo) 886 { 887 return false; 888 } 889 /** 890 * @brief Get app privilege level. 891 * @param bundleName Indicates the bundle name of the app privilege level. 892 * @param userId Indicates the user id. 893 * @return Returns app privilege level. 894 */ 895 virtual std::string GetAppPrivilegeLevel( 896 const std::string &bundleName, int32_t userId = Constants::UNSPECIFIED_USERID) 897 { 898 return Constants::EMPTY_STRING; 899 } 900 /** 901 * @brief Query extension info. 902 * @param Want Indicates the information of extension info. 903 * @param flag Indicates the query flag which will fliter any specified stuff in the extension info. 904 * @param userId Indicates the userId in the system. 905 * @param extensionInfos Indicates the obtained extensions. 906 * @return Returns true if this function is successfully called; returns false otherwise. 907 */ QueryExtensionAbilityInfos(const Want & want,const int32_t & flag,const int32_t & userId,std::vector<ExtensionAbilityInfo> & extensionInfos)908 virtual bool QueryExtensionAbilityInfos(const Want &want, const int32_t &flag, const int32_t &userId, 909 std::vector<ExtensionAbilityInfo> &extensionInfos) 910 { 911 return true; 912 } 913 /** 914 * @brief Query extension info. 915 * @param Want Indicates the information of extension info. 916 * @param flags Indicates the query flag which will filter any specified stuff in the extension info. 917 * @param userId Indicates the userId in the system. 918 * @param extensionInfos Indicates the obtained extensions. 919 * @return Returns ERR_OK if this function is successfully called; returns errCode otherwise. 920 */ QueryExtensionAbilityInfosV9(const Want & want,int32_t flags,int32_t userId,std::vector<ExtensionAbilityInfo> & extensionInfos)921 virtual ErrCode QueryExtensionAbilityInfosV9(const Want &want, int32_t flags, int32_t userId, 922 std::vector<ExtensionAbilityInfo> &extensionInfos) 923 { 924 return ERR_BUNDLE_MANAGER_INTERNAL_ERROR; 925 } 926 /** 927 * @brief Query extension info. 928 * @param Want Indicates the information of extension info. 929 * @param extensionType Indicates the type of the extension. 930 * @param flag Indicates the query flag which will fliter any specified stuff in the extension info. 931 * @param userId Indicates the userId in the system. 932 * @param extensionInfos Indicates the obtained extensions. 933 * @return Returns true if this function is successfully called; returns false otherwise. 934 */ QueryExtensionAbilityInfos(const Want & want,const ExtensionAbilityType & extensionType,const int32_t & flag,const int32_t & userId,std::vector<ExtensionAbilityInfo> & extensionInfos)935 virtual bool QueryExtensionAbilityInfos(const Want &want, const ExtensionAbilityType &extensionType, 936 const int32_t &flag, const int32_t &userId, std::vector<ExtensionAbilityInfo> &extensionInfos) 937 { 938 return true; 939 } 940 /** 941 * @brief Query extension info. 942 * @param Want Indicates the information of extension info. 943 * @param extensionType Indicates the type of the extension. 944 * @param flags Indicates the query flag which will filter any specified stuff in the extension info. 945 * @param userId Indicates the userId in the system. 946 * @param extensionInfos Indicates the obtained extensions. 947 * @return Returns ERR_OK if this function is successfully called; returns errCode otherwise. 948 */ QueryExtensionAbilityInfosV9(const Want & want,const ExtensionAbilityType & extensionType,int32_t flags,int32_t userId,std::vector<ExtensionAbilityInfo> & extensionInfos)949 virtual ErrCode QueryExtensionAbilityInfosV9(const Want &want, const ExtensionAbilityType &extensionType, 950 int32_t flags, int32_t userId, std::vector<ExtensionAbilityInfo> &extensionInfos) 951 { 952 return ERR_BUNDLE_MANAGER_INTERNAL_ERROR; 953 } QueryExtensionAbilityInfos(const ExtensionAbilityType & extensionType,const int32_t & userId,std::vector<ExtensionAbilityInfo> & extensionInfos)954 virtual bool QueryExtensionAbilityInfos(const ExtensionAbilityType &extensionType, const int32_t &userId, 955 std::vector<ExtensionAbilityInfo> &extensionInfos) 956 { 957 return true; 958 } 959 VerifyCallingPermission(const std::string & permission)960 virtual bool VerifyCallingPermission(const std::string &permission) 961 { 962 return true; 963 } 964 965 /** 966 * @brief Verify whether the calling app is system app. Only for BMS usage. 967 * 968 * @param beginApiVersion Indicates version since this api became to be system api. 969 * @param bundleName Indicates bundle name of the calling hap. 970 * @return Returns true if the hap passes the verification; returns false otherwise. 971 */ 972 virtual bool VerifySystemApi(int32_t beginApiVersion = Constants::INVALID_API_VERSION) 973 { 974 return true; 975 } 976 977 /** 978 * @brief Obtains the dependent module names. 979 * 980 * @param bundleName Indicates the bundle name to be queried. 981 * @param moduleName Indicates the module name to be queried. 982 * @param dependentModuleNames Indicates the obtained dependent module names. 983 * @return Returns true if this function is successfully called; returns false otherwise. 984 */ GetAllDependentModuleNames(const std::string & bundleName,const std::string & moduleName,std::vector<std::string> & dependentModuleNames)985 virtual bool GetAllDependentModuleNames(const std::string &bundleName, const std::string &moduleName, 986 std::vector<std::string> &dependentModuleNames) 987 { 988 return false; 989 } 990 QueryExtensionAbilityInfoByUri(const std::string & uri,int32_t userId,ExtensionAbilityInfo & extensionAbilityInfo)991 virtual bool QueryExtensionAbilityInfoByUri(const std::string &uri, int32_t userId, 992 ExtensionAbilityInfo &extensionAbilityInfo) 993 { 994 return false; 995 } 996 ImplicitQueryInfoByPriority(const Want & want,int32_t flags,int32_t userId,AbilityInfo & abilityInfo,ExtensionAbilityInfo & extensionInfo)997 virtual bool ImplicitQueryInfoByPriority(const Want &want, int32_t flags, int32_t userId, 998 AbilityInfo &abilityInfo, ExtensionAbilityInfo &extensionInfo) 999 { 1000 return false; 1001 } 1002 ImplicitQueryInfos(const Want & want,int32_t flags,int32_t userId,bool withDefault,std::vector<AbilityInfo> & abilityInfos,std::vector<ExtensionAbilityInfo> & extensionInfos)1003 virtual bool ImplicitQueryInfos(const Want &want, int32_t flags, int32_t userId, bool withDefault, 1004 std::vector<AbilityInfo> &abilityInfos, std::vector<ExtensionAbilityInfo> &extensionInfos) 1005 { 1006 return false; 1007 } 1008 1009 /** 1010 * @brief Obtains the AbilityInfo based on a given bundle name. 1011 * @param bundleName Indicates the bundle name to be queried. 1012 * @param abilityName Indicates the ability name to be queried. 1013 * @param abilityInfo Indicates the obtained AbilityInfo object. 1014 * @return Returns true if the abilityInfo is successfully obtained; returns false otherwise. 1015 */ GetAbilityInfo(const std::string & bundleName,const std::string & abilityName,AbilityInfo & abilityInfo)1016 virtual bool GetAbilityInfo( 1017 const std::string &bundleName, const std::string &abilityName, AbilityInfo &abilityInfo) 1018 { 1019 return false; 1020 } 1021 /** 1022 * @brief Obtains the AbilityInfo based on a given bundle name. 1023 * @param bundleName Indicates the bundle name to be queried. 1024 * @param moduleName Indicates the module name to be queried. 1025 * @param abilityName Indicates the ability name to be queried. 1026 * @param abilityInfo Indicates the obtained AbilityInfo object. 1027 * @return Returns true if the abilityInfo is successfully obtained; returns false otherwise. 1028 */ GetAbilityInfo(const std::string & bundleName,const std::string & moduleName,const std::string & abilityName,AbilityInfo & abilityInfo)1029 virtual bool GetAbilityInfo( 1030 const std::string &bundleName, const std::string &moduleName, 1031 const std::string &abilityName, AbilityInfo &abilityInfo) 1032 { 1033 return false; 1034 } 1035 /** 1036 * @brief Obtain sandbox application bundleInfo. 1037 * @param bundleName Indicates the bundle name of the sandbox application to be install. 1038 * @param appIndex Indicates application index of the sandbox application. 1039 * @param userId Indicates the sandbox application is installed under which user id. 1040 * @return Returns ERR_OK if the get sandbox application budnelInfo successfully; returns errcode otherwise. 1041 */ GetSandboxBundleInfo(const std::string & bundleName,int32_t appIndex,int32_t userId,BundleInfo & info)1042 virtual ErrCode GetSandboxBundleInfo( 1043 const std::string &bundleName, int32_t appIndex, int32_t userId, BundleInfo &info) 1044 { 1045 return ERR_APPEXECFWK_SANDBOX_INSTALL_INTERNAL_ERROR; 1046 } 1047 1048 /** 1049 * @brief Obtains the value of upgradeFlag based on a given bundle name and module name. 1050 * @param bundleName Indicates the bundle name to be queried. 1051 * @param moduleName Indicates the module name to be queried. 1052 * @return Returns true if the isRemovable is successfully obtained; returns false otherwise. 1053 */ GetModuleUpgradeFlag(const std::string & bundleName,const std::string & moduleName)1054 virtual bool GetModuleUpgradeFlag(const std::string &bundleName, const std::string &moduleName) 1055 { 1056 return false; 1057 } 1058 /** 1059 * @brief Sets whether to enable upgradeFlag based on a given bundle name and module name. 1060 * @param bundleName Indicates the bundle name to be queried. 1061 * @param moduleName Indicates the module name to be queried. 1062 * @param isEnable Specifies whether to enable the isRemovable of InnerModuleInfo. 1063 * The value true means to enable it, and the value false means to disable it 1064 * @return Returns ERR_OK if the isRemovable is successfully obtained; returns ErrCode otherwise. 1065 */ SetModuleUpgradeFlag(const std::string & bundleName,const std::string & moduleName,int32_t upgradeFlag)1066 virtual ErrCode SetModuleUpgradeFlag( 1067 const std::string &bundleName, const std::string &moduleName, int32_t upgradeFlag) 1068 { 1069 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 1070 } 1071 CheckAbilityEnableInstall(const Want & want,int32_t missionId,int32_t userId,const sptr<IRemoteObject> & callback)1072 virtual bool CheckAbilityEnableInstall( 1073 const Want &want, int32_t missionId, int32_t userId, const sptr<IRemoteObject> &callback) 1074 { 1075 return false; 1076 } 1077 ObtainCallingBundleName(std::string & bundleName)1078 virtual bool ObtainCallingBundleName(std::string &bundleName) 1079 { 1080 return false; 1081 } 1082 GetDefaultAppProxy()1083 virtual sptr<IDefaultApp> GetDefaultAppProxy() 1084 { 1085 return nullptr; 1086 } 1087 GetAppControlProxy()1088 virtual sptr<IAppControlMgr> GetAppControlProxy() 1089 { 1090 return nullptr; 1091 } 1092 GetBundleStats(const std::string & bundleName,int32_t userId,std::vector<int64_t> & bundleStats)1093 virtual bool GetBundleStats(const std::string &bundleName, int32_t userId, std::vector<int64_t> &bundleStats) 1094 { 1095 return false; 1096 } 1097 GetAllBundleStats(int32_t userId,std::vector<int64_t> & bundleStats)1098 virtual bool GetAllBundleStats(int32_t userId, std::vector<int64_t> &bundleStats) 1099 { 1100 return false; 1101 } 1102 GetSandboxAbilityInfo(const Want & want,int32_t appIndex,int32_t flags,int32_t userId,AbilityInfo & info)1103 virtual ErrCode GetSandboxAbilityInfo(const Want &want, int32_t appIndex, int32_t flags, int32_t userId, 1104 AbilityInfo &info) 1105 { 1106 return ERR_APPEXECFWK_SANDBOX_QUERY_PARAM_ERROR; 1107 } 1108 GetSandboxExtAbilityInfos(const Want & want,int32_t appIndex,int32_t flags,int32_t userId,std::vector<ExtensionAbilityInfo> & einfos)1109 virtual ErrCode GetSandboxExtAbilityInfos(const Want &want, int32_t appIndex, int32_t flags, int32_t userId, 1110 std::vector<ExtensionAbilityInfo> &einfos) 1111 { 1112 return ERR_APPEXECFWK_SANDBOX_QUERY_PARAM_ERROR; 1113 } 1114 GetSandboxHapModuleInfo(const AbilityInfo & abilityInfo,int32_t appIndex,int32_t userId,HapModuleInfo & info)1115 virtual ErrCode GetSandboxHapModuleInfo(const AbilityInfo &abilityInfo, int32_t appIndex, int32_t userId, 1116 HapModuleInfo &info) 1117 { 1118 return ERR_APPEXECFWK_SANDBOX_QUERY_PARAM_ERROR; 1119 } 1120 1121 virtual ErrCode GetMediaData(const std::string &bundleName, const std::string &moduleName, 1122 const std::string &abilityName, std::unique_ptr<uint8_t[]> &mediaDataPtr, size_t &len, 1123 int32_t userId = Constants::UNSPECIFIED_USERID) 1124 { 1125 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 1126 } 1127 GetQuickFixManagerProxy()1128 virtual sptr<IQuickFixManager> GetQuickFixManagerProxy() 1129 { 1130 return nullptr; 1131 } 1132 1133 virtual std::string GetStringById(const std::string &bundleName, const std::string &moduleName, uint32_t resId, 1134 int32_t userId, const std::string &localeInfo = Constants::EMPTY_STRING) 1135 { 1136 return Constants::EMPTY_STRING; 1137 } 1138 GetIconById(const std::string & bundleName,const std::string & moduleName,uint32_t resId,uint32_t density,int32_t userId)1139 virtual std::string GetIconById( 1140 const std::string &bundleName, const std::string &moduleName, uint32_t resId, uint32_t density, int32_t userId) 1141 { 1142 return Constants::EMPTY_STRING; 1143 } 1144 SetDebugMode(bool isDebug)1145 virtual ErrCode SetDebugMode(bool isDebug) 1146 { 1147 return ERR_BUNDLEMANAGER_SET_DEBUG_MODE_INTERNAL_ERROR; 1148 } 1149 GetOverlayManagerProxy()1150 virtual sptr<IOverlayManager> GetOverlayManagerProxy() 1151 { 1152 return nullptr; 1153 } 1154 ProcessPreload(const Want & want)1155 virtual bool ProcessPreload(const Want &want) 1156 { 1157 return false; 1158 } 1159 GetAppProvisionInfo(const std::string & bundleName,int32_t userId,AppProvisionInfo & appProvisionInfo)1160 virtual ErrCode GetAppProvisionInfo(const std::string &bundleName, int32_t userId, 1161 AppProvisionInfo &appProvisionInfo) 1162 { 1163 return ERR_OK; 1164 } 1165 GetProvisionMetadata(const std::string & bundleName,int32_t userId,std::vector<Metadata> & provisionMetadatas)1166 virtual ErrCode GetProvisionMetadata(const std::string &bundleName, int32_t userId, 1167 std::vector<Metadata> &provisionMetadatas) 1168 { 1169 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 1170 } 1171 1172 virtual ErrCode GetBaseSharedBundleInfos(const std::string &bundleName, 1173 std::vector<BaseSharedBundleInfo> &baseSharedBundleInfos, 1174 GetDependentBundleInfoFlag flag = GetDependentBundleInfoFlag::GET_APP_CROSS_HSP_BUNDLE_INFO) 1175 { 1176 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 1177 } 1178 GetAllSharedBundleInfo(std::vector<SharedBundleInfo> & sharedBundles)1179 virtual ErrCode GetAllSharedBundleInfo(std::vector<SharedBundleInfo> &sharedBundles) 1180 { 1181 return ERR_OK; 1182 } 1183 GetSharedBundleInfo(const std::string & bundleName,const std::string & moduleName,std::vector<SharedBundleInfo> & sharedBundles)1184 virtual ErrCode GetSharedBundleInfo(const std::string &bundleName, const std::string &moduleName, 1185 std::vector<SharedBundleInfo> &sharedBundles) 1186 { 1187 return ERR_OK; 1188 } 1189 GetSharedBundleInfoBySelf(const std::string & bundleName,SharedBundleInfo & sharedBundleInfo)1190 virtual ErrCode GetSharedBundleInfoBySelf(const std::string &bundleName, SharedBundleInfo &sharedBundleInfo) 1191 { 1192 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 1193 } 1194 GetSharedDependencies(const std::string & bundleName,const std::string & moduleName,std::vector<Dependency> & dependencies)1195 virtual ErrCode GetSharedDependencies(const std::string &bundleName, const std::string &moduleName, 1196 std::vector<Dependency> &dependencies) 1197 { 1198 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 1199 } 1200 1201 virtual ErrCode GetAllProxyDataInfos( 1202 std::vector<ProxyData> &proxyDatas, int32_t userId = Constants::UNSPECIFIED_USERID) 1203 { 1204 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 1205 } 1206 1207 virtual ErrCode GetProxyDataInfos(const std::string &bundleName, const std::string &moduleName, 1208 std::vector<ProxyData> &proxyDatas, int32_t userId = Constants::UNSPECIFIED_USERID) 1209 { 1210 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 1211 } 1212 GetSpecifiedDistributionType(const std::string & bundleName,std::string & specifiedDistributionType)1213 virtual ErrCode GetSpecifiedDistributionType(const std::string &bundleName, std::string &specifiedDistributionType) 1214 { 1215 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 1216 } 1217 GetAdditionalInfo(const std::string & bundleName,std::string & additionalInfo)1218 virtual ErrCode GetAdditionalInfo(const std::string &bundleName, std::string &additionalInfo) 1219 { 1220 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 1221 } 1222 SetExtNameOrMIMEToApp(const std::string & bundleName,const std::string & moduleName,const std::string & abilityName,const std::string & extName,const std::string & mimeType)1223 virtual ErrCode SetExtNameOrMIMEToApp(const std::string &bundleName, const std::string &moduleName, 1224 const std::string &abilityName, const std::string &extName, const std::string &mimeType) 1225 { 1226 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 1227 } 1228 DelExtNameOrMIMEToApp(const std::string & bundleName,const std::string & moduleName,const std::string & abilityName,const std::string & extName,const std::string & mimeType)1229 virtual ErrCode DelExtNameOrMIMEToApp(const std::string &bundleName, const std::string &moduleName, 1230 const std::string &abilityName, const std::string &extName, const std::string &mimeType) 1231 { 1232 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 1233 } 1234 QueryDataGroupInfos(const std::string & bundleName,int32_t userId,std::vector<DataGroupInfo> & infos)1235 virtual bool QueryDataGroupInfos(const std::string &bundleName, int32_t userId, std::vector<DataGroupInfo> &infos) 1236 { 1237 return false; 1238 } 1239 GetGroupDir(const std::string & dataGroupId,std::string & dir)1240 virtual bool GetGroupDir(const std::string &dataGroupId, std::string &dir) 1241 { 1242 return false; 1243 } 1244 QueryAppGalleryBundleName(std::string & bundleName)1245 virtual bool QueryAppGalleryBundleName(std::string &bundleName) 1246 { 1247 return false; 1248 } 1249 1250 /** 1251 * @brief Query extension info with type name. 1252 * @param Want Indicates the information of extension info. 1253 * @param extensionTypeName Indicates the type of the extension. 1254 * @param flag Indicates the query flag which will fliter any specified stuff in the extension info. 1255 * @param userId Indicates the userId in the system. 1256 * @param extensionInfos Indicates the obtained extensions. 1257 * @return Returns ERR_OK if this function is successfully called; returns other ErrCode otherwise. 1258 */ QueryExtensionAbilityInfosWithTypeName(const Want & want,const std::string & extensionTypeName,const int32_t flag,const int32_t userId,std::vector<ExtensionAbilityInfo> & extensionInfos)1259 virtual ErrCode QueryExtensionAbilityInfosWithTypeName(const Want &want, const std::string &extensionTypeName, 1260 const int32_t flag, const int32_t userId, std::vector<ExtensionAbilityInfo> &extensionInfos) 1261 { 1262 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 1263 } 1264 1265 /** 1266 * @brief Query extension info only with type name. 1267 * @param extensionTypeName Indicates the type of the extension. 1268 * @param flag Indicates the query flag which will fliter any specified stuff in the extension info. 1269 * @param userId Indicates the userId in the system. 1270 * @param extensionInfos Indicates the obtained extensions. 1271 * @return Returns ERR_OK if this function is successfully called; returns other ErrCode otherwise. 1272 */ QueryExtensionAbilityInfosOnlyWithTypeName(const std::string & extensionTypeName,const uint32_t flag,const int32_t userId,std::vector<ExtensionAbilityInfo> & extensionInfos)1273 virtual ErrCode QueryExtensionAbilityInfosOnlyWithTypeName(const std::string &extensionTypeName, 1274 const uint32_t flag, const int32_t userId, std::vector<ExtensionAbilityInfo> &extensionInfos) 1275 { 1276 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 1277 } 1278 ResetAOTCompileStatus(const std::string & bundleName,const std::string & moduleName,int32_t triggerMode)1279 virtual ErrCode ResetAOTCompileStatus(const std::string &bundleName, const std::string &moduleName, 1280 int32_t triggerMode) 1281 { 1282 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 1283 } 1284 1285 virtual ErrCode GetJsonProfile(ProfileType profileType, const std::string &bundleName, 1286 const std::string &moduleName, std::string &profile, int32_t userId = Constants::UNSPECIFIED_USERID) 1287 { 1288 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 1289 } 1290 GetBundleResourceProxy()1291 virtual sptr<IBundleResource> GetBundleResourceProxy() 1292 { 1293 return nullptr; 1294 } 1295 GetRecoverableApplicationInfo(std::vector<RecoverableApplicationInfo> & recoverableApplications)1296 virtual ErrCode GetRecoverableApplicationInfo(std::vector<RecoverableApplicationInfo> &recoverableApplications) 1297 { 1298 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 1299 } 1300 GetUninstalledBundleInfo(const std::string bundleName,BundleInfo & bundleInfo)1301 virtual ErrCode GetUninstalledBundleInfo(const std::string bundleName, BundleInfo &bundleInfo) 1302 { 1303 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 1304 } 1305 SetAdditionalInfo(const std::string & bundleName,const std::string & additionalInfo)1306 virtual ErrCode SetAdditionalInfo(const std::string &bundleName, const std::string &additionalInfo) 1307 { 1308 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 1309 } 1310 CreateBundleDataDir(int32_t userId)1311 virtual ErrCode CreateBundleDataDir(int32_t userId) 1312 { 1313 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 1314 } 1315 }; 1316 1317 #define WRITE_PARCEL(func) \ 1318 do { \ 1319 if (!(func)) { \ 1320 APP_LOGE("write parcel failed, func : %{public}s", #func); \ 1321 return ERR_APPEXECFWK_PARCEL_ERROR; \ 1322 } \ 1323 } while (0) 1324 } // namespace AppExecFwk 1325 } // namespace OHOS 1326 #endif // FOUNDATION_APPEXECFWK_INTERFACES_INNERKITS_APPEXECFWK_CORE_INCLUDE_BUNDLEMGR_BUNDLE_MGR_INTERFACE_H 1327