1 /* 2 * Copyright (c) 2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef FOUNDATION_BUNDLEMANAGER_BUNDLE_FRAMEWORK_INNERKITS_APPEXECFWK_CORE_EXT_INCLUDE_BUNDLE_MGR_EX_H 17 #define FOUNDATION_BUNDLEMANAGER_BUNDLE_FRAMEWORK_INNERKITS_APPEXECFWK_CORE_EXT_INCLUDE_BUNDLE_MGR_EX_H 18 19 #include "appexecfwk_errors.h" 20 #include "ability_info.h" 21 #include "bundle_info.h" 22 #include "bundle_resource_info.h" 23 #include "launcher_ability_resource_info.h" 24 #include "interfaces/hap_verify.h" 25 #include "parameter.h" 26 #include "want.h" 27 #include "abs_rdb_predicates.h" 28 29 namespace OHOS { 30 namespace AppExecFwk { 31 class BundleMgrExt { 32 public: 33 using Want = OHOS::AAFwk::Want; 34 35 virtual ~BundleMgrExt() = default; 36 37 virtual bool CheckApiInfo(const BundleInfo& bundleInfo) = 0; HapVerify(const std::string & filePath,Security::Verify::HapVerifyResult & hapVerifyResult)38 virtual ErrCode HapVerify(const std::string &filePath, Security::Verify::HapVerifyResult &hapVerifyResult) 39 { 40 return ERR_BUNDLEMANAGER_INSTALL_FAILED_SIGNATURE_EXTENSION_NOT_EXISTED; 41 } IsRdDevice()42 virtual bool IsRdDevice() 43 { 44 return false; 45 } QueryAbilityInfos(const Want & want,int32_t userId,std::vector<AbilityInfo> & abilityInfos)46 virtual ErrCode QueryAbilityInfos(const Want &want, int32_t userId, 47 std::vector<AbilityInfo> &abilityInfos) 48 { 49 return ERR_BUNDLE_MANAGER_INSTALL_FAILED_BUNDLE_EXTENSION_NOT_EXISTED; 50 } 51 virtual ErrCode QueryAbilityInfosWithFlag(const Want &want, int32_t flags, int32_t userId, 52 std::vector<AbilityInfo> &abilityInfos, bool isNewVersion = false) 53 { 54 return ERR_BUNDLE_MANAGER_INSTALL_FAILED_BUNDLE_EXTENSION_NOT_EXISTED; 55 } 56 virtual ErrCode GetBundleInfo(const std::string &bundleName, int32_t flags, int32_t userId, 57 BundleInfo &bundleInfo, bool isNewVersion = false) 58 { 59 return ERR_BUNDLE_MANAGER_INSTALL_FAILED_BUNDLE_EXTENSION_NOT_EXISTED; 60 } 61 virtual ErrCode GetBundleInfos(int32_t flags, std::vector<BundleInfo> &bundleInfos, int32_t userId, 62 bool isNewVersion = false) 63 { 64 return ERR_BUNDLE_MANAGER_INSTALL_FAILED_BUNDLE_EXTENSION_NOT_EXISTED; 65 } Uninstall(const std::string & bundleName)66 virtual ErrCode Uninstall(const std::string &bundleName) 67 { 68 return ERR_BUNDLE_MANAGER_INSTALL_FAILED_BUNDLE_EXTENSION_NOT_EXISTED; 69 } GetBundleStats(const std::string & bundleName,int32_t userId,std::vector<int64_t> & bundleStats)70 virtual ErrCode GetBundleStats(const std::string &bundleName, int32_t userId, std::vector<int64_t> &bundleStats) 71 { 72 return ERR_BUNDLE_MANAGER_EXTENSION_DEFAULT_ERR; 73 } ClearData(const std::string & bundleName,int32_t userId)74 virtual ErrCode ClearData(const std::string &bundleName, int32_t userId) 75 { 76 return ERR_BUNDLE_MANAGER_EXTENSION_DEFAULT_ERR; 77 } ClearCache(const std::string & bundleName,sptr<IRemoteObject> callback,int32_t userId)78 virtual ErrCode ClearCache(const std::string &bundleName, sptr<IRemoteObject> callback, int32_t userId) 79 { 80 return ERR_BUNDLE_MANAGER_EXTENSION_DEFAULT_ERR; 81 } GetUidByBundleName(const std::string & bundleName,int32_t userId,int32_t & uid)82 virtual ErrCode GetUidByBundleName(const std::string &bundleName, int32_t userId, int32_t &uid) 83 { 84 return ERR_BUNDLE_MANAGER_EXTENSION_DEFAULT_ERR; 85 } GetBundleNameByUid(int32_t uid,std::string & bundleName)86 virtual ErrCode GetBundleNameByUid(int32_t uid, std::string &bundleName) 87 { 88 return ERR_BUNDLE_MANAGER_EXTENSION_DEFAULT_ERR; 89 } VerifyActivationLock(bool & res)90 virtual ErrCode VerifyActivationLock(bool &res) 91 { 92 return ERR_BUNDLE_MANAGER_EXTENSION_DEFAULT_ERR; 93 } GetBackupUninstallList(int32_t userId,std::set<std::string> & uninstallBundles)94 virtual ErrCode GetBackupUninstallList(int32_t userId, std::set<std::string> &uninstallBundles) 95 { 96 return ERR_BUNDLE_MANAGER_EXTENSION_DEFAULT_ERR; 97 } ClearBackupUninstallFile(int32_t userId)98 virtual ErrCode ClearBackupUninstallFile(int32_t userId) 99 { 100 return ERR_BUNDLE_MANAGER_EXTENSION_DEFAULT_ERR; 101 } AddResourceInfoByBundleName(const std::string & bundleName,const int32_t userId)102 virtual ErrCode AddResourceInfoByBundleName(const std::string &bundleName, const int32_t userId) 103 { 104 return ERR_BUNDLE_MANAGER_EXTENSION_DEFAULT_ERR; 105 } AddResourceInfoByAbility(const std::string & bundleName,const std::string & moduleName,const std::string & abilityName,const int32_t userId)106 virtual ErrCode AddResourceInfoByAbility(const std::string &bundleName, const std::string &moduleName, 107 const std::string &abilityName, const int32_t userId) 108 { 109 return ERR_BUNDLE_MANAGER_EXTENSION_DEFAULT_ERR; 110 } DeleteResourceInfo(const std::string & key)111 virtual ErrCode DeleteResourceInfo(const std::string &key) 112 { 113 return ERR_BUNDLE_MANAGER_EXTENSION_DEFAULT_ERR; 114 } OptimizeDisposedPredicates(const std::string & callingName,const std::string & appId,int32_t userId,int32_t appIndex,NativeRdb::AbsRdbPredicates & absRdbPredicates)115 virtual ErrCode OptimizeDisposedPredicates(const std::string &callingName, const std::string &appId, 116 int32_t userId, int32_t appIndex, NativeRdb::AbsRdbPredicates &absRdbPredicates) 117 { 118 return ERR_BUNDLE_MANAGER_EXTENSION_DEFAULT_ERR; 119 } IsAppInBlocklist(const std::string & bundleName,const int32_t userId)120 virtual bool IsAppInBlocklist(const std::string &bundleName, const int32_t userId) 121 { 122 return false; 123 } CheckWhetherCanBeUninstalled(const std::string & bundleName)124 virtual bool CheckWhetherCanBeUninstalled(const std::string &bundleName) 125 { 126 return true; 127 } DetermineCloneNum(const std::string & bundleName,const std::string & appIdentifier,int32_t & cloneNum)128 virtual bool DetermineCloneNum(const std::string &bundleName, const std::string &appIdentifier, int32_t &cloneNum) 129 { 130 return false; 131 } 132 virtual ErrCode GetBundleResourceInfo(const std::string &bundleName, const uint32_t flags, 133 BundleResourceInfo &bundleResourceInfo, const int32_t appIndex = 0) 134 { 135 return ERR_BUNDLE_MANAGER_EXTENSION_DEFAULT_ERR; 136 } 137 virtual ErrCode GetLauncherAbilityResourceInfo(const std::string &bundleName, const uint32_t flags, 138 std::vector<LauncherAbilityResourceInfo> &launcherAbilityResourceInfo, const int32_t appIndex = 0) 139 { 140 return ERR_BUNDLE_MANAGER_EXTENSION_DEFAULT_ERR; 141 } GetAllBundleResourceInfo(const uint32_t flags,std::vector<BundleResourceInfo> & bundleResourceInfos)142 virtual ErrCode GetAllBundleResourceInfo(const uint32_t flags, std::vector<BundleResourceInfo> &bundleResourceInfos) 143 { 144 return ERR_BUNDLE_MANAGER_EXTENSION_DEFAULT_ERR; 145 } GetAllLauncherAbilityResourceInfo(const uint32_t flags,std::vector<LauncherAbilityResourceInfo> & launcherAbilityResourceInfos)146 virtual ErrCode GetAllLauncherAbilityResourceInfo(const uint32_t flags, 147 std::vector<LauncherAbilityResourceInfo> &launcherAbilityResourceInfos) 148 { 149 return ERR_BUNDLE_MANAGER_EXTENSION_DEFAULT_ERR; 150 } CheckBundleNameAndStratAbility(const std::string & bundleName,const std::string & appIdentifier)151 virtual void CheckBundleNameAndStratAbility(const std::string &bundleName, const std::string &appIdentifier) 152 { 153 return; 154 } GetCompatibleDeviceType(const std::string & bundleName)155 virtual std::string GetCompatibleDeviceType(const std::string &bundleName) 156 { 157 return GetDeviceType(); 158 } 159 }; 160 161 } // AppExecFwk 162 } // OHOS 163 164 #endif // FOUNDATION_BUNDLEMANAGER_BUNDLE_FRAMEWORK_INNERKITS_APPEXECFWK_CORE_EXT_INCLUDE_BUNDLE_MGR_EX_H