188edb362Sopenharmony_ci/* 288edb362Sopenharmony_ci * Copyright (c) 2023 Huawei Device Co., Ltd. 388edb362Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 488edb362Sopenharmony_ci * you may not use this file except in compliance with the License. 588edb362Sopenharmony_ci * You may obtain a copy of the License at 688edb362Sopenharmony_ci * 788edb362Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 888edb362Sopenharmony_ci * 988edb362Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 1088edb362Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 1188edb362Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1288edb362Sopenharmony_ci * See the License for the specific language governing permissions and 1388edb362Sopenharmony_ci * limitations under the License. 1488edb362Sopenharmony_ci */ 1588edb362Sopenharmony_ci 1688edb362Sopenharmony_ci#ifndef SYS_INSTALLER_MODULE_UPDATE_H 1788edb362Sopenharmony_ci#define SYS_INSTALLER_MODULE_UPDATE_H 1888edb362Sopenharmony_ci 1988edb362Sopenharmony_ci#include <memory> 2088edb362Sopenharmony_ci#include <list> 2188edb362Sopenharmony_ci#include <unordered_set> 2288edb362Sopenharmony_ci 2388edb362Sopenharmony_ci#include "module_file.h" 2488edb362Sopenharmony_ci#include "module_file_repository.h" 2588edb362Sopenharmony_ci#include "module_ipc_helper.h" 2688edb362Sopenharmony_ci 2788edb362Sopenharmony_cinamespace OHOS { 2888edb362Sopenharmony_cinamespace SysInstaller { 2988edb362Sopenharmony_ciclass ModuleUpdate { 3088edb362Sopenharmony_cipublic: 3188edb362Sopenharmony_ci static ModuleUpdate &GetInstance(); 3288edb362Sopenharmony_ci virtual ~ModuleUpdate() = default; 3388edb362Sopenharmony_ci void CheckModuleUpdate(); 3488edb362Sopenharmony_ci bool DoModuleUpdate(ModuleUpdateStatus &status); 3588edb362Sopenharmony_ci bool RemoveMountPoint(const std::string &hmpName); 3688edb362Sopenharmony_ci 3788edb362Sopenharmony_ciprivate: 3888edb362Sopenharmony_ci void PrepareModuleFileList(const ModuleUpdateStatus &status); 3988edb362Sopenharmony_ci bool ActivateModules(ModuleUpdateStatus &status, const Timer &timer); 4088edb362Sopenharmony_ci bool MountModulePackage(const ModuleFile &moduleFile, const bool mountOnVerity) const; 4188edb362Sopenharmony_ci void ReportModuleUpdateStatus(const ModuleUpdateStatus &status) const; 4288edb362Sopenharmony_ci void WaitDevice(const std::string &blockDevice) const; 4388edb362Sopenharmony_ci bool CheckMountComplete(const std::string &hmpName) const; 4488edb362Sopenharmony_ci void ProcessHmpFile(const std::string &hmpFile, const ModuleUpdateStatus &status, const Timer &timer); 4588edb362Sopenharmony_ci std::unique_ptr<ModuleFile> GetLatestUpdateModulePackage(const std::string &hmpName); 4688edb362Sopenharmony_ci 4788edb362Sopenharmony_ci std::list<ModuleFile> moduleFileList_; 4888edb362Sopenharmony_ci ModuleFileRepository repository_; 4988edb362Sopenharmony_ci}; 5088edb362Sopenharmony_ci} // SysInstaller 5188edb362Sopenharmony_ci} // namespace OHOS 5288edb362Sopenharmony_ci#endif // SYS_INSTALLER_MODULE_UPDATE_H