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 DATAMGR_SERVICE_UTD_MANAGER_H 17 #define DATAMGR_SERVICE_UTD_MANAGER_H 18 19 #include <vector> 20 #include <string> 21 22 #include "bundlemgr/bundle_mgr_proxy.h" 23 #include "utd_common.h" 24 #include "utd_cfgs_checker.h" 25 #include "system_ability.h" 26 27 namespace OHOS { 28 namespace UDMF { 29 class CustomUtdInstaller { 30 public: 31 static CustomUtdInstaller &GetInstance(); 32 int32_t InstallUtd(const std::string &bundleName, int32_t user); 33 int32_t UninstallUtd(const std::string &bundleName, int32_t user); 34 35 private: 36 CustomUtdInstaller(); 37 ~CustomUtdInstaller(); 38 CustomUtdInstaller(const CustomUtdInstaller &obj) = delete; 39 CustomUtdInstaller &operator=(const CustomUtdInstaller &obj) = delete; 40 sptr<AppExecFwk::IBundleMgr> GetBundleManager(); 41 std::vector<std::string> GetHapModules(const std::string &bundleName, int32_t user); 42 CustomUtdCfgs GetModuleCustomUtdTypes(const std::string &bundleName, const std::string &moduleName, int32_t user); 43 int32_t SaveCustomUtds(const CustomUtdCfgs &utdTypes, std::vector<TypeDescriptorCfg> customTyepCfgs, 44 const std::string &bundleName, const std::string &path); 45 }; 46 } // namespace UDMF 47 } // namespace OHOS 48 #endif // DATAMGR_SERVICE_UTD_MANAGER_H 49