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_DRIVER_DRIVER_DRIVER_INSTALLER_H 17 #define FOUNDATION_APPEXECFWK_SERVICES_BUNDLEMGR_INCLUDE_DRIVER_DRIVER_DRIVER_INSTALLER_H 18 #include <unordered_map> 19 20 #include "application_info.h" 21 #include "driver_install_ext.h" 22 #include "inner_bundle_info.h" 23 24 namespace OHOS { 25 namespace AppExecFwk { 26 class DriverInstaller { 27 public: 28 DriverInstaller() = default; 29 ~DriverInstaller() = default; 30 31 ErrCode CopyAllDriverFile(const std::unordered_map<std::string, InnerBundleInfo> &newInfos, 32 const InnerBundleInfo &oldInfo) const; 33 34 ErrCode FilterDriverSoFile(const InnerBundleInfo &info, const Metadata &meta, 35 std::unordered_multimap<std::string, std::string> &dirMap, bool isModuleExisted) const; 36 37 void RemoveDriverSoFile(const InnerBundleInfo &info, const std::string &moduleName, bool isModuleExisted) const; 38 39 std::string CreateDriverSoDestinedDir(const std::string &bundleName, const std::string &moduleName, 40 const std::string &fileName, const std::string &destinedDir, bool isModuleExisted) const; 41 42 private: 43 ErrCode CopyDriverSoFile(const InnerBundleInfo &info, const std::string &srcPath, bool isModuleExisted) const; 44 45 void RemoveAndReNameDriverFile(const std::unordered_map<std::string, InnerBundleInfo> &newInfos, 46 const InnerBundleInfo &oldInfo) const; 47 48 void RenameDriverFile(const InnerBundleInfo &info) const; 49 }; 50 } // AppExecFwk 51 } // OHOS 52 #endif // FOUNDATION_APPEXECFWK_SERVICES_BUNDLEMGR_INCLUDE_DRIVER_DRIVER_DRIVER_INSTALLER_H 53