client_dbus.h revision 97c870518ce1149b32966d98ebfe93f3eb5d1fef
116daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley// 216daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley// Copyright (C) 2015 The Android Open Source Project 316daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley// 416daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley// Licensed under the Apache License, Version 2.0 (the "License"); 516daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley// you may not use this file except in compliance with the License. 616daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley// You may obtain a copy of the License at 716daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley// 816daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley// http://www.apache.org/licenses/LICENSE-2.0 916daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley// 1016daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley// Unless required by applicable law or agreed to in writing, software 1116daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley// distributed under the License is distributed on an "AS IS" BASIS, 1216daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1316daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley// See the License for the specific language governing permissions and 1416daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley// limitations under the License. 1516daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley// 1616daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley 1716daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley#ifndef UPDATE_ENGINE_CLIENT_LIBRARY_CLIENT_IMPL_H_ 1816daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley#define UPDATE_ENGINE_CLIENT_LIBRARY_CLIENT_IMPL_H_ 1916daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley 2016daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley#include <cstdint> 2116daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley#include <memory> 2216daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley#include <string> 2316daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley 2416daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley#include <base/macros.h> 2516daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley 2616daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley#include "update_engine/client_library/include/update_engine/client.h" 2739910dcd1d68987ccee7c3031dc269233a8490bbAlex Deymo#include "update_engine/dbus-proxies.h" 2816daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley 2916daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wileynamespace update_engine { 3016daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wileynamespace internal { 3116daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley 3216daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wileyclass UpdateEngineClientImpl : public UpdateEngineClient { 3316daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley public: 3416daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley UpdateEngineClientImpl(); 3516daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley virtual ~UpdateEngineClientImpl() = default; 3616daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley 3716daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley bool AttemptUpdate(const std::string& app_version, 3816daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley const std::string& omaha_url, 3916daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley bool at_user_request) override; 4016daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley 4116daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley bool GetStatus(int64_t* out_last_checked_time, 4216daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley double* out_progress, 4316daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley UpdateStatus* out_update_status, 4416daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley std::string* out_new_version, 4516daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley int64_t* out_new_size) override; 4616daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley 47ef361136cea1e423dc462d2b347923ae60b2cf08Casey Dahlin bool SetUpdateOverCellularPermission(bool allowed) override; 48ef361136cea1e423dc462d2b347923ae60b2cf08Casey Dahlin bool GetUpdateOverCellularPermission(bool* allowed) override; 49ef361136cea1e423dc462d2b347923ae60b2cf08Casey Dahlin 50ef361136cea1e423dc462d2b347923ae60b2cf08Casey Dahlin bool SetP2PUpdatePermission(bool enabled) override; 51ef361136cea1e423dc462d2b347923ae60b2cf08Casey Dahlin bool GetP2PUpdatePermission(bool* enabled) override; 52ef361136cea1e423dc462d2b347923ae60b2cf08Casey Dahlin 53ef361136cea1e423dc462d2b347923ae60b2cf08Casey Dahlin bool Rollback(bool powerwash) override; 54ef361136cea1e423dc462d2b347923ae60b2cf08Casey Dahlin 55ef361136cea1e423dc462d2b347923ae60b2cf08Casey Dahlin bool GetRollbackPartition(std::string* rollback_partition) override; 56ef361136cea1e423dc462d2b347923ae60b2cf08Casey Dahlin 57ef361136cea1e423dc462d2b347923ae60b2cf08Casey Dahlin void RebootIfNeeded() override; 58ef361136cea1e423dc462d2b347923ae60b2cf08Casey Dahlin 59d81584673de3c888bde40b473bb2685ba1c5cc2dCasey Dahlin bool GetPrevVersion(std::string* prev_version) override; 60ef361136cea1e423dc462d2b347923ae60b2cf08Casey Dahlin 61e844c1a5604765bbddafa7e05f1143a27f136747Casey Dahlin bool ResetStatus() override; 62e844c1a5604765bbddafa7e05f1143a27f136747Casey Dahlin 6387ab88e35fac5d3ded1c70c8911d307ec47a7db9Casey Dahlin bool SetTargetChannel(const std::string& target_channel, 6487ab88e35fac5d3ded1c70c8911d307ec47a7db9Casey Dahlin bool allow_powerwash) override; 6516daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley 6616daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley bool GetTargetChannel(std::string* out_channel) override; 6716daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley 6816daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley bool GetChannel(std::string* out_channel) override; 6916daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley 7097c870518ce1149b32966d98ebfe93f3eb5d1fefCasey Dahlin void RegisterStatusUpdateHandler(StatusUpdateHandler* handler) override; 7197c870518ce1149b32966d98ebfe93f3eb5d1fefCasey Dahlin 7216daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley private: 7316daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley std::unique_ptr<org::chromium::UpdateEngineInterfaceProxy> proxy_; 7416daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley 7597c870518ce1149b32966d98ebfe93f3eb5d1fefCasey Dahlin void StatusUpdateHandlerRegistered(StatusUpdateHandler* handler, 7697c870518ce1149b32966d98ebfe93f3eb5d1fefCasey Dahlin const std::string& interface, 7797c870518ce1149b32966d98ebfe93f3eb5d1fefCasey Dahlin const std::string& signal_name, 7897c870518ce1149b32966d98ebfe93f3eb5d1fefCasey Dahlin bool success); 7997c870518ce1149b32966d98ebfe93f3eb5d1fefCasey Dahlin 8097c870518ce1149b32966d98ebfe93f3eb5d1fefCasey Dahlin void RunStatusUpdateHandler(StatusUpdateHandler* handler, 8197c870518ce1149b32966d98ebfe93f3eb5d1fefCasey Dahlin int64_t last_checked_time, 8297c870518ce1149b32966d98ebfe93f3eb5d1fefCasey Dahlin double progress, 8397c870518ce1149b32966d98ebfe93f3eb5d1fefCasey Dahlin const std::string& current_operation, 8497c870518ce1149b32966d98ebfe93f3eb5d1fefCasey Dahlin const std::string& new_version, 8597c870518ce1149b32966d98ebfe93f3eb5d1fefCasey Dahlin int64_t new_size); 8697c870518ce1149b32966d98ebfe93f3eb5d1fefCasey Dahlin 8716daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley DISALLOW_COPY_AND_ASSIGN(UpdateEngineClientImpl); 8816daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley}; // class UpdateEngineClientImpl 8916daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley 9016daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley} // namespace internal 9116daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley} // namespace update_engine 9216daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley 9316daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley#endif // UPDATE_ENGINE_CLIENT_LIBRARY_CLIENT_IMPL_H_ 94