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