1 /* 2 * Copyright (c) 2021 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 UPDATER_SERVICE_KITS_H 17 #define UPDATER_SERVICE_KITS_H 18 19 #include <iostream> 20 #include "iupdate_service.h" 21 #include "update_helper.h" 22 23 namespace OHOS { 24 namespace update_engine { 25 class UpdateServiceKits { 26 public: 27 UpdateServiceKits() = default; 28 virtual ~UpdateServiceKits() = default; 29 DISALLOW_COPY_AND_MOVE(UpdateServiceKits); 30 31 /** 32 * Get instance of ohos account manager. 33 * 34 * @return Instance of ohos account manager. 35 */ 36 static UpdateServiceKits& GetInstance(); 37 38 virtual int32_t RegisterUpdateCallback(const UpdateContext &ctx, const UpdateCallbackInfo &cb) = 0; 39 40 virtual int32_t UnregisterUpdateCallback() = 0; 41 42 virtual int32_t CheckNewVersion() = 0; 43 44 virtual int32_t DownloadVersion() = 0; 45 46 virtual int32_t DoUpdate() = 0; 47 48 virtual int32_t GetNewVersion(VersionInfo &versionInfo) = 0; 49 50 virtual int32_t GetUpgradeStatus (UpgradeInfo &info) = 0; 51 52 virtual int32_t SetUpdatePolicy(const UpdatePolicy &policy) = 0; 53 54 virtual int32_t GetUpdatePolicy(UpdatePolicy &policy) = 0; 55 56 virtual int32_t Cancel(int32_t service) = 0; 57 58 virtual int32_t RebootAndClean(const std::string &miscFile, const std::string &cmd) = 0; 59 60 virtual int32_t RebootAndInstall(const std::string &miscFile, const std::string &packageName) = 0; 61 }; 62 } // namespace update_engine 63 } // namespace OHOS 64 #endif // UPDATER_SERVICE_KITS_H 65