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