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 SysInstaller : public SystemAbility, public SysInstallerStub { 33 public: 34 DECLARE_SYSTEM_ABILITY(SysInstaller); 35 DISALLOW_COPY_AND_MOVE(SysInstaller); 36 SysInstaller(int32_t systemAbilityId, bool runOnCreate = false); 37 ~SysInstaller() 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 46 #ifndef UPDATER_UT 47 private: 48 #else 49 public: 50 #endif 51 void OnStart() override; 52 void OnStop() override; 53 54 private: 55 bool logInit_ = false; 56 }; 57 } // namespace SysInstaller 58 } // namespace OHOS 59 #endif // SYS_INSTALLER_SERVER_H 60