123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192 |
- #ifndef UPDATE_ENGINE_DBUS_SERVICE_H_
- #define UPDATE_ENGINE_DBUS_SERVICE_H_
- #include <inttypes.h>
- #include <memory>
- #include <string>
- #include <base/memory/ref_counted.h>
- #include <brillo/errors/error.h>
- #include "update_engine/common_service.h"
- #include "update_engine/service_observer_interface.h"
- #include "update_engine/update_attempter.h"
- #include "dbus_bindings/org.chromium.UpdateEngineInterface.h"
- namespace chromeos_update_engine {
- class DBusUpdateEngineService
- : public org::chromium::UpdateEngineInterfaceInterface {
- public:
- explicit DBusUpdateEngineService(SystemState* system_state);
- virtual ~DBusUpdateEngineService() = default;
-
- bool AttemptUpdate(brillo::ErrorPtr* error,
- const std::string& in_app_version,
- const std::string& in_omaha_url) override;
- bool AttemptUpdateWithFlags(brillo::ErrorPtr* error,
- const std::string& in_app_version,
- const std::string& in_omaha_url,
- int32_t in_flags_as_int) override;
- bool AttemptInstall(brillo::ErrorPtr* error,
- const std::string& dlc_request) override;
- bool AttemptRollback(brillo::ErrorPtr* error, bool in_powerwash) override;
-
-
- bool CanRollback(brillo::ErrorPtr* error, bool* out_can_rollback) override;
-
-
- bool ResetStatus(brillo::ErrorPtr* error) override;
-
-
-
- bool GetStatus(brillo::ErrorPtr* error,
- int64_t* out_last_checked_time,
- double* out_progress,
- std::string* out_current_operation,
- std::string* out_new_version,
- int64_t* out_new_size) override;
-
- bool RebootIfNeeded(brillo::ErrorPtr* error) override;
-
-
-
-
-
-
-
-
- bool SetChannel(brillo::ErrorPtr* error,
- const std::string& in_target_channel,
- bool in_is_powerwash_allowed) override;
-
-
-
-
- bool GetChannel(brillo::ErrorPtr* error,
- bool in_get_current_channel,
- std::string* out_channel) override;
- bool SetCohortHint(brillo::ErrorPtr* error,
- const std::string& in_cohort_hint) override;
- bool GetCohortHint(brillo::ErrorPtr* error,
- std::string* out_cohort_hint) override;
-
-
- bool SetP2PUpdatePermission(brillo::ErrorPtr* error,
- bool in_enabled) override;
-
-
- bool GetP2PUpdatePermission(brillo::ErrorPtr* error,
- bool* out_enabled) override;
-
-
-
- bool SetUpdateOverCellularPermission(brillo::ErrorPtr* error,
- bool in_allowed) override;
-
-
- bool SetUpdateOverCellularTarget(brillo::ErrorPtr* error,
- const std::string& target_version,
- int64_t target_size) override;
-
-
-
- bool GetUpdateOverCellularPermission(brillo::ErrorPtr* error,
- bool* out_allowed) override;
-
-
-
- bool GetDurationSinceUpdate(brillo::ErrorPtr* error,
- int64_t* out_usec_wallclock) override;
-
-
-
- bool GetPrevVersion(brillo::ErrorPtr* error,
- std::string* out_prev_version) override;
-
- bool GetRollbackPartition(brillo::ErrorPtr* error,
- std::string* out_rollback_partition_name) override;
-
-
- bool GetLastAttemptError(brillo::ErrorPtr* error,
- int32_t* out_last_attempt_error) override;
-
- bool GetEolStatus(brillo::ErrorPtr* error, int32_t* out_eol_status) override;
- private:
- std::unique_ptr<UpdateEngineService> common_;
- };
- class UpdateEngineAdaptor : public org::chromium::UpdateEngineInterfaceAdaptor,
- public ServiceObserverInterface {
- public:
- explicit UpdateEngineAdaptor(SystemState* system_state);
- ~UpdateEngineAdaptor() = default;
-
-
-
- void RegisterAsync(const base::Callback<void(bool)>& completion_callback);
-
-
- bool RequestOwnership();
-
- void SendStatusUpdate(
- const update_engine::UpdateEngineStatus& update_engine_status) override;
- void SendPayloadApplicationComplete(ErrorCode error_code) override {}
- private:
- scoped_refptr<dbus::Bus> bus_;
- DBusUpdateEngineService dbus_service_;
- brillo::dbus_utils::DBusObject dbus_object_;
- };
- }
- #endif
|