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_APPEXECFWK_SERVICES_BUNDLEMGR_INCLUDE_BMS_EXTENSION_DATA_MGR_H 17 #define FOUNDATION_APPEXECFWK_SERVICES_BUNDLEMGR_INCLUDE_BMS_EXTENSION_DATA_MGR_H 18 #include <mutex> 19 #include <string> 20 21 #include "ability_info.h" 22 #include "appexecfwk_errors.h" 23 #include "bms_extension.h" 24 #include "bundle_info.h" 25 #include "interfaces/hap_verify.h" 26 #include "want.h" 27 28 namespace OHOS { 29 namespace AppExecFwk { 30 class BmsExtensionDataMgr { 31 public: 32 using Want = OHOS::AAFwk::Want; 33 34 BmsExtensionDataMgr(); 35 bool CheckApiInfo(const BundleInfo &bundleInfo, uint32_t sdkVersion); 36 bool CheckApiInfo(uint32_t compatibleVersion, uint32_t sdkVersion); 37 ErrCode HapVerify(const std::string &filePath, Security::Verify::HapVerifyResult &hapVerifyResult); 38 ErrCode QueryAbilityInfos(const Want &want, int32_t userId, std::vector<AbilityInfo> &abilityInfos); 39 ErrCode QueryAbilityInfosWithFlag(const Want &want, int32_t flags, int32_t userId, 40 std::vector<AbilityInfo> &abilityInfos, bool isNewVersion = false); 41 ErrCode GetBundleInfos(int32_t flags, std::vector<BundleInfo> &bundleInfos, int32_t userId, 42 bool isNewVersion = false); 43 ErrCode GetBundleInfo(const std::string &bundleName, int32_t flags, int32_t userId, 44 BundleInfo &bundleInfo, bool isNewVersion = false); 45 ErrCode Uninstall(const std::string &bundleName); 46 ErrCode Init(); 47 48 private: 49 bool OpenHandler(); 50 static BmsExtension bmsExtension_; 51 static void *handler_; 52 }; 53 } // namespace AppExecFwk 54 } // namespace OHOS 55 #endif // FOUNDATION_APPEXECFWK_SERVICES_BUNDLEMGR_INCLUDE_BMS_EXTENSION_DATA_MGR_H