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_CLIENT_H 17 #define FOUNDATION_APPEXECFWK_SERVICES_BUNDLEMGR_INCLUDE_BMS_EXTENSION_CLIENT_H 18 19 #include "bms_extension_data_mgr.h" 20 #include "bundle_data_mgr.h" 21 22 namespace OHOS { 23 namespace AppExecFwk { 24 class BmsExtensionClient { 25 public: 26 using Want = OHOS::AAFwk::Want; 27 28 BmsExtensionClient(); 29 virtual ~BmsExtensionClient() = default; 30 31 ErrCode QueryLauncherAbility(const Want &want, int32_t userId, 32 std::vector<AbilityInfo> &abilityInfos) const; 33 34 ErrCode QueryAbilityInfos(const Want &want, int32_t flags, int32_t userId, 35 std::vector<AbilityInfo> &abilityInfos, bool isNewVersion = false) const; 36 37 ErrCode QueryAbilityInfo(const Want &want, int32_t flags, int32_t userId, 38 AbilityInfo &abilityInfo, bool isNewVersion = false) const; 39 40 ErrCode GetBundleInfos( 41 int32_t flags, std::vector<BundleInfo> &bundleInfos, int32_t userId, bool isNewVersion = false) const; 42 43 ErrCode GetBundleInfo(const std::string &bundleName, int32_t flags, 44 BundleInfo &bundleInfo, int32_t userId, bool isNewVersion = false) const; 45 46 ErrCode ImplicitQueryAbilityInfos( 47 const Want &want, int32_t flags, int32_t userId, std::vector<AbilityInfo> &abilityInfos, 48 bool isNewVersion) const; 49 ErrCode GetBundleStats(const std::string &bundleName, int32_t userId, std::vector<int64_t> &bundleStats); 50 ErrCode ClearData(const std::string &bundleName, int32_t userId); 51 ErrCode ClearCache(const std::string &bundleName, sptr<IRemoteObject> callback, int32_t userId); 52 ErrCode GetUidByBundleName(const std::string &bundleName, int32_t userId, int32_t &uid); 53 ErrCode GetBundleNameByUid(int32_t uid, std::string &bundleName); 54 55 private: 56 void ModifyLauncherAbilityInfo(AbilityInfo &abilityInfo) const; 57 const std::shared_ptr<BundleDataMgr> GetDataMgr() const; 58 59 std::shared_ptr<BmsExtensionDataMgr> bmsExtensionImpl_; 60 }; 61 } // AppExecFwk 62 } // OHOS 63 64 #endif // FOUNDATION_APPEXECFWK_SERVICES_BUNDLEMGR_INCLUDE_BMS_EXTENSION_CLIENT_H