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