1 /* 2 * Copyright (c) 2022 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 #ifndef SYS_INSTALLER_SERVER_H 16 #define SYS_INSTALLER_SERVER_H 17 18 #include <iostream> 19 #include <thread> 20 #include "if_system_ability_manager.h" 21 #include "installer_manager.h" 22 #include "ipc_skeleton.h" 23 #include "iremote_stub.h" 24 #include "isys_installer.h" 25 #include "status_manager.h" 26 #include "system_ability.h" 27 #include "sys_installer_common.h" 28 #include "sys_installer_stub.h" 29 30 namespace OHOS { 31 namespace SysInstaller { 32 class SysInstallerServer : public SystemAbility, public SysInstallerStub { 33 public: 34 DECLARE_SYSTEM_ABILITY(SysInstallerServer); 35 DISALLOW_COPY_AND_MOVE(SysInstallerServer); 36 SysInstallerServer(int32_t systemAbilityId, bool runOnCreate = false); 37 ~SysInstallerServer() override; 38 39 int32_t SysInstallerInit() override; 40 int32_t StartUpdatePackageZip(const std::string &pkgPath) override; 41 int32_t SetUpdateCallback(const sptr<ISysInstallerCallback> &updateCallback) override; 42 int32_t GetUpdateStatus() override; 43 int32_t StartUpdateParaZip(const std::string &pkgPath, 44 const std::string &location, const std::string &cfgDir) override; 45 int32_t StartDeleteParaZip(const std::string &location, const std::string &cfgDir) override; 46 int32_t AccDecompressAndVerifyPkg(const std::string &srcPath, 47 const std::string &dstPath, const uint32_t type) override; 48 int32_t AccDeleteDir(const std::string &dstPath) override; 49 50 #ifndef UPDATER_UT 51 private: 52 #else 53 public: 54 #endif 55 void OnStart() override; 56 void OnStop() override; 57 58 private: 59 bool logInit_ = false; 60 std::mutex sysInstallerServerLock_; 61 }; 62 } // namespace SysInstaller 63 } // namespace OHOS 64 #endif // SYS_INSTALLER_SERVER_H 65