1 /* 2 * Copyright (c) 2022-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 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 private: 29 BundleManagerAdapter(); 30 virtual ~BundleManagerAdapter(); 31 DISALLOW_COPY_AND_MOVE(BundleManagerAdapter); 32 33 public: 34 static BundleManagerAdapter* GetInstance(); 35 36 ErrCode GetNameForUid(const int uid, std::string &bundleName); 37 ErrCode CreateNewUser(int32_t userId, const std::vector<std::string> &disallowedHapList = {}, 38 const std::optional<std::vector<std::string>> &allowedHapList = std::nullopt); 39 ErrCode RemoveUser(int32_t userId); 40 bool GetBundleInfo(const std::string &bundleName, const AppExecFwk::BundleFlag flag, 41 AppExecFwk::BundleInfo &bundleInfo, int32_t userId); 42 int GetUidByBundleName(const std::string &bundleName, const int userId); 43 bool QueryAbilityInfos(const AAFwk::Want &want, int32_t flags, int32_t userId, 44 std::vector<AppExecFwk::AbilityInfo> &abilityInfos); 45 bool QueryExtensionAbilityInfos(const AAFwk::Want &want, const int32_t &flag, 46 const int32_t &userId, std::vector<AppExecFwk::ExtensionAbilityInfo> &extensionInfos); 47 bool QueryExtensionAbilityInfos(const AAFwk::Want &want, const AppExecFwk::ExtensionAbilityType &extensionType, 48 const int32_t &flag, const int32_t &userId, std::vector<AppExecFwk::ExtensionAbilityInfo> &extensionInfos); 49 }; 50 } // namespace AccountSA 51 } // namespace OHOS 52 #endif // OS_ACCOUNT_SERVICE_BUNDLE_MANAGER_ADAPTER_H 53