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 16 #ifndef ISERVICE_ONLINE_UPDATER_H 17 #define ISERVICE_ONLINE_UPDATER_H 18 19 #include "refbase.h" 20 21 #include "iupdate_callback.h" 22 #include "update_helper.h" 23 24 namespace OHOS { 25 namespace UpdateEngine { 26 class IServiceOnlineUpdater : public virtual RefBase { 27 public: 28 virtual ~IServiceOnlineUpdater() = default; 29 30 virtual int32_t CheckNewVersion(const UpgradeInfo &info) = 0; 31 32 virtual int32_t Download(const UpgradeInfo &info, const VersionDigestInfo &versionDigestInfo, 33 const DownloadOptions &downloadOptions, BusinessError &businessError) = 0; 34 35 virtual int32_t PauseDownload(const UpgradeInfo &info, const VersionDigestInfo &versionDigestInfo, 36 const PauseDownloadOptions &pauseDownloadOptions, BusinessError &businessError) = 0; 37 38 virtual int32_t ResumeDownload(const UpgradeInfo &info, const VersionDigestInfo &versionDigestInfo, 39 const ResumeDownloadOptions &resumeDownloadOptions, BusinessError &businessError) = 0; 40 41 virtual int32_t Upgrade(const UpgradeInfo &info, const VersionDigestInfo &versionDigest, 42 const UpgradeOptions &upgradeOptions, BusinessError &businessError) = 0; 43 44 virtual int32_t ClearError(const UpgradeInfo &info, const VersionDigestInfo &versionDigest, 45 const ClearOptions &clearOptions, BusinessError &businessError) = 0; 46 47 virtual int32_t TerminateUpgrade(const UpgradeInfo &info, BusinessError &businessError) = 0; 48 49 virtual int32_t GetNewVersionInfo(const UpgradeInfo &info, NewVersionInfo &newVersionInfo, 50 BusinessError &businessError) = 0; 51 52 virtual int32_t GetNewVersionDescription(const UpgradeInfo &info, const VersionDigestInfo &versionDigestInfo, 53 const DescriptionOptions &descriptionOptions, VersionDescriptionInfo &newVersionDescriptionInfo, 54 BusinessError &businessError) = 0; 55 56 virtual int32_t GetCurrentVersionInfo(const UpgradeInfo &info, CurrentVersionInfo ¤tVersionInfo, 57 BusinessError &businessError) = 0; 58 59 virtual int32_t GetCurrentVersionDescription(const UpgradeInfo &info, const DescriptionOptions &descriptionOptions, 60 VersionDescriptionInfo ¤tVersionDescriptionInfo, BusinessError &businessError) = 0; 61 62 virtual int32_t GetTaskInfo(const UpgradeInfo &info, TaskInfo &taskInfo, BusinessError &businessError) = 0; 63 64 virtual int32_t SetUpgradePolicy(const UpgradeInfo &info, const UpgradePolicy &policy, 65 BusinessError &businessError) = 0; 66 67 virtual int32_t GetUpgradePolicy(const UpgradeInfo &info, UpgradePolicy &policy, BusinessError &businessError) = 0; 68 69 virtual int32_t Cancel(const UpgradeInfo &info, int32_t service, BusinessError &businessError) = 0; 70 }; 71 } // namespace UpdateEngine 72 } // namespace OHOS 73 #endif // ISERVICE_ONLINE_UPDATER_H 74