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_PROXY_H 17 #define UPDATE_SERVICE_PROXY_H 18 19 #include "iremote_proxy.h" 20 #include "iupdate_service.h" 21 22 namespace OHOS { 23 namespace UpdateEngine { 24 class UpdateServiceProxy : public IRemoteProxy<IUpdateService> { 25 public: UpdateServiceProxy(const sptr<IRemoteObject> & impl)26 explicit UpdateServiceProxy(const sptr<IRemoteObject>& impl) : IRemoteProxy<IUpdateService>(impl) {} 27 28 int32_t RegisterUpdateCallback(const UpgradeInfo &info, const sptr<IUpdateCallback>& updateCallback) override; 29 30 int32_t UnregisterUpdateCallback(const UpgradeInfo &info) override; 31 32 int32_t CheckNewVersion(const UpgradeInfo &info, BusinessError &businessError, CheckResult &checkResult) override; 33 34 int32_t Download(const UpgradeInfo &info, const VersionDigestInfo &versionDigestInfo, 35 const DownloadOptions &downloadOptions, BusinessError &businessError) override; 36 37 int32_t PauseDownload(const UpgradeInfo &info, const VersionDigestInfo &versionDigestInfo, 38 const PauseDownloadOptions &pauseDownloadOptions, BusinessError &businessError) override; 39 40 int32_t ResumeDownload(const UpgradeInfo &info, const VersionDigestInfo &versionDigestInfo, 41 const ResumeDownloadOptions &resumeDownloadOptions, BusinessError &businessError) override; 42 43 int32_t Upgrade(const UpgradeInfo &info, const VersionDigestInfo &versionDigest, 44 const UpgradeOptions &upgradeOptions, BusinessError &businessError) override; 45 46 int32_t ClearError(const UpgradeInfo &info, const VersionDigestInfo &versionDigest, 47 const ClearOptions &clearOptions, BusinessError &businessError) override; 48 49 int32_t TerminateUpgrade(const UpgradeInfo &info, BusinessError &businessError) override; 50 51 int32_t GetNewVersionInfo(const UpgradeInfo &info, NewVersionInfo &newVersionInfo, 52 BusinessError &businessError) override; 53 54 int32_t GetNewVersionDescription(const UpgradeInfo &info, const VersionDigestInfo &versionDigestInfo, 55 const DescriptionOptions &descriptionOptions, VersionDescriptionInfo &newVersionDescriptionInfo, 56 BusinessError &businessError) override; 57 58 int32_t GetCurrentVersionInfo(const UpgradeInfo &info, CurrentVersionInfo ¤tVersionInfo, 59 BusinessError &businessError) override; 60 61 int32_t GetCurrentVersionDescription(const UpgradeInfo &info, const DescriptionOptions &descriptionOptions, 62 VersionDescriptionInfo ¤tVersionDescriptionInfo, BusinessError &businessError) override; 63 64 int32_t GetTaskInfo(const UpgradeInfo &info, TaskInfo &taskInfo, BusinessError &businessError) override; 65 66 int32_t SetUpgradePolicy(const UpgradeInfo &info, const UpgradePolicy &policy, 67 BusinessError &businessError) override; 68 69 int32_t GetUpgradePolicy(const UpgradeInfo &info, UpgradePolicy &policy, BusinessError &businessError) override; 70 71 int32_t Cancel(const UpgradeInfo &info, int32_t service, BusinessError &businessError) override; 72 73 int32_t FactoryReset(BusinessError &businessError) override; 74 75 int32_t ApplyNewVersion(const UpgradeInfo &info, const std::string &miscFile, 76 const std::vector<std::string> &packageNames, BusinessError &businessError) override; 77 78 int32_t VerifyUpgradePackage(const std::string &packagePath, const std::string &keyPath, 79 BusinessError &businessError) override; 80 81 private: 82 static inline BrokerDelegator<UpdateServiceProxy> delegator_; 83 }; 84 } // namespace UpdateEngine 85 } // namespace OHOS 86 #endif // UPDATE_SERVICE_PROXY_H