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 UPDATE_SERVICE_KITS_H 17 #define UPDATE_SERVICE_KITS_H 18 19 #include <iostream> 20 #include "iupdate_service.h" 21 #include "update_helper.h" 22 23 namespace OHOS { 24 namespace UpdateEngine { 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 UpgradeInfo &info, const UpdateCallbackInfo &cb) = 0; 39 40 virtual int32_t UnregisterUpdateCallback(const UpgradeInfo &info) = 0; 41 42 virtual int32_t CheckNewVersion(const UpgradeInfo &info) = 0; 43 44 virtual int32_t Download(const UpgradeInfo &info, const VersionDigestInfo &versionDigestInfo, 45 const DownloadOptions &downloadOptions, BusinessError &businessError) = 0; 46 47 virtual int32_t PauseDownload(const UpgradeInfo &info, const VersionDigestInfo &versionDigestInfo, 48 const PauseDownloadOptions &pauseDownloadOptions, BusinessError &businessError) = 0; 49 50 virtual int32_t ResumeDownload(const UpgradeInfo &info, const VersionDigestInfo &versionDigestInfo, 51 const ResumeDownloadOptions &resumeDownloadOptions, BusinessError &businessError) = 0; 52 53 virtual int32_t Upgrade(const UpgradeInfo &info, const VersionDigestInfo &versionDigest, 54 const UpgradeOptions &upgradeOptions, BusinessError &businessError) = 0; 55 56 virtual int32_t ClearError(const UpgradeInfo &info, const VersionDigestInfo &versionDigest, 57 const ClearOptions &clearOptions, BusinessError &businessError) = 0; 58 59 virtual int32_t TerminateUpgrade(const UpgradeInfo &info, BusinessError &businessError) = 0; 60 61 virtual int32_t GetNewVersionInfo(const UpgradeInfo &info, NewVersionInfo &newVersionInfo, 62 BusinessError &businessError) = 0; 63 64 virtual int32_t GetNewVersionDescription(const UpgradeInfo &info, const VersionDigestInfo &versionDigestInfo, 65 const DescriptionOptions &descriptionOptions, VersionDescriptionInfo &newVersionDescriptionInfo, 66 BusinessError &businessError) = 0; 67 68 virtual int32_t GetCurrentVersionInfo(const UpgradeInfo &info, CurrentVersionInfo ¤tVersionInfo, 69 BusinessError &businessError) = 0; 70 71 virtual int32_t GetCurrentVersionDescription(const UpgradeInfo &info, const DescriptionOptions &descriptionOptions, 72 VersionDescriptionInfo ¤tVersionDescriptionInfo, BusinessError &businessError) = 0; 73 74 virtual int32_t GetTaskInfo(const UpgradeInfo &info, TaskInfo &taskInfo, BusinessError &businessError) = 0; 75 76 virtual int32_t SetUpgradePolicy(const UpgradeInfo &info, const UpgradePolicy &policy, 77 BusinessError &businessError) = 0; 78 79 virtual int32_t GetUpgradePolicy(const UpgradeInfo &info, UpgradePolicy &policy, BusinessError &businessError) = 0; 80 81 virtual int32_t Cancel(const UpgradeInfo &info, int32_t service, BusinessError &businessError) = 0; 82 83 virtual int32_t FactoryReset(BusinessError &businessError) = 0; 84 85 virtual int32_t ApplyNewVersion(const UpgradeInfo &info, const std::string &miscFile, 86 const std::string &packageName, BusinessError &businessError) = 0; 87 88 virtual int32_t VerifyUpgradePackage(const std::string &packagePath, const std::string &keyPath, 89 BusinessError &businessError) = 0; 90 }; 91 } // namespace UpdateEngine 92 } // namespace OHOS 93 #endif // UPDATE_SERVICE_KITS_H 94