• 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 UPDATER_PROXY_H
17 #define UPDATER_PROXY_H
18 
19 #include "iremote_proxy.h"
20 #include "iupdate_service.h"
21 
22 namespace OHOS {
23 namespace update_engine {
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 UpdateContext &ctx, const sptr<IUpdateCallback>& updateCallback) override;
29 
30     int32_t UnregisterUpdateCallback() override;
31 
32     int32_t CheckNewVersion() override;
33 
34     int32_t DownloadVersion() override;
35 
36     int32_t DoUpdate() override;
37 
38     int32_t GetNewVersion(VersionInfo &versionInfo) override;
39 
40     int32_t GetUpgradeStatus (UpgradeInfo &info) override;
41 
42     int32_t SetUpdatePolicy(const UpdatePolicy &policy) override;
43 
44     int32_t GetUpdatePolicy(UpdatePolicy &policy) override;
45 
46     int32_t Cancel(int32_t service) override;
47 
48     int32_t RebootAndClean(const std::string &miscFile, const std::string &cmd) override;
49 
50     int32_t RebootAndInstall(const std::string &miscFile, const std::string &packageName) override;
51 private:
52     static inline BrokerDelegator<UpdateServiceProxy> delegator_;
53 };
54 }
55 } // namespace OHOS
56 #endif // UPDATER_PROXY_H