1 /* 2 * Copyright (c) 2021-2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef FOUNDATION_APPEXECFWK_INTERFACES_INNERKITS_APPEXECFWK_CORE_INCLUDE_BUNDLEMGR_BUNDLE_MGR_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_dir.h" 25 #include "bundle_event_callback_interface.h" 26 #include "bundle_info.h" 27 #include "bundle_pack_info.h" 28 #include "bundle_installer_interface.h" 29 #include "bundle_status_callback_interface.h" 30 #include "bundle_user_mgr_interface.h" 31 #include "clean_cache_callback_interface.h" 32 #include "common_event_info.h" 33 #include "data_group_info.h" 34 #include "app_control_interface.h" 35 #include "bundle_resource_interface.h" 36 #include "default_app_interface.h" 37 #include "extend_resource_manager_interface.h" 38 #include "overlay_manager_interface.h" 39 #include "quick_fix_manager_interface.h" 40 #include "verify_manager_interface.h" 41 #include "distributed_bundle_info.h" 42 #include "form_info.h" 43 #include "hap_module_info.h" 44 #include "permission_define.h" 45 #include "preinstalled_application_info.h" 46 #include "process_cache_callback_interface.h" 47 #include "recoverable_application_info.h" 48 #include "shared/base_shared_bundle_info.h" 49 #include "shared/shared_bundle_info.h" 50 #include "shortcut_info.h" 51 #include "want.h" 52 53 namespace OHOS { 54 namespace AppExecFwk { 55 enum class DumpFlag { 56 DUMP_BUNDLE_LIST = 1, // corresponse to option "-bundle-list" 57 DUMP_BUNDLE_INFO, // corresponse to option "-bundle [name]" 58 DUMP_SHORTCUT_INFO, // corresponse to option "-bundle [name] -shortcut-info" 59 }; 60 61 class IBundleMgr : public IRemoteBroker { 62 public: 63 DECLARE_INTERFACE_DESCRIPTOR(u"ohos.appexecfwk.BundleMgr"); 64 65 using Want = OHOS::AAFwk::Want; 66 /** 67 * @brief Obtains the ApplicationInfo based on a given bundle name. 68 * @param appName Indicates the application bundle name to be queried. 69 * @param flag Indicates the flag used to specify information contained 70 * in the ApplicationInfo object that will be returned. 71 * @param userId Indicates the user ID. 72 * @param appInfo Indicates the obtained ApplicationInfo object. 73 * @return Returns true if the application is successfully obtained; returns false otherwise. 74 */ GetApplicationInfo(const std::string & appName,const ApplicationFlag flag,const int userId,ApplicationInfo & appInfo)75 virtual bool GetApplicationInfo( 76 const std::string &appName, const ApplicationFlag flag, const int userId, ApplicationInfo &appInfo) 77 { 78 return false; 79 } 80 /** 81 * @brief Obtains the ApplicationInfo based on a given bundle name. 82 * @param appName Indicates the application bundle name to be queried. 83 * @param flags Indicates the flag used to specify information contained 84 * in the ApplicationInfo object that will be returned. 85 * @param userId Indicates the user ID. 86 * @param appInfo Indicates the obtained ApplicationInfo object. 87 * @return Returns true if the application is successfully obtained; returns false otherwise. 88 */ GetApplicationInfo(const std::string & appName,int32_t flags,int32_t userId,ApplicationInfo & appInfo)89 virtual bool GetApplicationInfo( 90 const std::string &appName, int32_t flags, int32_t userId, ApplicationInfo &appInfo) 91 { 92 return false; 93 } 94 /** 95 * @brief Obtains the ApplicationInfo based on a given bundle name. 96 * @param appName Indicates the application bundle name to be queried. 97 * @param flag Indicates the flag used to specify information contained 98 * in the ApplicationInfo object that will be returned. 99 * @param userId Indicates the user ID. 100 * @param appInfo Indicates the obtained ApplicationInfo object. 101 * @return Returns ERR_OK if the application is successfully obtained; returns error code otherwise. 102 */ GetApplicationInfoV9(const std::string & appName,int32_t flag,int32_t userId,ApplicationInfo & appInfo)103 virtual ErrCode GetApplicationInfoV9( 104 const std::string &appName, int32_t flag, int32_t userId, ApplicationInfo &appInfo) 105 { 106 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 107 } 108 /** 109 * @brief Obtains information about all installed applications of a specified user. 110 * @param flag Indicates the flag used to specify information contained 111 * in the ApplicationInfo objects that will be returned. 112 * @param userId Indicates the user ID. 113 * @param appInfos Indicates all of the obtained ApplicationInfo objects. 114 * @return Returns true if the application is successfully obtained; returns false otherwise. 115 */ GetApplicationInfos(const ApplicationFlag flag,int userId,std::vector<ApplicationInfo> & appInfos)116 virtual bool GetApplicationInfos( 117 const ApplicationFlag flag, int userId, std::vector<ApplicationInfo> &appInfos) 118 { 119 return false; 120 } 121 /** 122 * @brief Obtains information about all installed applications of a specified user. 123 * @param flags Indicates the flag used to specify information contained 124 * in the ApplicationInfo objects that will be returned. 125 * @param userId Indicates the user ID. 126 * @param appInfos Indicates all of the obtained ApplicationInfo objects. 127 * @return Returns true if the application is successfully obtained; returns false otherwise. 128 */ GetApplicationInfos(int32_t flags,int32_t userId,std::vector<ApplicationInfo> & appInfos)129 virtual bool GetApplicationInfos( 130 int32_t flags, int32_t userId, std::vector<ApplicationInfo> &appInfos) 131 { 132 return false; 133 } 134 /** 135 * @brief Obtains information about all installed applications of a specified user. 136 * @param flags Indicates the flag used to specify information contained 137 * in the ApplicationInfo objects that will be returned. 138 * @param userId Indicates the user ID. 139 * @param appInfos Indicates all of the obtained ApplicationInfo objects. 140 * @return Returns ERR_OK if the application is successfully obtained; returns error code otherwise. 141 */ GetApplicationInfosV9(int32_t flags,int32_t userId,std::vector<ApplicationInfo> & appInfos)142 virtual ErrCode GetApplicationInfosV9( 143 int32_t flags, int32_t userId, std::vector<ApplicationInfo> &appInfos) 144 { 145 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 146 } 147 /** 148 * @brief Obtains the BundleInfo based on a given bundle name. 149 * @param bundleName Indicates the application bundle name to be queried. 150 * @param flag Indicates the information contained in the BundleInfo object to be returned. 151 * @param bundleInfo Indicates the obtained BundleInfo object. 152 * @param userId Indicates the user ID. 153 * @return Returns true if the BundleInfo is successfully obtained; returns false otherwise. 154 */ 155 virtual bool GetBundleInfo(const std::string &bundleName, const BundleFlag flag, 156 BundleInfo &bundleInfo, int32_t userId = Constants::UNSPECIFIED_USERID) 157 { 158 return false; 159 } 160 /** 161 * @brief Obtains the BundleInfo based on a given bundle name. 162 * @param bundleName Indicates the application bundle name to be queried. 163 * @param flags Indicates the information contained in the BundleInfo object to be returned. 164 * @param bundleInfo Indicates the obtained BundleInfo object. 165 * @param userId Indicates the user ID. 166 * @return Returns true if the BundleInfo is successfully obtained; returns false otherwise. 167 */ 168 virtual bool GetBundleInfo(const std::string &bundleName, int32_t flags, 169 BundleInfo &bundleInfo, int32_t userId = Constants::UNSPECIFIED_USERID) 170 { 171 return false; 172 } 173 /** 174 * @brief Obtains the BundleInfo based on a given bundle name. 175 * @param bundleName Indicates the application bundle name to be queried. 176 * @param flags Indicates the information contained in the BundleInfo object to be returned. 177 * @param bundleInfo Indicates the obtained BundleInfo object. 178 * @param userId Indicates the user ID. 179 * @return Returns ERR_OK if the BundleInfo is successfully obtained; returns error code otherwise. 180 */ GetBundleInfoV9(const std::string & bundleName,int32_t flags,BundleInfo & bundleInfo,int32_t userId)181 virtual ErrCode GetBundleInfoV9(const std::string &bundleName, int32_t flags, 182 BundleInfo &bundleInfo, int32_t userId) 183 { 184 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 185 } 186 /** 187 * @brief Obtains the BundleInfos by the given want list through the proxy object. 188 * @param wants Indicates the imformation of the abilities to be queried. 189 * @param flags Indicates the information contained in the BundleInfo object to be returned. 190 * @param bundleInfos Indicates the obtained BundleInfo list object. 191 * @param userId Indicates the user ID. 192 * @return Returns ERR_OK if the BundleInfo is successfully obtained; returns error code otherwise. 193 */ BatchGetBundleInfo(const std::vector<Want> & wants,int32_t flags,std::vector<BundleInfo> & bundleInfos,int32_t userId)194 virtual ErrCode BatchGetBundleInfo(const std::vector<Want> &wants, int32_t flags, 195 std::vector<BundleInfo> &bundleInfos, int32_t userId) 196 { 197 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 198 } 199 /** 200 * @brief Batch obtains the BundleInfos based on a given bundle name list. 201 * @param bundleNames Indicates the application bundle name list to be queried. 202 * @param flags Indicates the information contained in the BundleInfo object to be returned. 203 * @param bundleInfos Indicates the obtained BundleInfo list object. 204 * @param userId Indicates the user ID. 205 * @return Returns ERR_OK if the BundleInfo is successfully obtained; returns error code otherwise. 206 */ BatchGetBundleInfo(const std::vector<std::string> & bundleNames,int32_t flags,std::vector<BundleInfo> & bundleInfos,int32_t userId)207 virtual ErrCode BatchGetBundleInfo(const std::vector<std::string> &bundleNames, int32_t flags, 208 std::vector<BundleInfo> &bundleInfos, int32_t userId) 209 { 210 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 211 } 212 /** 213 * @brief Obtains the BundleInfo for the calling app. 214 * @param bundleName Indicates the application bundle name to be queried. 215 * @param flags Indicates the information contained in the BundleInfo object to be returned. 216 * @param bundleInfo Indicates the obtained BundleInfo object. 217 * @param userId Indicates the user ID. 218 * @return Returns ERR_OK if the BundleInfo is successfully obtained; returns error code otherwise. 219 */ GetBundleInfoForSelf(int32_t flags,BundleInfo & bundleInfo)220 virtual ErrCode GetBundleInfoForSelf(int32_t flags, BundleInfo &bundleInfo) 221 { 222 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 223 } 224 /** 225 * @brief Obtains the BundleInfo based on a given bundle name, which the calling app depends on. 226 * @param sharedBundleName Indicates the bundle name to be queried. 227 * @param sharedBundleInfo Indicates the obtained BundleInfo object. 228 * @param flag Indicates the flag, GetDependentBundleInfoFlag. 229 * @return Returns ERR_OK if the BundleInfo is successfully obtained; returns error code otherwise. 230 */ 231 virtual ErrCode GetDependentBundleInfo(const std::string &sharedBundleName, BundleInfo &sharedBundleInfo, 232 GetDependentBundleInfoFlag flag = GetDependentBundleInfoFlag::GET_APP_CROSS_HSP_BUNDLE_INFO) 233 { 234 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 235 } 236 /** 237 * @brief Obtains the BundlePackInfo based on a given bundle name. 238 * @param bundleName Indicates the application bundle name to be queried. 239 * @param flags Indicates the information contained in the BundleInfo object to be returned. 240 * @param BundlePackInfo Indicates the obtained BundlePackInfo object. 241 * @param userId Indicates the user ID. 242 * @return Returns ERR_OK if the BundlePackInfo is successfully obtained; returns other ErrCode otherwise. 243 */ 244 virtual ErrCode GetBundlePackInfo(const std::string &bundleName, const BundlePackFlag flag, 245 BundlePackInfo &bundlePackInfo, int32_t userId = Constants::UNSPECIFIED_USERID) 246 { 247 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 248 } 249 250 /** 251 * @brief Obtains the BundlePackInfo based on a given bundle name. 252 * @param bundleName Indicates the application bundle name to be queried. 253 * @param flags Indicates the information contained in the BundleInfo object to be returned. 254 * @param BundlePackInfo Indicates the obtained BundlePackInfo object. 255 * @param userId Indicates the user ID. 256 * @return Returns ERR_OK if the BundlePackInfo is successfully obtained; returns other ErrCode otherwise. 257 */ 258 virtual ErrCode GetBundlePackInfo(const std::string &bundleName, int32_t flags, 259 BundlePackInfo &bundlePackInfo, int32_t userId = Constants::UNSPECIFIED_USERID) 260 { 261 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 262 } 263 264 /** 265 * @brief Obtains BundleInfo of all bundles available in the system. 266 * @param flag Indicates the flag used to specify information contained in the BundleInfo that will be returned. 267 * @param bundleInfos Indicates all of the obtained BundleInfo objects. 268 * @param userId Indicates the user ID. 269 * @return Returns true if the BundleInfos is successfully obtained; returns false otherwise. 270 */ 271 virtual bool GetBundleInfos(const BundleFlag flag, 272 std::vector<BundleInfo> &bundleInfos, int32_t userId = Constants::UNSPECIFIED_USERID) 273 { 274 return false; 275 } 276 /** 277 * @brief Obtains BundleInfo of all bundles available in the system. 278 * @param flags Indicates the flag used to specify information contained in the BundleInfo that will be returned. 279 * @param bundleInfos Indicates all of the obtained BundleInfo objects. 280 * @param userId Indicates the user ID. 281 * @return Returns true if the BundleInfos is successfully obtained; returns false otherwise. 282 */ 283 virtual bool GetBundleInfos(int32_t flags, 284 std::vector<BundleInfo> &bundleInfos, int32_t userId = Constants::UNSPECIFIED_USERID) 285 { 286 return false; 287 } 288 /** 289 * @brief Obtains BundleInfo of all bundles available in the system. 290 * @param flags Indicates the flag used to specify information contained in the BundleInfo that will be returned. 291 * @param bundleInfos Indicates all of the obtained BundleInfo objects. 292 * @param userId Indicates the user ID. 293 * @return Returns ERR_OK if the BundleInfos is successfully obtained; returns error code otherwise. 294 */ GetBundleInfosV9(int32_t flags,std::vector<BundleInfo> & bundleInfos,int32_t userId)295 virtual ErrCode GetBundleInfosV9(int32_t flags, std::vector<BundleInfo> &bundleInfos, int32_t userId) 296 { 297 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 298 } 299 /** 300 * @brief Obtains the application UID based on the given bundle name and user ID. 301 * @param bundleName Indicates the bundle name of the application. 302 * @param userId Indicates the user ID. 303 * @return Returns the uid if successfully obtained; returns -1 otherwise. 304 */ GetUidByBundleName(const std::string & bundleName,const int userId)305 virtual int GetUidByBundleName(const std::string &bundleName, const int userId) 306 { 307 return Constants::INVALID_UID; 308 } 309 /** 310 * @brief Obtains the application UID based on the given bundle name and user ID. 311 * @param bundleName Indicates the bundle name of the application. 312 * @param userId Indicates the user ID. 313 * @param userId Indicates the app Index. 314 * @return Returns the uid if successfully obtained; returns -1 otherwise. 315 */ GetUidByBundleName(const std::string & bundleName,const int32_t userId,int32_t appIndex)316 virtual int32_t GetUidByBundleName(const std::string &bundleName, const int32_t userId, int32_t appIndex) 317 { 318 return Constants::INVALID_UID; 319 } 320 /** 321 * @brief Obtains the debug application UID based on the given bundle name and user ID. 322 * @param bundleName Indicates the bundle name of the application. 323 * @param userId Indicates the user ID. 324 * @return Returns the uid if successfully obtained; returns -1 otherwise. 325 */ GetUidByDebugBundleName(const std::string & bundleName,const int userId)326 virtual int GetUidByDebugBundleName(const std::string &bundleName, const int userId) 327 { 328 return Constants::INVALID_UID; 329 } 330 /** 331 * @brief Obtains the application ID based on the given bundle name and user ID. 332 * @param bundleName Indicates the bundle name of the application. 333 * @param userId Indicates the user ID. 334 * @return Returns the application ID if successfully obtained; returns empty string otherwise. 335 */ GetAppIdByBundleName(const std::string & bundleName,const int userId)336 virtual std::string GetAppIdByBundleName(const std::string &bundleName, const int userId) 337 { 338 return Constants::EMPTY_STRING; 339 } 340 /** 341 * @brief Obtains the bundle name of a specified application based on the given UID. 342 * @param uid Indicates the uid. 343 * @param bundleName Indicates the obtained bundle name. 344 * @return Returns true if the bundle name is successfully obtained; returns false otherwise. 345 */ GetBundleNameForUid(const int uid,std::string & bundleName)346 virtual bool GetBundleNameForUid(const int uid, std::string &bundleName) 347 { 348 return false; 349 } 350 /** 351 * @brief Obtains all bundle names of a specified application based on the given application UID. 352 * @param uid Indicates the uid. 353 * @param bundleNames Indicates the obtained bundle names. 354 * @return Returns true if the bundle names is successfully obtained; returns false otherwise. 355 */ GetBundlesForUid(const int uid,std::vector<std::string> & bundleNames)356 virtual bool GetBundlesForUid(const int uid, std::vector<std::string> &bundleNames) 357 { 358 return false; 359 } 360 /** 361 * @brief Obtains the formal name associated with the given UID. 362 * @param uid Indicates the uid. 363 * @param name Indicates the obtained formal name. 364 * @return Returns ERR_OK if execute success; returns errCode otherwise. 365 */ GetNameForUid(const int uid,std::string & name)366 virtual ErrCode GetNameForUid(const int uid, std::string &name) 367 { 368 return ERR_BUNDLE_MANAGER_INTERNAL_ERROR; 369 } 370 /** 371 * @brief Obtains the formal name associated with the given UID. 372 * @param uid Indicates the uid. 373 * @param bundleName Indicates the obtained formal bundleName. 374 * @param name Indicates the obtained appIndex. 375 * @return Returns ERR_OK if execute success; returns errCode otherwise. 376 */ GetNameAndIndexForUid(const int32_t uid,std::string & bundleName,int32_t & appIndex)377 virtual ErrCode GetNameAndIndexForUid(const int32_t uid, std::string &bundleName, int32_t &appIndex) 378 { 379 return ERR_BUNDLE_MANAGER_INTERNAL_ERROR; 380 } 381 /** 382 * @brief Obtains the formal name associated with the given UID list. 383 * @param uids Indicates the uid list. 384 * @param simpleAppInfo Indicates all of the obtained SimpleAppInfo objects. 385 * @return Returns ERR_OK if execute success; returns errCode otherwise. 386 */ GetSimpleAppInfoForUid(const std::vector<std::int32_t> & uids,std::vector<SimpleAppInfo> & simpleAppInfo)387 virtual ErrCode GetSimpleAppInfoForUid( 388 const std::vector<std::int32_t> &uids, std::vector<SimpleAppInfo> &simpleAppInfo) 389 { 390 return ERR_BUNDLE_MANAGER_INTERNAL_ERROR; 391 } 392 /** 393 * @brief Obtains an array of all group IDs associated with a specified bundle. 394 * @param bundleName Indicates the bundle name. 395 * @param gids Indicates the group IDs associated with the specified bundle. 396 * @return Returns true if the gids is successfully obtained; returns false otherwise. 397 */ GetBundleGids(const std::string & bundleName,std::vector<int> & gids)398 virtual bool GetBundleGids(const std::string &bundleName, std::vector<int> &gids) 399 { 400 return false; 401 } 402 /** 403 * @brief Obtains an array of all group IDs associated with the given bundle name and UID. 404 * @param bundleName Indicates the bundle name. 405 * @param uid Indicates the uid. 406 * @param gids Indicates the group IDs associated with the specified bundle. 407 * @return Returns true if the gids is successfully obtained; returns false otherwise. 408 */ GetBundleGidsByUid(const std::string & bundleName,const int & uid,std::vector<int> & gids)409 virtual bool GetBundleGidsByUid(const std::string &bundleName, const int &uid, std::vector<int> &gids) 410 { 411 return false; 412 } 413 /** 414 * @brief Obtains the type of a specified application based on the given bundle name. 415 * @param bundleName Indicates the bundle name. 416 * @return Returns "system" if the bundle is a system application; returns "third-party" otherwise. 417 */ GetAppType(const std::string & bundleName)418 virtual std::string GetAppType(const std::string &bundleName) 419 { 420 return Constants::EMPTY_STRING; 421 } 422 /** 423 * @brief Check whether the app is system app by it's UID. 424 * @param uid Indicates the uid. 425 * @return Returns true if the bundle is a system application; returns false otherwise. 426 */ CheckIsSystemAppByUid(const int uid)427 virtual bool CheckIsSystemAppByUid(const int uid) 428 { 429 return false; 430 } 431 /** 432 * @brief Obtains the BundleInfo of application bundles based on the specified metaData. 433 * @param metaData Indicates the metadata to get in the bundle. 434 * @param bundleInfos Indicates all of the obtained BundleInfo objects. 435 * @return Returns true if the BundleInfos is successfully obtained; returns false otherwise. 436 */ GetBundleInfosByMetaData(const std::string & metaData,std::vector<BundleInfo> & bundleInfos)437 virtual bool GetBundleInfosByMetaData(const std::string &metaData, std::vector<BundleInfo> &bundleInfos) 438 { 439 return false; 440 } 441 /** 442 * @brief Query the AbilityInfo by the given Want. 443 * @param want Indicates the information of the ability. 444 * @param abilityInfo Indicates the obtained AbilityInfo object. 445 * @return Returns true if the AbilityInfo is successfully obtained; returns false otherwise. 446 */ QueryAbilityInfo(const Want & want,AbilityInfo & abilityInfo)447 virtual bool QueryAbilityInfo(const Want &want, AbilityInfo &abilityInfo) 448 { 449 return false; 450 } 451 /** 452 * @brief Query the AbilityInfo by the given Want. 453 * @param want Indicates the information of the ability. 454 * @param flags Indicates the information contained in the AbilityInfo object to be returned. 455 * @param userId Indicates the user ID. 456 * @param abilityInfo Indicates the obtained AbilityInfo object. 457 * @param callBack Indicates the callback to be invoked for return ability manager service the operation result. 458 * @return Returns true if the AbilityInfo is successfully obtained; returns false otherwise. 459 */ QueryAbilityInfo(const Want & want,int32_t flags,int32_t userId,AbilityInfo & abilityInfo,const sptr<IRemoteObject> & callBack)460 virtual bool QueryAbilityInfo(const Want &want, int32_t flags, int32_t userId, AbilityInfo &abilityInfo, 461 const sptr<IRemoteObject> &callBack) 462 { 463 return false; 464 } 465 /** 466 * @brief Silent install by the given Want. 467 * @param want Indicates the information of the want. 468 * @param userId Indicates the user ID. 469 * @param callBack Indicates the callback to be invoked for return the operation result. 470 * @return Returns true if silent install successfully; returns false otherwise. 471 */ SilentInstall(const Want & want,int32_t userId,const sptr<IRemoteObject> & callBack)472 virtual bool SilentInstall(const Want &want, int32_t userId, const sptr<IRemoteObject> &callBack) 473 { 474 return false; 475 } 476 /** 477 * @brief Upgrade atomic service 478 * @param want Indicates the information of the ability. 479 * @param userId Indicates the user ID. 480 */ UpgradeAtomicService(const Want & want,int32_t userId)481 virtual void UpgradeAtomicService(const Want &want, int32_t userId) 482 { 483 return; 484 } 485 /** 486 * @brief Query the AbilityInfo by the given Want. 487 * @param want Indicates the information of the ability. 488 * @param flags Indicates the information contained in the AbilityInfo object to be returned. 489 * @param userId Indicates the user ID. 490 * @param abilityInfo Indicates the obtained AbilityInfo object. 491 * @return Returns true if the AbilityInfo is successfully obtained; returns false otherwise. 492 */ QueryAbilityInfo(const Want & want,int32_t flags,int32_t userId,AbilityInfo & abilityInfo)493 virtual bool QueryAbilityInfo(const Want &want, int32_t flags, int32_t userId, AbilityInfo &abilityInfo) 494 { 495 return false; 496 } 497 /** 498 * @brief Query the AbilityInfo of list by the given Want. 499 * @param want Indicates the information of the ability. 500 * @param abilityInfos Indicates the obtained AbilityInfos object. 501 * @return Returns true if the AbilityInfos is successfully obtained; returns false otherwise. 502 */ QueryAbilityInfos(const Want & want,std::vector<AbilityInfo> & abilityInfos)503 virtual bool QueryAbilityInfos(const Want &want, std::vector<AbilityInfo> &abilityInfos) 504 { 505 return false; 506 } 507 /** 508 * @brief Query the AbilityInfo of list by the given Want. 509 * @param want Indicates the information of the ability. 510 * @param flags Indicates the information contained in the AbilityInfo object to be returned. 511 * @param userId Indicates the user ID. 512 * @param abilityInfos Indicates the obtained AbilityInfos object. 513 * @return Returns true if the AbilityInfos is successfully obtained; returns false otherwise. 514 */ QueryAbilityInfos(const Want & want,int32_t flags,int32_t userId,std::vector<AbilityInfo> & abilityInfos)515 virtual bool QueryAbilityInfos( 516 const Want &want, int32_t flags, int32_t userId, std::vector<AbilityInfo> &abilityInfos) 517 { 518 return false; 519 } 520 /** 521 * @brief Query the AbilityInfo of list by the given Want. 522 * @param want Indicates the information of the ability. 523 * @param flags Indicates the information contained in the AbilityInfo object to be returned. 524 * @param userId Indicates the user ID. 525 * @param abilityInfos Indicates the obtained AbilityInfos object. 526 * @return Returns ERR_OK if the AbilityInfos is successfully obtained; returns errCode otherwise. 527 */ QueryAbilityInfosV9(const Want & want,int32_t flags,int32_t userId,std::vector<AbilityInfo> & abilityInfos)528 virtual ErrCode QueryAbilityInfosV9( 529 const Want &want, int32_t flags, int32_t userId, std::vector<AbilityInfo> &abilityInfos) 530 { 531 return ERR_BUNDLE_MANAGER_INTERNAL_ERROR; 532 } 533 /** 534 * @brief Query the AbilityInfo of list by the given Wants. 535 * @param want Indicates the information of the ability. 536 * @param flags Indicates the information contained in the AbilityInfo object to be returned. 537 * @param userId Indicates the user ID. 538 * @param abilityInfos Indicates the obtained AbilityInfos object. 539 * @return Returns ERR_OK if the AbilityInfos is successfully obtained; returns errCode otherwise. 540 */ BatchQueryAbilityInfos(const std::vector<Want> & wants,int32_t flags,int32_t userId,std::vector<AbilityInfo> & abilityInfos)541 virtual ErrCode BatchQueryAbilityInfos( 542 const std::vector<Want> &wants, int32_t flags, int32_t userId, std::vector<AbilityInfo> &abilityInfos) 543 { 544 return ERR_BUNDLE_MANAGER_INTERNAL_ERROR; 545 } 546 QueryLauncherAbilityInfos(const Want & want,int32_t userId,std::vector<AbilityInfo> & abilityInfo)547 virtual ErrCode QueryLauncherAbilityInfos( 548 const Want &want, int32_t userId, std::vector<AbilityInfo> &abilityInfo) 549 { 550 return ERR_BUNDLE_MANAGER_INTERNAL_ERROR; 551 } 552 /** 553 * @brief Query the AllAbilityInfos of list by the given userId. 554 * @param userId Indicates the information of the user. 555 * @param abilityInfos Indicates the obtained AbilityInfos object. 556 * @return Returns true if the AbilityInfos is successfully obtained; returns false otherwise. 557 */ QueryAllAbilityInfos(const Want & want,int32_t userId,std::vector<AbilityInfo> & abilityInfos)558 virtual bool QueryAllAbilityInfos(const Want &want, int32_t userId, std::vector<AbilityInfo> &abilityInfos) 559 { 560 return false; 561 } 562 /** 563 * @brief Query the AbilityInfo by ability.uri in config.json. 564 * @param abilityUri Indicates the uri of the ability. 565 * @param abilityInfo Indicates the obtained AbilityInfo object. 566 * @return Returns true if the AbilityInfo is successfully obtained; returns false otherwise. 567 */ QueryAbilityInfoByUri(const std::string & abilityUri,AbilityInfo & abilityInfo)568 virtual bool QueryAbilityInfoByUri(const std::string &abilityUri, AbilityInfo &abilityInfo) 569 { 570 return false; 571 } 572 /** 573 * @brief Query the AbilityInfo by ability.uri in config.json. 574 * @param abilityUri Indicates the uri of the ability. 575 * @param userId Indicates the user ID. 576 * @param abilityInfo Indicates the obtained AbilityInfo object. 577 * @return Returns true if the AbilityInfo is successfully obtained; returns false otherwise. 578 */ QueryAbilityInfoByUri(const std::string & abilityUri,int32_t userId,AbilityInfo & abilityInfo)579 virtual bool QueryAbilityInfoByUri(const std::string &abilityUri, int32_t userId, AbilityInfo &abilityInfo) 580 { 581 return true; 582 }; 583 /** 584 * @brief Query the AbilityInfo by ability.uri in config.json. 585 * @param abilityUri Indicates the uri of the ability. 586 * @param abilityInfos Indicates the obtained AbilityInfos object. 587 * @return Returns true if the AbilityInfo is successfully obtained; returns false otherwise. 588 */ QueryAbilityInfosByUri(const std::string & abilityUri,std::vector<AbilityInfo> & abilityInfos)589 virtual bool QueryAbilityInfosByUri(const std::string &abilityUri, std::vector<AbilityInfo> &abilityInfos) 590 { 591 return false; 592 } 593 /** 594 * @brief Obtains the BundleInfo of all keep-alive applications in the system. 595 * @param bundleInfos Indicates all of the obtained BundleInfo objects. 596 * @return Returns true if the BundleInfos is successfully obtained; returns false otherwise. 597 */ QueryKeepAliveBundleInfos(std::vector<BundleInfo> & bundleInfos)598 virtual bool QueryKeepAliveBundleInfos(std::vector<BundleInfo> &bundleInfos) 599 { 600 return false; 601 } 602 /** 603 * @brief Obtains the label of a specified ability. 604 * @param bundleName Indicates the bundle name. 605 * @param abilityName Indicates the ability name. 606 * @return Returns the label of the ability if exist; returns empty string otherwise. 607 */ GetAbilityLabel(const std::string & bundleName,const std::string & abilityName)608 virtual std::string GetAbilityLabel(const std::string &bundleName, const std::string &abilityName) 609 { 610 return Constants::EMPTY_STRING; 611 } 612 /** 613 * @brief Obtains the label of a specified ability. 614 * @param bundleName Indicates the bundle name. 615 * @param moduleName Indicates the module name. 616 * @param abilityName Indicates the ability name. 617 * @param label Indicates the obtained label. 618 * @return Returns ERR_OK if called successfully; returns error code otherwise. 619 */ GetAbilityLabel(const std::string & bundleName,const std::string & moduleName,const std::string & abilityName,std::string & label)620 virtual ErrCode GetAbilityLabel(const std::string &bundleName, const std::string &moduleName, 621 const std::string &abilityName, std::string &label) 622 { 623 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 624 } 625 /** 626 * @brief Obtains information about an application bundle contained in an ohos Ability Package (HAP). 627 * @param hapFilePath Indicates the absolute file path of the HAP. 628 * @param flag Indicates the information contained in the BundleInfo object to be returned. 629 * @param bundleInfo Indicates the obtained BundleInfo object. 630 * @return Returns true if the BundleInfo is successfully obtained; returns false otherwise. 631 */ GetBundleArchiveInfo(const std::string & hapFilePath,const BundleFlag flag,BundleInfo & bundleInfo)632 virtual bool GetBundleArchiveInfo( 633 const std::string &hapFilePath, const BundleFlag flag, BundleInfo &bundleInfo) 634 { 635 return false; 636 } 637 /** 638 * @brief Obtains information about an application bundle contained in an ohos Ability Package (HAP). 639 * @param hapFilePath Indicates the absolute file path of the HAP. 640 * @param flags Indicates the information contained in the BundleInfo object to be returned. 641 * @param bundleInfo Indicates the obtained BundleInfo object. 642 * @return Returns true if the BundleInfo is successfully obtained; returns false otherwise. 643 */ GetBundleArchiveInfo(const std::string & hapFilePath,int32_t flags,BundleInfo & bundleInfo)644 virtual bool GetBundleArchiveInfo( 645 const std::string &hapFilePath, int32_t flags, BundleInfo &bundleInfo) 646 { 647 return false; 648 } 649 /** 650 * @brief Obtains information about an application bundle contained in an ohos Ability Package (HAP). 651 * @param hapFilePath Indicates the absolute file path of the HAP. 652 * @param flags Indicates the information contained in the BundleInfo object to be returned. 653 * @param bundleInfo Indicates the obtained BundleInfo object. 654 * @return Returns ERR_OK if this function is successfully called; returns errCode otherwise. 655 */ GetBundleArchiveInfoV9(const std::string & hapFilePath,int32_t flags,BundleInfo & bundleInfo)656 virtual ErrCode GetBundleArchiveInfoV9( 657 const std::string &hapFilePath, int32_t flags, BundleInfo &bundleInfo) 658 { 659 return ERR_BUNDLE_MANAGER_INTERNAL_ERROR; 660 } 661 /** 662 * @brief Obtain the HAP module info of a specific ability. 663 * @param abilityInfo Indicates the ability. 664 * @param hapModuleInfo Indicates the obtained HapModuleInfo object. 665 * @return Returns true if the HapModuleInfo is successfully obtained; returns false otherwise. 666 */ GetHapModuleInfo(const AbilityInfo & abilityInfo,HapModuleInfo & hapModuleInfo)667 virtual bool GetHapModuleInfo(const AbilityInfo &abilityInfo, HapModuleInfo &hapModuleInfo) 668 { 669 return false; 670 } 671 /** 672 * @brief Obtain the HAP module info of a specific ability. 673 * @param abilityInfo Indicates the ability. 674 * @param userId Indicates the userId. 675 * @param hapModuleInfo Indicates the obtained HapModuleInfo object. 676 * @return Returns true if the HapModuleInfo is successfully obtained; returns false otherwise. 677 */ GetHapModuleInfo(const AbilityInfo & abilityInfo,int32_t userId,HapModuleInfo & hapModuleInfo)678 virtual bool GetHapModuleInfo(const AbilityInfo &abilityInfo, int32_t userId, HapModuleInfo &hapModuleInfo) 679 { 680 return false; 681 } 682 /** 683 * @brief Obtains the Want for starting the main ability of an application based on the given bundle name. 684 * @param bundleName Indicates the bundle name. 685 * @param want Indicates the obtained launch Want object. 686 * @param userId Indicates the userId. 687 * @return Returns ERR_OK if this function is successfully called; returns errCode otherwise. 688 */ 689 virtual ErrCode GetLaunchWantForBundle( 690 const std::string &bundleName, Want &want, int32_t userId = Constants::UNSPECIFIED_USERID) 691 { 692 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 693 } 694 /** 695 * @brief Obtains detailed information about a specified permission. 696 * @param permissionName Indicates the name of the ohos permission. 697 * @param permissionDef Indicates the object containing detailed information about the given ohos permission. 698 * @return Returns ERR_OK if the PermissionDef object is successfully obtained; returns other ErrCode otherwise. 699 */ GetPermissionDef(const std::string & permissionName,PermissionDef & permissionDef)700 virtual ErrCode GetPermissionDef(const std::string &permissionName, PermissionDef &permissionDef) 701 { 702 return ERR_OK; 703 } 704 /** 705 * @brief Clears cache data of a specified application. 706 * @param bundleName Indicates the bundle name of the application whose cache data is to be cleared. 707 * @param cleanCacheCallback Indicates the callback to be invoked for returning the operation result. 708 * @param userId description the user id. 709 * @param appIndex Indicates the app index. 710 * @return Returns ERR_OK if this function is successfully called; returns other ErrCode otherwise. 711 */ 712 virtual ErrCode CleanBundleCacheFiles( 713 const std::string &bundleName, const sptr<ICleanCacheCallback> cleanCacheCallback, 714 int32_t userId = Constants::UNSPECIFIED_USERID, int32_t appIndex = 0) 715 { 716 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 717 } 718 /** 719 * @brief Clears cache data of a specified size. 720 * @param cacheSize Indicates the size of the cache data is to be cleared. 721 * @return Returns ERR_OK if this function is successfully called; returns other ErrCode otherwise. 722 */ CleanBundleCacheFilesAutomatic(uint64_t cacheSize)723 virtual ErrCode CleanBundleCacheFilesAutomatic(uint64_t cacheSize) 724 { 725 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 726 } 727 /** 728 * @brief Clears application running data of a specified application. 729 * @param bundleName Indicates the bundle name of the application whose data is to be cleared. 730 * @param userId Indicates the user id. 731 * @param appIndex Indicates the app index. 732 * @return Returns true if the data cleared successfully; returns false otherwise. 733 */ 734 virtual bool CleanBundleDataFiles(const std::string &bundleName, const int userId = 0, const int appIndex = 0) 735 { 736 return false; 737 } 738 /** 739 * @brief Register the specific bundle status callback. 740 * @param bundleStatusCallback Indicates the callback to be invoked for returning the bundle status changed result. 741 * @return Returns true if this function is successfully called; returns false otherwise. 742 */ RegisterBundleStatusCallback(const sptr<IBundleStatusCallback> & bundleStatusCallback)743 virtual bool RegisterBundleStatusCallback(const sptr<IBundleStatusCallback> &bundleStatusCallback) 744 { 745 return false; 746 } 747 RegisterBundleEventCallback(const sptr<IBundleEventCallback> & bundleEventCallback)748 virtual bool RegisterBundleEventCallback(const sptr<IBundleEventCallback> &bundleEventCallback) 749 { 750 return false; 751 } 752 UnregisterBundleEventCallback(const sptr<IBundleEventCallback> & bundleEventCallback)753 virtual bool UnregisterBundleEventCallback(const sptr<IBundleEventCallback> &bundleEventCallback) 754 { 755 return false; 756 } 757 /** 758 * @brief Clear the specific bundle status callback. 759 * @param bundleStatusCallback Indicates the callback to be cleared. 760 * @return Returns true if this function is successfully called; returns false otherwise. 761 */ ClearBundleStatusCallback(const sptr<IBundleStatusCallback> & bundleStatusCallback)762 virtual bool ClearBundleStatusCallback(const sptr<IBundleStatusCallback> &bundleStatusCallback) 763 { 764 return false; 765 } 766 /** 767 * @brief Unregister all the callbacks of status changed. 768 * @return Returns true if this function is successfully called; returns false otherwise. 769 */ UnregisterBundleStatusCallback()770 virtual bool UnregisterBundleStatusCallback() 771 { 772 return false; 773 } 774 775 /** 776 * @brief Obtains the value of isRemovable based on a given bundle name and module name. 777 * @param bundleName Indicates the bundle name to be queried. 778 * @param moduleName Indicates the module name to be queried. 779 * @param isRemovable Indicates the module whether is removable. 780 * @return Returns ERR_OK if the isRemovable is successfully obtained; returns other ErrCode otherwise. 781 */ IsModuleRemovable(const std::string & bundleName,const std::string & moduleName,bool & isRemovable)782 virtual ErrCode IsModuleRemovable(const std::string &bundleName, const std::string &moduleName, bool &isRemovable) 783 { 784 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 785 } 786 /** 787 * @brief Sets whether to enable isRemovable based on a given bundle name and module name. 788 * @param bundleName Indicates the bundle name to be queried. 789 * @param moduleName Indicates the module name to be queried. 790 * @param isEnable Specifies whether to enable the isRemovable of InnerModuleInfo. 791 * The value true means to enable it, and the value false means to disable it 792 * @return Returns true if the isRemovable is successfully obtained; returns false otherwise. 793 */ SetModuleRemovable(const std::string & bundleName,const std::string & moduleName,bool isEnable)794 virtual bool SetModuleRemovable( 795 const std::string &bundleName, const std::string &moduleName, bool isEnable) 796 { 797 return false; 798 } 799 800 /** 801 * @brief Dump the bundle informations with specific flags. 802 * @param flag Indicates the information contained in the dump result. 803 * @param bundleName Indicates the bundle name if needed. 804 * @param userId Indicates the user ID. 805 * @param result Indicates the dump information result. 806 * @return Returns true if the dump result is successfully obtained; returns false otherwise. 807 */ DumpInfos(const DumpFlag flag,const std::string & bundleName,int32_t userId,std::string & result)808 virtual bool DumpInfos( 809 const DumpFlag flag, const std::string &bundleName, int32_t userId, std::string &result) 810 { 811 return false; 812 } 813 /** 814 * @brief Compile the bundle informations with specific flags. 815 * @param bundleName Indicates the bundle name if needed. 816 * @param compileMode Indicates the mode name. 817 * @param isAllBundle Does it represent all bundlenames. 818 * @return Returns true if the compile result is successfully obtained; returns false otherwise. 819 */ CompileProcessAOT(const std::string & bundleName,const std::string & compileMode,bool isAllBundle,std::vector<std::string> & compileResults)820 virtual ErrCode CompileProcessAOT(const std::string &bundleName, const std::string &compileMode, 821 bool isAllBundle, std::vector<std::string> &compileResults) 822 { 823 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 824 } 825 /** 826 * @brief Reset the bundle informations with specific flags. 827 * @param bundleName Indicates the bundle name if needed. 828 * @param isAllBundle Does it represent all bundlenames. 829 * @return Returns true if the reset result is successfully obtained; returns false otherwise. 830 */ CompileReset(const std::string & bundleName,bool isAllBundle)831 virtual ErrCode CompileReset(const std::string &bundleName, bool isAllBundle) 832 { 833 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 834 } 835 /** 836 * @brief copy ap file to /data/local/pgo 837 * @param bundleName Indicates the bundle name if needed. 838 * @param isAllBundle Does it represent all bundlenames. 839 * @param results Indicates the copy ap information result. 840 * @return Returns ERR_OK if called successfully; returns error code otherwise. 841 */ CopyAp(const std::string & bundleName,bool isAllBundle,std::vector<std::string> & results)842 virtual ErrCode CopyAp(const std::string &bundleName, bool isAllBundle, std::vector<std::string> &results) 843 { 844 return ERR_BUNDLE_MANAGER_INTERNAL_ERROR; 845 } 846 /** 847 * @brief Checks whether a specified application is enabled. 848 * @param bundleName Indicates the bundle name of the application. 849 * @param isEnable Indicates the application status is enabled. 850 * @return Returns result of the operation. 851 */ IsApplicationEnabled(const std::string & bundleName,bool & isEnable)852 virtual ErrCode IsApplicationEnabled(const std::string &bundleName, bool &isEnable) 853 { 854 return ERR_OK; 855 } 856 /** 857 * @brief Checks whether a specified clone application is enabled. 858 * @param bundleName Indicates the bundle name of the application. 859 * @param appIndex Indicates the app index of clone applications. 860 * @param isEnable Indicates the application status is enabled. 861 * @return Returns result of the operation. 862 */ IsCloneApplicationEnabled(const std::string & bundleName,int32_t appIndex,bool & isEnable)863 virtual ErrCode IsCloneApplicationEnabled(const std::string &bundleName, int32_t appIndex, bool &isEnable) 864 { 865 return ERR_OK; 866 } 867 /** 868 * @brief Sets whether to enable a specified application. 869 * @param bundleName Indicates the bundle name of the application. 870 * @param isEnable Specifies whether to enable the application. 871 * The value true means to enable it, and the value false means to disable it. 872 * @param userId description the user id. 873 * @return Returns result of the operation. 874 */ 875 virtual ErrCode SetApplicationEnabled(const std::string &bundleName, bool isEnable, 876 int32_t userId = Constants::UNSPECIFIED_USERID) 877 { 878 return ERR_OK; 879 } 880 /** 881 * @brief Sets whether to enable a specified clone application. 882 * @param bundleName Indicates the bundle name of the application. 883 * @param appIndex Indicates the app index of clone applications. 884 * @param isEnable Specifies whether to enable the application. 885 * The value true means to enable it, and the value false means to disable it. 886 * @param userId description the user id. 887 * @return Returns result of the operation. 888 */ 889 virtual ErrCode SetCloneApplicationEnabled(const std::string &bundleName, int32_t appIndex, bool isEnable, 890 int32_t userId = Constants::UNSPECIFIED_USERID) 891 { 892 return ERR_OK; 893 } 894 /** 895 * @brief Sets whether to enable a specified ability. 896 * @param abilityInfo Indicates information about the ability to check. 897 * @param isEnable Indicates the ability status is enabled. 898 * @return Returns result of the operation. 899 */ IsAbilityEnabled(const AbilityInfo & abilityInfo,bool & isEnable)900 virtual ErrCode IsAbilityEnabled(const AbilityInfo &abilityInfo, bool &isEnable) 901 { 902 return ERR_OK; 903 } 904 /** 905 * @brief Sets whether to enable a specified ability. 906 * @param abilityInfo Indicates information about the ability to check. 907 * @param appIndex Indicates the app index of clone applications. 908 * @param isEnable Indicates the ability status is enabled. 909 * @return Returns result of the operation. 910 */ IsCloneAbilityEnabled(const AbilityInfo & abilityInfo,int32_t appIndex,bool & isEnable)911 virtual ErrCode IsCloneAbilityEnabled(const AbilityInfo &abilityInfo, int32_t appIndex, bool &isEnable) 912 { 913 return ERR_OK; 914 } 915 /** 916 * @brief Sets whether to enable a specified ability. 917 * @param abilityInfo Indicates information about the ability. 918 * @param isEnabled Specifies whether to enable the ability. 919 * The value true means to enable it, and the value false means to disable it. 920 * @param userId description the user id. 921 * @return Returns result of the operation. 922 */ 923 virtual ErrCode SetAbilityEnabled(const AbilityInfo &abilityInfo, bool isEnabled, 924 int32_t userId = Constants::UNSPECIFIED_USERID) 925 { 926 return ERR_OK; 927 } 928 /** 929 * @brief Sets whether to enable a specified ability. 930 * @param abilityInfo Indicates information about the ability. 931 * @param appIndex Indicates the app index of clone applications. 932 * @param isEnabled Specifies whether to enable the ability. 933 * The value true means to enable it, and the value false means to disable it. 934 * @param userId description the user id. 935 * @return Returns result of the operation. 936 */ 937 virtual ErrCode SetCloneAbilityEnabled(const AbilityInfo &abilityInfo, int32_t appIndex, bool isEnabled, 938 int32_t userId = Constants::UNSPECIFIED_USERID) 939 { 940 return ERR_OK; 941 } 942 /** 943 * @brief Obtains the FormInfo objects provided by all applications on the device. 944 * @param formInfo list of FormInfo objects if obtained; returns an empty List if no FormInfo is available on the 945 * device. 946 * @return Returns true if this function is successfully called; returns false otherwise. 947 */ GetAllFormsInfo(std::vector<FormInfo> & formInfos)948 virtual bool GetAllFormsInfo(std::vector<FormInfo> &formInfos) 949 { 950 return false; 951 } 952 /** 953 * @brief Obtains the FormInfo objects provided by a specified application on the device. 954 * @param bundleName Indicates the bundle name of the application. 955 * @param formInfo list of FormInfo objects if obtained; returns an empty List if no FormInfo is available on the 956 * device. 957 * @return Returns true if this function is successfully called; returns false otherwise. 958 */ GetFormsInfoByApp(const std::string & bundleName,std::vector<FormInfo> & formInfos)959 virtual bool GetFormsInfoByApp(const std::string &bundleName, std::vector<FormInfo> &formInfos) 960 { 961 return false; 962 } 963 /** 964 * @brief Obtains the FormInfo objects provided by a specified. 965 * @param formInfo list of FormInfo objects if obtained; returns an empty List if no FormInfo is available on the 966 * device. 967 * @param moduleName Indicates the module name of the application. 968 * @param bundleName Indicates the bundle name of the application. 969 * @return Returns true if this function is successfully called; returns false otherwise. 970 */ GetFormsInfoByModule(const std::string & bundleName,const std::string & moduleName,std::vector<FormInfo> & formInfos)971 virtual bool GetFormsInfoByModule( 972 const std::string &bundleName, const std::string &moduleName, std::vector<FormInfo> &formInfos) 973 { 974 return false; 975 } 976 /** 977 * @brief Obtains the ShortcutInfo objects provided by a specified application on the device. 978 * @param bundleName Indicates the bundle name of the application. 979 * @param shortcutInfos List of ShortcutInfo objects if obtained. 980 * @return Returns true if this function is successfully called; returns false otherwise. 981 */ GetShortcutInfos(const std::string & bundleName,std::vector<ShortcutInfo> & shortcutInfos)982 virtual bool GetShortcutInfos(const std::string &bundleName, std::vector<ShortcutInfo> &shortcutInfos) 983 { 984 return false; 985 } 986 987 virtual ErrCode GetShortcutInfoV9(const std::string &bundleName, 988 std::vector<ShortcutInfo> &shortcutInfos, int32_t userId = Constants::UNSPECIFIED_USERID) 989 { 990 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 991 } 992 /** 993 * @brief Obtains the CommonEventInfo objects provided by an event key on the device. 994 * @param eventKey Indicates the event of the subscribe. 995 * @param commonEventInfos List of CommonEventInfo objects if obtained. 996 * @return Returns true if this function is successfully called; returns false otherwise. 997 */ GetAllCommonEventInfo(const std::string & eventKey,std::vector<CommonEventInfo> & commonEventInfos)998 virtual bool GetAllCommonEventInfo(const std::string &eventKey, std::vector<CommonEventInfo> &commonEventInfos) 999 { 1000 return false; 1001 } 1002 /** 1003 * @brief Obtains the interface used to install and uninstall bundles. 1004 * @return Returns a pointer to IBundleInstaller class if exist; returns nullptr otherwise. 1005 */ GetBundleInstaller()1006 virtual sptr<IBundleInstaller> GetBundleInstaller() 1007 { 1008 return nullptr; 1009 } 1010 /** 1011 * @brief Obtains the interface used to create or delete user. 1012 * @return Returns a pointer to IBundleUserMgr class if exist; returns nullptr otherwise. 1013 */ GetBundleUserMgr()1014 virtual sptr<IBundleUserMgr> GetBundleUserMgr() 1015 { 1016 return nullptr; 1017 } 1018 /** 1019 * @brief Obtains the VerifyManager. 1020 * @return Returns a pointer to VerifyManager class if exist; returns nullptr otherwise. 1021 */ GetVerifyManager()1022 virtual sptr<IVerifyManager> GetVerifyManager() 1023 { 1024 return nullptr; 1025 } 1026 /** 1027 * @brief Obtains the DistributedBundleInfo based on a given bundle name and networkId. 1028 * @param networkId Indicates the networkId of remote device. 1029 * @param bundleName Indicates the application bundle name to be queried. 1030 * @param distributedBundleInfo Indicates the obtained DistributedBundleInfo object. 1031 * @return Returns true if the DistributedBundleInfo is successfully obtained; returns false otherwise. 1032 */ GetDistributedBundleInfo(const std::string & networkId,const std::string & bundleName,DistributedBundleInfo & distributedBundleInfo)1033 virtual bool GetDistributedBundleInfo(const std::string &networkId, const std::string &bundleName, 1034 DistributedBundleInfo &distributedBundleInfo) 1035 { 1036 return false; 1037 } 1038 /** 1039 * @brief Get app privilege level. 1040 * @param bundleName Indicates the bundle name of the app privilege level. 1041 * @param userId Indicates the user id. 1042 * @return Returns app privilege level. 1043 */ 1044 virtual std::string GetAppPrivilegeLevel( 1045 const std::string &bundleName, int32_t userId = Constants::UNSPECIFIED_USERID) 1046 { 1047 return Constants::EMPTY_STRING; 1048 } 1049 /** 1050 * @brief Query extension info. 1051 * @param Want Indicates the information of extension info. 1052 * @param flag Indicates the query flag which will fliter any specified stuff in the extension info. 1053 * @param userId Indicates the userId in the system. 1054 * @param extensionInfos Indicates the obtained extensions. 1055 * @return Returns true if this function is successfully called; returns false otherwise. 1056 */ QueryExtensionAbilityInfos(const Want & want,const int32_t & flag,const int32_t & userId,std::vector<ExtensionAbilityInfo> & extensionInfos)1057 virtual bool QueryExtensionAbilityInfos(const Want &want, const int32_t &flag, const int32_t &userId, 1058 std::vector<ExtensionAbilityInfo> &extensionInfos) 1059 { 1060 return true; 1061 } 1062 /** 1063 * @brief Query extension info. 1064 * @param Want Indicates the information of extension info. 1065 * @param flags Indicates the query flag which will filter any specified stuff in the extension info. 1066 * @param userId Indicates the userId in the system. 1067 * @param extensionInfos Indicates the obtained extensions. 1068 * @return Returns ERR_OK if this function is successfully called; returns errCode otherwise. 1069 */ QueryExtensionAbilityInfosV9(const Want & want,int32_t flags,int32_t userId,std::vector<ExtensionAbilityInfo> & extensionInfos)1070 virtual ErrCode QueryExtensionAbilityInfosV9(const Want &want, int32_t flags, int32_t userId, 1071 std::vector<ExtensionAbilityInfo> &extensionInfos) 1072 { 1073 return ERR_BUNDLE_MANAGER_INTERNAL_ERROR; 1074 } 1075 /** 1076 * @brief Query extension info. 1077 * @param Want Indicates the information of extension info. 1078 * @param extensionType Indicates the type of the extension. 1079 * @param flag Indicates the query flag which will fliter any specified stuff in the extension info. 1080 * @param userId Indicates the userId in the system. 1081 * @param extensionInfos Indicates the obtained extensions. 1082 * @return Returns true if this function is successfully called; returns false otherwise. 1083 */ QueryExtensionAbilityInfos(const Want & want,const ExtensionAbilityType & extensionType,const int32_t & flag,const int32_t & userId,std::vector<ExtensionAbilityInfo> & extensionInfos)1084 virtual bool QueryExtensionAbilityInfos(const Want &want, const ExtensionAbilityType &extensionType, 1085 const int32_t &flag, const int32_t &userId, std::vector<ExtensionAbilityInfo> &extensionInfos) 1086 { 1087 return true; 1088 } 1089 /** 1090 * @brief Query extension info. 1091 * @param Want Indicates the information of extension info. 1092 * @param extensionType Indicates the type of the extension. 1093 * @param flags Indicates the query flag which will filter any specified stuff in the extension info. 1094 * @param userId Indicates the userId in the system. 1095 * @param extensionInfos Indicates the obtained extensions. 1096 * @return Returns ERR_OK if this function is successfully called; returns errCode otherwise. 1097 */ QueryExtensionAbilityInfosV9(const Want & want,const ExtensionAbilityType & extensionType,int32_t flags,int32_t userId,std::vector<ExtensionAbilityInfo> & extensionInfos)1098 virtual ErrCode QueryExtensionAbilityInfosV9(const Want &want, const ExtensionAbilityType &extensionType, 1099 int32_t flags, int32_t userId, std::vector<ExtensionAbilityInfo> &extensionInfos) 1100 { 1101 return ERR_BUNDLE_MANAGER_INTERNAL_ERROR; 1102 } QueryExtensionAbilityInfos(const ExtensionAbilityType & extensionType,const int32_t & userId,std::vector<ExtensionAbilityInfo> & extensionInfos)1103 virtual bool QueryExtensionAbilityInfos(const ExtensionAbilityType &extensionType, const int32_t &userId, 1104 std::vector<ExtensionAbilityInfo> &extensionInfos) 1105 { 1106 return true; 1107 } 1108 VerifyCallingPermission(const std::string & permission)1109 virtual bool VerifyCallingPermission(const std::string &permission) 1110 { 1111 return true; 1112 } 1113 1114 /** 1115 * @brief Verify whether the calling app is system app. Only for BMS usage. 1116 * 1117 * @param beginApiVersion Indicates version since this api became to be system api. 1118 * @param bundleName Indicates bundle name of the calling hap. 1119 * @return Returns true if the hap passes the verification; returns false otherwise. 1120 */ 1121 virtual bool VerifySystemApi(int32_t beginApiVersion = Constants::INVALID_API_VERSION) 1122 { 1123 return true; 1124 } 1125 1126 /** 1127 * @brief Obtains the dependent module names. 1128 * 1129 * @param bundleName Indicates the bundle name to be queried. 1130 * @param moduleName Indicates the module name to be queried. 1131 * @param dependentModuleNames Indicates the obtained dependent module names. 1132 * @return Returns true if this function is successfully called; returns false otherwise. 1133 */ GetAllDependentModuleNames(const std::string & bundleName,const std::string & moduleName,std::vector<std::string> & dependentModuleNames)1134 virtual bool GetAllDependentModuleNames(const std::string &bundleName, const std::string &moduleName, 1135 std::vector<std::string> &dependentModuleNames) 1136 { 1137 return false; 1138 } 1139 QueryExtensionAbilityInfoByUri(const std::string & uri,int32_t userId,ExtensionAbilityInfo & extensionAbilityInfo)1140 virtual bool QueryExtensionAbilityInfoByUri(const std::string &uri, int32_t userId, 1141 ExtensionAbilityInfo &extensionAbilityInfo) 1142 { 1143 return false; 1144 } 1145 ImplicitQueryInfoByPriority(const Want & want,int32_t flags,int32_t userId,AbilityInfo & abilityInfo,ExtensionAbilityInfo & extensionInfo)1146 virtual bool ImplicitQueryInfoByPriority(const Want &want, int32_t flags, int32_t userId, 1147 AbilityInfo &abilityInfo, ExtensionAbilityInfo &extensionInfo) 1148 { 1149 return false; 1150 } 1151 ImplicitQueryInfos(const Want & want,int32_t flags,int32_t userId,bool withDefault,std::vector<AbilityInfo> & abilityInfos,std::vector<ExtensionAbilityInfo> & extensionInfos,bool & findDefaultApp)1152 virtual bool ImplicitQueryInfos(const Want &want, int32_t flags, int32_t userId, bool withDefault, 1153 std::vector<AbilityInfo> &abilityInfos, std::vector<ExtensionAbilityInfo> &extensionInfos, 1154 bool &findDefaultApp) 1155 { 1156 return false; 1157 } 1158 1159 /** 1160 * @brief Obtains the AbilityInfo based on a given bundle name. 1161 * @param bundleName Indicates the bundle name to be queried. 1162 * @param abilityName Indicates the ability name to be queried. 1163 * @param abilityInfo Indicates the obtained AbilityInfo object. 1164 * @return Returns true if the abilityInfo is successfully obtained; returns false otherwise. 1165 */ GetAbilityInfo(const std::string & bundleName,const std::string & abilityName,AbilityInfo & abilityInfo)1166 virtual bool GetAbilityInfo( 1167 const std::string &bundleName, const std::string &abilityName, AbilityInfo &abilityInfo) 1168 { 1169 return false; 1170 } 1171 /** 1172 * @brief Obtains the AbilityInfo based on a given bundle name. 1173 * @param bundleName Indicates the bundle name to be queried. 1174 * @param moduleName Indicates the module name to be queried. 1175 * @param abilityName Indicates the ability name to be queried. 1176 * @param abilityInfo Indicates the obtained AbilityInfo object. 1177 * @return Returns true if the abilityInfo is successfully obtained; returns false otherwise. 1178 */ GetAbilityInfo(const std::string & bundleName,const std::string & moduleName,const std::string & abilityName,AbilityInfo & abilityInfo)1179 virtual bool GetAbilityInfo( 1180 const std::string &bundleName, const std::string &moduleName, 1181 const std::string &abilityName, AbilityInfo &abilityInfo) 1182 { 1183 return false; 1184 } 1185 /** 1186 * @brief Obtain sandbox application bundleInfo. 1187 * @param bundleName Indicates the bundle name of the sandbox application to be install. 1188 * @param appIndex Indicates application index of the sandbox application. 1189 * @param userId Indicates the sandbox application is installed under which user id. 1190 * @return Returns ERR_OK if the get sandbox application budnelInfo successfully; returns errcode otherwise. 1191 */ GetSandboxBundleInfo(const std::string & bundleName,int32_t appIndex,int32_t userId,BundleInfo & info)1192 virtual ErrCode GetSandboxBundleInfo( 1193 const std::string &bundleName, int32_t appIndex, int32_t userId, BundleInfo &info) 1194 { 1195 return ERR_APPEXECFWK_SANDBOX_INSTALL_INTERNAL_ERROR; 1196 } 1197 1198 /** 1199 * @brief Obtains the value of upgradeFlag based on a given bundle name and module name. 1200 * @param bundleName Indicates the bundle name to be queried. 1201 * @param moduleName Indicates the module name to be queried. 1202 * @return Returns true if the isRemovable is successfully obtained; returns false otherwise. 1203 */ GetModuleUpgradeFlag(const std::string & bundleName,const std::string & moduleName)1204 virtual bool GetModuleUpgradeFlag(const std::string &bundleName, const std::string &moduleName) 1205 { 1206 return false; 1207 } 1208 /** 1209 * @brief Sets whether to enable upgradeFlag based on a given bundle name and module name. 1210 * @param bundleName Indicates the bundle name to be queried. 1211 * @param moduleName Indicates the module name to be queried. 1212 * @param isEnable Specifies whether to enable the isRemovable of InnerModuleInfo. 1213 * The value true means to enable it, and the value false means to disable it 1214 * @return Returns ERR_OK if the isRemovable is successfully obtained; returns ErrCode otherwise. 1215 */ SetModuleUpgradeFlag(const std::string & bundleName,const std::string & moduleName,int32_t upgradeFlag)1216 virtual ErrCode SetModuleUpgradeFlag( 1217 const std::string &bundleName, const std::string &moduleName, int32_t upgradeFlag) 1218 { 1219 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 1220 } 1221 CheckAbilityEnableInstall(const Want & want,int32_t missionId,int32_t userId,const sptr<IRemoteObject> & callback)1222 virtual bool CheckAbilityEnableInstall( 1223 const Want &want, int32_t missionId, int32_t userId, const sptr<IRemoteObject> &callback) 1224 { 1225 return false; 1226 } 1227 ObtainCallingBundleName(std::string & bundleName)1228 virtual bool ObtainCallingBundleName(std::string &bundleName) 1229 { 1230 return false; 1231 } 1232 GetDefaultAppProxy()1233 virtual sptr<IDefaultApp> GetDefaultAppProxy() 1234 { 1235 return nullptr; 1236 } 1237 GetAppControlProxy()1238 virtual sptr<IAppControlMgr> GetAppControlProxy() 1239 { 1240 return nullptr; 1241 } 1242 1243 virtual bool GetBundleStats(const std::string &bundleName, int32_t userId, std::vector<int64_t> &bundleStats, 1244 int32_t appIndex = 0, uint32_t statFlag = 0) 1245 { 1246 return false; 1247 } 1248 GetAllBundleStats(int32_t userId,std::vector<int64_t> & bundleStats)1249 virtual bool GetAllBundleStats(int32_t userId, std::vector<int64_t> &bundleStats) 1250 { 1251 return false; 1252 } 1253 GetAllBundleCacheStat(const sptr<IProcessCacheCallback> processCacheCallback)1254 virtual ErrCode GetAllBundleCacheStat(const sptr<IProcessCacheCallback> processCacheCallback) 1255 { 1256 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 1257 } 1258 CleanAllBundleCache(const sptr<IProcessCacheCallback> processCacheCallback)1259 virtual ErrCode CleanAllBundleCache(const sptr<IProcessCacheCallback> processCacheCallback) 1260 { 1261 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 1262 } 1263 GetExtendResourceManager()1264 virtual sptr<IExtendResourceManager> GetExtendResourceManager() 1265 { 1266 return nullptr; 1267 } 1268 GetSandboxAbilityInfo(const Want & want,int32_t appIndex,int32_t flags,int32_t userId,AbilityInfo & info)1269 virtual ErrCode GetSandboxAbilityInfo(const Want &want, int32_t appIndex, int32_t flags, int32_t userId, 1270 AbilityInfo &info) 1271 { 1272 return ERR_APPEXECFWK_SANDBOX_QUERY_PARAM_ERROR; 1273 } 1274 GetSandboxExtAbilityInfos(const Want & want,int32_t appIndex,int32_t flags,int32_t userId,std::vector<ExtensionAbilityInfo> & einfos)1275 virtual ErrCode GetSandboxExtAbilityInfos(const Want &want, int32_t appIndex, int32_t flags, int32_t userId, 1276 std::vector<ExtensionAbilityInfo> &einfos) 1277 { 1278 return ERR_APPEXECFWK_SANDBOX_QUERY_PARAM_ERROR; 1279 } 1280 GetSandboxHapModuleInfo(const AbilityInfo & abilityInfo,int32_t appIndex,int32_t userId,HapModuleInfo & info)1281 virtual ErrCode GetSandboxHapModuleInfo(const AbilityInfo &abilityInfo, int32_t appIndex, int32_t userId, 1282 HapModuleInfo &info) 1283 { 1284 return ERR_APPEXECFWK_SANDBOX_QUERY_PARAM_ERROR; 1285 } 1286 1287 virtual ErrCode GetMediaData(const std::string &bundleName, const std::string &moduleName, 1288 const std::string &abilityName, std::unique_ptr<uint8_t[]> &mediaDataPtr, size_t &len, 1289 int32_t userId = Constants::UNSPECIFIED_USERID) 1290 { 1291 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 1292 } 1293 GetQuickFixManagerProxy()1294 virtual sptr<IQuickFixManager> GetQuickFixManagerProxy() 1295 { 1296 return nullptr; 1297 } 1298 1299 virtual std::string GetStringById(const std::string &bundleName, const std::string &moduleName, uint32_t resId, 1300 int32_t userId, const std::string &localeInfo = Constants::EMPTY_STRING) 1301 { 1302 return Constants::EMPTY_STRING; 1303 } 1304 GetIconById(const std::string & bundleName,const std::string & moduleName,uint32_t resId,uint32_t density,int32_t userId)1305 virtual std::string GetIconById( 1306 const std::string &bundleName, const std::string &moduleName, uint32_t resId, uint32_t density, int32_t userId) 1307 { 1308 return Constants::EMPTY_STRING; 1309 } 1310 SetDebugMode(bool isDebug)1311 virtual ErrCode SetDebugMode(bool isDebug) 1312 { 1313 return ERR_BUNDLEMANAGER_SET_DEBUG_MODE_INTERNAL_ERROR; 1314 } 1315 GetOverlayManagerProxy()1316 virtual sptr<IOverlayManager> GetOverlayManagerProxy() 1317 { 1318 return nullptr; 1319 } 1320 ProcessPreload(const Want & want)1321 virtual bool ProcessPreload(const Want &want) 1322 { 1323 return false; 1324 } 1325 GetAppProvisionInfo(const std::string & bundleName,int32_t userId,AppProvisionInfo & appProvisionInfo)1326 virtual ErrCode GetAppProvisionInfo(const std::string &bundleName, int32_t userId, 1327 AppProvisionInfo &appProvisionInfo) 1328 { 1329 return ERR_OK; 1330 } 1331 GetProvisionMetadata(const std::string & bundleName,int32_t userId,std::vector<Metadata> & provisionMetadatas)1332 virtual ErrCode GetProvisionMetadata(const std::string &bundleName, int32_t userId, 1333 std::vector<Metadata> &provisionMetadatas) 1334 { 1335 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 1336 } 1337 1338 virtual ErrCode GetBaseSharedBundleInfos(const std::string &bundleName, 1339 std::vector<BaseSharedBundleInfo> &baseSharedBundleInfos, 1340 GetDependentBundleInfoFlag flag = GetDependentBundleInfoFlag::GET_APP_CROSS_HSP_BUNDLE_INFO) 1341 { 1342 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 1343 } 1344 GetAllSharedBundleInfo(std::vector<SharedBundleInfo> & sharedBundles)1345 virtual ErrCode GetAllSharedBundleInfo(std::vector<SharedBundleInfo> &sharedBundles) 1346 { 1347 return ERR_OK; 1348 } 1349 GetSharedBundleInfo(const std::string & bundleName,const std::string & moduleName,std::vector<SharedBundleInfo> & sharedBundles)1350 virtual ErrCode GetSharedBundleInfo(const std::string &bundleName, const std::string &moduleName, 1351 std::vector<SharedBundleInfo> &sharedBundles) 1352 { 1353 return ERR_OK; 1354 } 1355 GetSharedBundleInfoBySelf(const std::string & bundleName,SharedBundleInfo & sharedBundleInfo)1356 virtual ErrCode GetSharedBundleInfoBySelf(const std::string &bundleName, SharedBundleInfo &sharedBundleInfo) 1357 { 1358 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 1359 } 1360 GetSharedDependencies(const std::string & bundleName,const std::string & moduleName,std::vector<Dependency> & dependencies)1361 virtual ErrCode GetSharedDependencies(const std::string &bundleName, const std::string &moduleName, 1362 std::vector<Dependency> &dependencies) 1363 { 1364 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 1365 } 1366 1367 virtual ErrCode GetAllProxyDataInfos( 1368 std::vector<ProxyData> &proxyDatas, int32_t userId = Constants::UNSPECIFIED_USERID) 1369 { 1370 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 1371 } 1372 1373 virtual ErrCode GetProxyDataInfos(const std::string &bundleName, const std::string &moduleName, 1374 std::vector<ProxyData> &proxyDatas, int32_t userId = Constants::UNSPECIFIED_USERID) 1375 { 1376 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 1377 } 1378 GetSpecifiedDistributionType(const std::string & bundleName,std::string & specifiedDistributionType)1379 virtual ErrCode GetSpecifiedDistributionType(const std::string &bundleName, std::string &specifiedDistributionType) 1380 { 1381 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 1382 } 1383 GetAdditionalInfo(const std::string & bundleName,std::string & additionalInfo)1384 virtual ErrCode GetAdditionalInfo(const std::string &bundleName, std::string &additionalInfo) 1385 { 1386 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 1387 } 1388 SetExtNameOrMIMEToApp(const std::string & bundleName,const std::string & moduleName,const std::string & abilityName,const std::string & extName,const std::string & mimeType)1389 virtual ErrCode SetExtNameOrMIMEToApp(const std::string &bundleName, const std::string &moduleName, 1390 const std::string &abilityName, const std::string &extName, const std::string &mimeType) 1391 { 1392 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 1393 } 1394 DelExtNameOrMIMEToApp(const std::string & bundleName,const std::string & moduleName,const std::string & abilityName,const std::string & extName,const std::string & mimeType)1395 virtual ErrCode DelExtNameOrMIMEToApp(const std::string &bundleName, const std::string &moduleName, 1396 const std::string &abilityName, const std::string &extName, const std::string &mimeType) 1397 { 1398 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 1399 } 1400 QueryDataGroupInfos(const std::string & bundleName,int32_t userId,std::vector<DataGroupInfo> & infos)1401 virtual bool QueryDataGroupInfos(const std::string &bundleName, int32_t userId, std::vector<DataGroupInfo> &infos) 1402 { 1403 return false; 1404 } 1405 GetGroupDir(const std::string & dataGroupId,std::string & dir)1406 virtual bool GetGroupDir(const std::string &dataGroupId, std::string &dir) 1407 { 1408 return false; 1409 } 1410 QueryAppGalleryBundleName(std::string & bundleName)1411 virtual bool QueryAppGalleryBundleName(std::string &bundleName) 1412 { 1413 return false; 1414 } 1415 1416 /** 1417 * @brief Query extension info with type name. 1418 * @param Want Indicates the information of extension info. 1419 * @param extensionTypeName Indicates the type of the extension. 1420 * @param flag Indicates the query flag which will fliter any specified stuff in the extension info. 1421 * @param userId Indicates the userId in the system. 1422 * @param extensionInfos Indicates the obtained extensions. 1423 * @return Returns ERR_OK if this function is successfully called; returns other ErrCode otherwise. 1424 */ QueryExtensionAbilityInfosWithTypeName(const Want & want,const std::string & extensionTypeName,const int32_t flag,const int32_t userId,std::vector<ExtensionAbilityInfo> & extensionInfos)1425 virtual ErrCode QueryExtensionAbilityInfosWithTypeName(const Want &want, const std::string &extensionTypeName, 1426 const int32_t flag, const int32_t userId, std::vector<ExtensionAbilityInfo> &extensionInfos) 1427 { 1428 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 1429 } 1430 1431 /** 1432 * @brief Query extension info only with type name. 1433 * @param extensionTypeName Indicates the type of the extension. 1434 * @param flag Indicates the query flag which will fliter any specified stuff in the extension info. 1435 * @param userId Indicates the userId in the system. 1436 * @param extensionInfos Indicates the obtained extensions. 1437 * @return Returns ERR_OK if this function is successfully called; returns other ErrCode otherwise. 1438 */ QueryExtensionAbilityInfosOnlyWithTypeName(const std::string & extensionTypeName,const uint32_t flag,const int32_t userId,std::vector<ExtensionAbilityInfo> & extensionInfos)1439 virtual ErrCode QueryExtensionAbilityInfosOnlyWithTypeName(const std::string &extensionTypeName, 1440 const uint32_t flag, const int32_t userId, std::vector<ExtensionAbilityInfo> &extensionInfos) 1441 { 1442 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 1443 } 1444 ResetAOTCompileStatus(const std::string & bundleName,const std::string & moduleName,int32_t triggerMode)1445 virtual ErrCode ResetAOTCompileStatus(const std::string &bundleName, const std::string &moduleName, 1446 int32_t triggerMode) 1447 { 1448 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 1449 } 1450 1451 virtual ErrCode GetJsonProfile(ProfileType profileType, const std::string &bundleName, 1452 const std::string &moduleName, std::string &profile, int32_t userId = Constants::UNSPECIFIED_USERID) 1453 { 1454 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 1455 } 1456 GetBundleResourceProxy()1457 virtual sptr<IBundleResource> GetBundleResourceProxy() 1458 { 1459 return nullptr; 1460 } 1461 GetRecoverableApplicationInfo(std::vector<RecoverableApplicationInfo> & recoverableApplications)1462 virtual ErrCode GetRecoverableApplicationInfo(std::vector<RecoverableApplicationInfo> &recoverableApplications) 1463 { 1464 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 1465 } 1466 GetUninstalledBundleInfo(const std::string bundleName,BundleInfo & bundleInfo)1467 virtual ErrCode GetUninstalledBundleInfo(const std::string bundleName, BundleInfo &bundleInfo) 1468 { 1469 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 1470 } 1471 SetAdditionalInfo(const std::string & bundleName,const std::string & additionalInfo)1472 virtual ErrCode SetAdditionalInfo(const std::string &bundleName, const std::string &additionalInfo) 1473 { 1474 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 1475 } 1476 CreateBundleDataDir(int32_t userId)1477 virtual ErrCode CreateBundleDataDir(int32_t userId) 1478 { 1479 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 1480 } 1481 CreateBundleDataDirWithEl(int32_t userId,DataDirEl dirEl)1482 virtual ErrCode CreateBundleDataDirWithEl(int32_t userId, DataDirEl dirEl) 1483 { 1484 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 1485 } 1486 1487 /** 1488 * @brief Get preinstalled application infos. 1489 * @param preinstalledApplicationInfos Indicates all of the obtained PreinstalledApplicationInfo objects. 1490 * @return Returns ERR_OK if this function is successfully called; returns other ErrCode otherwise. 1491 */ GetAllPreinstalledApplicationInfos(std::vector<PreinstalledApplicationInfo> & preinstalledApplicationInfos)1492 virtual ErrCode GetAllPreinstalledApplicationInfos( 1493 std::vector<PreinstalledApplicationInfo> &preinstalledApplicationInfos) 1494 { 1495 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 1496 } 1497 1498 /** 1499 * @brief Check whether the link can be opened. 1500 * @param link link Indicates the link to be opened. 1501 * @param canOpen Indicates whether the link can be opened. 1502 * @return Returns result of the operation. 1503 */ CanOpenLink(const std::string & link,bool & canOpen)1504 virtual ErrCode CanOpenLink( 1505 const std::string &link, bool &canOpen) 1506 { 1507 return ERR_BUNDLE_MANAGER_INTERNAL_ERROR; 1508 } 1509 GetOdid(std::string & odid)1510 virtual ErrCode GetOdid(std::string &odid) 1511 { 1512 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 1513 } 1514 1515 virtual ErrCode GetAllBundleInfoByDeveloperId(const std::string &developerId, 1516 std::vector<BundleInfo> &bundleInfos, int32_t userId = Constants::UNSPECIFIED_USERID) 1517 { 1518 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 1519 } 1520 1521 virtual ErrCode GetDeveloperIds(const std::string &appDistributionType, 1522 std::vector<std::string> &developerIdList, int32_t userId = Constants::UNSPECIFIED_USERID) 1523 { 1524 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 1525 } 1526 1527 virtual ErrCode SwitchUninstallState(const std::string &bundleName, const bool &state, 1528 bool isNeedSendNotify = true) 1529 { 1530 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 1531 } 1532 1533 virtual ErrCode QueryAbilityInfoByContinueType(const std::string &bundleName, const std::string &continueType, 1534 AbilityInfo &abilityInfo, int32_t userId = Constants::UNSPECIFIED_USERID) 1535 { 1536 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 1537 } 1538 QueryCloneAbilityInfo(const ElementName & element,int32_t flags,int32_t appIndex,AbilityInfo & abilityInfo,int32_t userId)1539 virtual ErrCode QueryCloneAbilityInfo(const ElementName &element, 1540 int32_t flags, int32_t appIndex, AbilityInfo &abilityInfo, int32_t userId) 1541 { 1542 return ERR_BUNDLE_MANAGER_INTERNAL_ERROR; 1543 } 1544 1545 virtual ErrCode GetCloneBundleInfo(const std::string &bundleName, int32_t flag, int32_t appIndex, 1546 BundleInfo &bundleInfo, int32_t userId = Constants::UNSPECIFIED_USERID) 1547 { 1548 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 1549 } 1550 1551 virtual ErrCode GetCloneAppIndexes(const std::string &bundleName, std::vector<int32_t> &appIndexes, 1552 int32_t userId = Constants::UNSPECIFIED_USERID) 1553 { 1554 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 1555 } 1556 GetLaunchWant(Want & want)1557 virtual ErrCode GetLaunchWant(Want &want) 1558 { 1559 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 1560 } 1561 1562 virtual ErrCode QueryCloneExtensionAbilityInfoWithAppIndex(const ElementName &elementName, int32_t flags, 1563 int32_t appIndex, ExtensionAbilityInfo &extensionAbilityInfo, 1564 int32_t userId = Constants::UNSPECIFIED_USERID) 1565 { 1566 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 1567 } 1568 GetSignatureInfoByBundleName(const std::string & bundleName,SignatureInfo & signatureInfo)1569 virtual ErrCode GetSignatureInfoByBundleName(const std::string &bundleName, SignatureInfo &signatureInfo) 1570 { 1571 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 1572 } 1573 AddDesktopShortcutInfo(const ShortcutInfo & shortcutInfo,int32_t userId)1574 virtual ErrCode AddDesktopShortcutInfo(const ShortcutInfo &shortcutInfo, int32_t userId) 1575 { 1576 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 1577 } 1578 DeleteDesktopShortcutInfo(const ShortcutInfo & shortcutInfo,int32_t userId)1579 virtual ErrCode DeleteDesktopShortcutInfo(const ShortcutInfo &shortcutInfo, int32_t userId) 1580 { 1581 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 1582 } 1583 GetAllDesktopShortcutInfo(int32_t userId,std::vector<ShortcutInfo> & shortcutInfos)1584 virtual ErrCode GetAllDesktopShortcutInfo(int32_t userId, std::vector<ShortcutInfo> &shortcutInfos) 1585 { 1586 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 1587 } 1588 GetCompatibleDeviceTypeNative(std::string & deviceType)1589 virtual ErrCode GetCompatibleDeviceTypeNative(std::string &deviceType) 1590 { 1591 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 1592 } 1593 GetCompatibleDeviceType(const std::string & bundleName,std::string & deviceType)1594 virtual ErrCode GetCompatibleDeviceType(const std::string &bundleName, std::string &deviceType) 1595 { 1596 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 1597 } 1598 GetOdidByBundleName(const std::string & bundleName,std::string & odid)1599 virtual ErrCode GetOdidByBundleName(const std::string &bundleName, std::string &odid) 1600 { 1601 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 1602 } 1603 1604 /** 1605 * @brief Obtains BundleInfo of all continuable bundles available in the system. 1606 * @param flags Indicates the flag used to specify information contained in the BundleInfo that will be returned. 1607 * @param bundleInfos Indicates all of the obtained BundleInfo objects. 1608 * @param userId Indicates the user ID. 1609 * @return Returns true if the BundleInfos is successfully obtained; returns false otherwise. 1610 */ 1611 virtual bool GetBundleInfosForContinuation(int32_t flags, 1612 std::vector<BundleInfo> &bundleInfos, int32_t userId = Constants::UNSPECIFIED_USERID) 1613 { 1614 return false; 1615 } 1616 1617 /** 1618 * @brief Get a list of application package names that continue the specified package name. 1619 * @param continueBundleName The package name that is being continued. 1620 * @param bundleNames Continue the list of specified package names. 1621 * @param userId Indicates the user ID. 1622 * @return Returns ERR_OK if successfully obtained; returns error code otherwise. 1623 */ 1624 virtual ErrCode GetContinueBundleNames(const std::string &continueBundleName, std::vector<std::string> &bundleNames, 1625 int32_t userId = Constants::UNSPECIFIED_USERID) 1626 { 1627 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 1628 } 1629 IsBundleInstalled(const std::string & bundleName,int32_t userId,int32_t appIndex,bool & isInstalled)1630 virtual ErrCode IsBundleInstalled(const std::string &bundleName, int32_t userId, 1631 int32_t appIndex, bool &isInstalled) 1632 { 1633 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 1634 } 1635 GetBundleNameByAppId(const std::string & appId,std::string & bundleName)1636 virtual ErrCode GetBundleNameByAppId(const std::string &appId, std::string &bundleName) 1637 { 1638 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 1639 } 1640 GetDirByBundleNameAndAppIndex(const std::string & bundleName,const int32_t appIndex,std::string & dataDir)1641 virtual ErrCode GetDirByBundleNameAndAppIndex(const std::string &bundleName, const int32_t appIndex, 1642 std::string &dataDir) 1643 { 1644 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 1645 } 1646 GetAllBundleDirs(int32_t userId,std::vector<BundleDir> & bundleDirs)1647 virtual ErrCode GetAllBundleDirs(int32_t userId, std::vector<BundleDir> &bundleDirs) 1648 { 1649 return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR; 1650 } 1651 }; 1652 1653 #define WRITE_PARCEL(func) \ 1654 do { \ 1655 if (!(func)) { \ 1656 APP_LOGE("write parcel failed, func : %{public}s", #func); \ 1657 return ERR_APPEXECFWK_PARCEL_ERROR; \ 1658 } \ 1659 } while (0) 1660 } // namespace AppExecFwk 1661 } // namespace OHOS 1662 #endif // FOUNDATION_APPEXECFWK_INTERFACES_INNERKITS_APPEXECFWK_CORE_INCLUDE_BUNDLEMGR_BUNDLE_MGR_INTERFACE_H 1663