1 /* 2 * Copyright (c) 2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef OS_ACCOUNT_SERVICE_BUNDLE_MANAGER_ADAPTER_H 17 #define OS_ACCOUNT_SERVICE_BUNDLE_MANAGER_ADAPTER_H 18 19 #include <mutex> 20 #include <string> 21 #include "ability_info.h" 22 #include "bundle_info.h" 23 #include "want.h" 24 25 namespace OHOS { 26 namespace AccountSA { 27 class BundleManagerAdapter { 28 public: 29 BundleManagerAdapter(); 30 virtual ~BundleManagerAdapter(); 31 static std::shared_ptr<BundleManagerAdapter> GetInstance(); 32 33 bool GetBundleNameForUid(const int uid, std::string &bundleName); 34 bool GetBundleInfo(const std::string &bundleName, const AppExecFwk::BundleFlag flag, 35 AppExecFwk::BundleInfo &bundleInfo, int32_t userId); 36 int GetUidByBundleName(const std::string &bundleName, const int userId); 37 bool QueryAbilityInfos(const AAFwk::Want &want, int32_t flags, int32_t userId, 38 std::vector<AppExecFwk::AbilityInfo> &abilityInfos); 39 bool QueryExtensionAbilityInfos(const AAFwk::Want &want, const int32_t &flag, 40 const int32_t &userId, std::vector<AppExecFwk::ExtensionAbilityInfo> &extensionInfos); 41 42 private: 43 static std::mutex mockInstanceMutex_; 44 static std::shared_ptr<BundleManagerAdapter> instance_; 45 }; 46 } // namespace AccountSA 47 } // namespace OHOS 48 #endif // OS_ACCOUNT_SERVICE_BUNDLE_MANAGER_ADAPTER_H 49