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
17a93cd53c4f8ab8cb926ed9223373567ebbf45cb6Casey Dahlin#include "update_engine/client_library/client_dbus.h"
1816daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley
19194414134a954d921c8063610304c4fd21f19df2Casey Dahlin#include <base/message_loop/message_loop.h>
20194414134a954d921c8063610304c4fd21f19df2Casey Dahlin
2116daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley#include <dbus/bus.h>
2216daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley#include <update_engine/dbus-constants.h>
2316daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley
2416daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley#include "update_engine/update_status_utils.h"
2516daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley
2616daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wileyusing chromeos_update_engine::StringToUpdateStatus;
2716daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wileyusing dbus::Bus;
2816daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wileyusing org::chromium::UpdateEngineInterfaceProxy;
29a93cd53c4f8ab8cb926ed9223373567ebbf45cb6Casey Dahlinusing std::string;
3016daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley
3116daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wileynamespace update_engine {
3216daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wileynamespace internal {
3316daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley
34a93cd53c4f8ab8cb926ed9223373567ebbf45cb6Casey Dahlinbool DBusUpdateEngineClient::Init() {
3516daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley  Bus::Options options;
3616daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley  options.bus_type = Bus::SYSTEM;
3716daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley  scoped_refptr<Bus> bus{new Bus{options}};
38194414134a954d921c8063610304c4fd21f19df2Casey Dahlin
39a93cd53c4f8ab8cb926ed9223373567ebbf45cb6Casey Dahlin  if (!bus->Connect())
40a93cd53c4f8ab8cb926ed9223373567ebbf45cb6Casey Dahlin    return false;
41194414134a954d921c8063610304c4fd21f19df2Casey Dahlin
4216daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley  proxy_.reset(new UpdateEngineInterfaceProxy{bus});
43194414134a954d921c8063610304c4fd21f19df2Casey Dahlin  return true;
4416daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley}
4516daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley
46a93cd53c4f8ab8cb926ed9223373567ebbf45cb6Casey Dahlinbool DBusUpdateEngineClient::AttemptUpdate(const string& in_app_version,
4716daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley                                           const string& in_omaha_url,
4816daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley                                           bool at_user_request) {
4916daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley  return proxy_->AttemptUpdateWithFlags(
50a93cd53c4f8ab8cb926ed9223373567ebbf45cb6Casey Dahlin      in_app_version,
51a93cd53c4f8ab8cb926ed9223373567ebbf45cb6Casey Dahlin      in_omaha_url,
52a93cd53c4f8ab8cb926ed9223373567ebbf45cb6Casey Dahlin      (at_user_request) ? 0 : kAttemptUpdateFlagNonInteractive,
53a93cd53c4f8ab8cb926ed9223373567ebbf45cb6Casey Dahlin      nullptr);
5416daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley}
5516daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley
56a93cd53c4f8ab8cb926ed9223373567ebbf45cb6Casey Dahlinbool DBusUpdateEngineClient::GetStatus(int64_t* out_last_checked_time,
5716daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley                                       double* out_progress,
5816daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley                                       UpdateStatus* out_update_status,
5916daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley                                       string* out_new_version,
60194414134a954d921c8063610304c4fd21f19df2Casey Dahlin                                       int64_t* out_new_size) const {
6116daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley  string status_as_string;
62a93cd53c4f8ab8cb926ed9223373567ebbf45cb6Casey Dahlin  const bool success = proxy_->GetStatus(out_last_checked_time,
63a93cd53c4f8ab8cb926ed9223373567ebbf45cb6Casey Dahlin                                         out_progress,
64a93cd53c4f8ab8cb926ed9223373567ebbf45cb6Casey Dahlin                                         &status_as_string,
65a93cd53c4f8ab8cb926ed9223373567ebbf45cb6Casey Dahlin                                         out_new_version,
66a93cd53c4f8ab8cb926ed9223373567ebbf45cb6Casey Dahlin                                         out_new_size,
67a93cd53c4f8ab8cb926ed9223373567ebbf45cb6Casey Dahlin                                         nullptr);
6816daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley  if (!success) {
6916daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley    return false;
7016daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley  }
7116daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley
7216daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley  return StringToUpdateStatus(status_as_string, out_update_status);
7316daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley}
7416daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley
755b5fa8b412312a41cfd4d7ab475b54d4f730ed2aAlex Deymobool DBusUpdateEngineClient::SetCohortHint(const string& cohort_hint) {
765b5fa8b412312a41cfd4d7ab475b54d4f730ed2aAlex Deymo  return proxy_->SetCohortHint(cohort_hint, nullptr);
775b5fa8b412312a41cfd4d7ab475b54d4f730ed2aAlex Deymo}
785b5fa8b412312a41cfd4d7ab475b54d4f730ed2aAlex Deymo
795b5fa8b412312a41cfd4d7ab475b54d4f730ed2aAlex Deymobool DBusUpdateEngineClient::GetCohortHint(string* cohort_hint) const {
805b5fa8b412312a41cfd4d7ab475b54d4f730ed2aAlex Deymo  return proxy_->GetCohortHint(cohort_hint, nullptr);
815b5fa8b412312a41cfd4d7ab475b54d4f730ed2aAlex Deymo}
825b5fa8b412312a41cfd4d7ab475b54d4f730ed2aAlex Deymo
83a93cd53c4f8ab8cb926ed9223373567ebbf45cb6Casey Dahlinbool DBusUpdateEngineClient::SetUpdateOverCellularPermission(bool allowed) {
84ef361136cea1e423dc462d2b347923ae60b2cf08Casey Dahlin  return proxy_->SetUpdateOverCellularPermission(allowed, nullptr);
85ef361136cea1e423dc462d2b347923ae60b2cf08Casey Dahlin}
86ef361136cea1e423dc462d2b347923ae60b2cf08Casey Dahlin
87a93cd53c4f8ab8cb926ed9223373567ebbf45cb6Casey Dahlinbool DBusUpdateEngineClient::GetUpdateOverCellularPermission(
88a93cd53c4f8ab8cb926ed9223373567ebbf45cb6Casey Dahlin    bool* allowed) const {
89ef361136cea1e423dc462d2b347923ae60b2cf08Casey Dahlin  return proxy_->GetUpdateOverCellularPermission(allowed, nullptr);
90ef361136cea1e423dc462d2b347923ae60b2cf08Casey Dahlin}
91ef361136cea1e423dc462d2b347923ae60b2cf08Casey Dahlin
92a93cd53c4f8ab8cb926ed9223373567ebbf45cb6Casey Dahlinbool DBusUpdateEngineClient::SetP2PUpdatePermission(bool enabled) {
93ef361136cea1e423dc462d2b347923ae60b2cf08Casey Dahlin  return proxy_->SetP2PUpdatePermission(enabled, nullptr);
94ef361136cea1e423dc462d2b347923ae60b2cf08Casey Dahlin}
95ef361136cea1e423dc462d2b347923ae60b2cf08Casey Dahlin
96a93cd53c4f8ab8cb926ed9223373567ebbf45cb6Casey Dahlinbool DBusUpdateEngineClient::GetP2PUpdatePermission(bool* enabled) const {
97ef361136cea1e423dc462d2b347923ae60b2cf08Casey Dahlin  return proxy_->GetP2PUpdatePermission(enabled, nullptr);
98ef361136cea1e423dc462d2b347923ae60b2cf08Casey Dahlin}
99ef361136cea1e423dc462d2b347923ae60b2cf08Casey Dahlin
100a93cd53c4f8ab8cb926ed9223373567ebbf45cb6Casey Dahlinbool DBusUpdateEngineClient::Rollback(bool powerwash) {
101ef361136cea1e423dc462d2b347923ae60b2cf08Casey Dahlin  return proxy_->AttemptRollback(powerwash, nullptr);
102ef361136cea1e423dc462d2b347923ae60b2cf08Casey Dahlin}
103ef361136cea1e423dc462d2b347923ae60b2cf08Casey Dahlin
104a93cd53c4f8ab8cb926ed9223373567ebbf45cb6Casey Dahlinbool DBusUpdateEngineClient::GetRollbackPartition(
105a93cd53c4f8ab8cb926ed9223373567ebbf45cb6Casey Dahlin    string* rollback_partition) const {
106ef361136cea1e423dc462d2b347923ae60b2cf08Casey Dahlin  return proxy_->GetRollbackPartition(rollback_partition, nullptr);
107ef361136cea1e423dc462d2b347923ae60b2cf08Casey Dahlin}
108ef361136cea1e423dc462d2b347923ae60b2cf08Casey Dahlin
109a93cd53c4f8ab8cb926ed9223373567ebbf45cb6Casey Dahlinbool DBusUpdateEngineClient::GetPrevVersion(string* prev_version) const {
110ef361136cea1e423dc462d2b347923ae60b2cf08Casey Dahlin  return proxy_->GetPrevVersion(prev_version, nullptr);
111ef361136cea1e423dc462d2b347923ae60b2cf08Casey Dahlin}
112ef361136cea1e423dc462d2b347923ae60b2cf08Casey Dahlin
113a93cd53c4f8ab8cb926ed9223373567ebbf45cb6Casey Dahlinvoid DBusUpdateEngineClient::RebootIfNeeded() {
114ef361136cea1e423dc462d2b347923ae60b2cf08Casey Dahlin  bool ret = proxy_->RebootIfNeeded(nullptr);
115ef361136cea1e423dc462d2b347923ae60b2cf08Casey Dahlin  if (!ret) {
116ef361136cea1e423dc462d2b347923ae60b2cf08Casey Dahlin    // Reboot error code doesn't necessarily mean that a reboot
117ef361136cea1e423dc462d2b347923ae60b2cf08Casey Dahlin    // failed. For example, D-Bus may be shutdown before we receive the
118ef361136cea1e423dc462d2b347923ae60b2cf08Casey Dahlin    // result.
119ef361136cea1e423dc462d2b347923ae60b2cf08Casey Dahlin    LOG(INFO) << "RebootIfNeeded() failure ignored.";
120ef361136cea1e423dc462d2b347923ae60b2cf08Casey Dahlin  }
121ef361136cea1e423dc462d2b347923ae60b2cf08Casey Dahlin}
122ef361136cea1e423dc462d2b347923ae60b2cf08Casey Dahlin
123a93cd53c4f8ab8cb926ed9223373567ebbf45cb6Casey Dahlinbool DBusUpdateEngineClient::ResetStatus() {
124e844c1a5604765bbddafa7e05f1143a27f136747Casey Dahlin  return proxy_->ResetStatus(nullptr);
125e844c1a5604765bbddafa7e05f1143a27f136747Casey Dahlin}
126e844c1a5604765bbddafa7e05f1143a27f136747Casey Dahlin
127492eaf5067c88db3477538d935ffb0a0ec0c1936Alex Deymovoid DBusUpdateEngineClient::DBusStatusHandlersRegistered(
128a93cd53c4f8ab8cb926ed9223373567ebbf45cb6Casey Dahlin    const string& interface,
129a93cd53c4f8ab8cb926ed9223373567ebbf45cb6Casey Dahlin    const string& signal_name,
130a93cd53c4f8ab8cb926ed9223373567ebbf45cb6Casey Dahlin    bool success) const {
13197c870518ce1149b32966d98ebfe93f3eb5d1fefCasey Dahlin  if (!success) {
132a715f7b8a211b5c4b74206539e9aa7ddacf4b243Casey Dahlin    for (auto handler : handlers_) {
133a715f7b8a211b5c4b74206539e9aa7ddacf4b243Casey Dahlin      handler->IPCError("Could not connect to" + signal_name +
134a715f7b8a211b5c4b74206539e9aa7ddacf4b243Casey Dahlin                        " on " + interface);
135a715f7b8a211b5c4b74206539e9aa7ddacf4b243Casey Dahlin    }
136a715f7b8a211b5c4b74206539e9aa7ddacf4b243Casey Dahlin  } else {
137a715f7b8a211b5c4b74206539e9aa7ddacf4b243Casey Dahlin    StatusUpdateHandlersRegistered(nullptr);
13897c870518ce1149b32966d98ebfe93f3eb5d1fefCasey Dahlin  }
139a715f7b8a211b5c4b74206539e9aa7ddacf4b243Casey Dahlin}
14097c870518ce1149b32966d98ebfe93f3eb5d1fefCasey Dahlin
141a715f7b8a211b5c4b74206539e9aa7ddacf4b243Casey Dahlinvoid DBusUpdateEngineClient::StatusUpdateHandlersRegistered(
142a715f7b8a211b5c4b74206539e9aa7ddacf4b243Casey Dahlin    StatusUpdateHandler* handler) const {
14397c870518ce1149b32966d98ebfe93f3eb5d1fefCasey Dahlin  int64_t last_checked_time;
14497c870518ce1149b32966d98ebfe93f3eb5d1fefCasey Dahlin  double progress;
14597c870518ce1149b32966d98ebfe93f3eb5d1fefCasey Dahlin  UpdateStatus update_status;
14697c870518ce1149b32966d98ebfe93f3eb5d1fefCasey Dahlin  string new_version;
14797c870518ce1149b32966d98ebfe93f3eb5d1fefCasey Dahlin  int64_t new_size;
14897c870518ce1149b32966d98ebfe93f3eb5d1fefCasey Dahlin
149a715f7b8a211b5c4b74206539e9aa7ddacf4b243Casey Dahlin  if (!GetStatus(&last_checked_time,
150a715f7b8a211b5c4b74206539e9aa7ddacf4b243Casey Dahlin                 &progress,
151a715f7b8a211b5c4b74206539e9aa7ddacf4b243Casey Dahlin                 &update_status,
152a715f7b8a211b5c4b74206539e9aa7ddacf4b243Casey Dahlin                 &new_version,
153a715f7b8a211b5c4b74206539e9aa7ddacf4b243Casey Dahlin                 &new_size)) {
154a715f7b8a211b5c4b74206539e9aa7ddacf4b243Casey Dahlin    handler->IPCError("Could not query current status");
15597c870518ce1149b32966d98ebfe93f3eb5d1fefCasey Dahlin    return;
15697c870518ce1149b32966d98ebfe93f3eb5d1fefCasey Dahlin  }
15797c870518ce1149b32966d98ebfe93f3eb5d1fefCasey Dahlin
158492eaf5067c88db3477538d935ffb0a0ec0c1936Alex Deymo  std::vector<update_engine::StatusUpdateHandler*> just_handler = {handler};
159492eaf5067c88db3477538d935ffb0a0ec0c1936Alex Deymo  for (auto h : handler ? just_handler : handlers_) {
160a715f7b8a211b5c4b74206539e9aa7ddacf4b243Casey Dahlin    h->HandleStatusUpdate(
161a715f7b8a211b5c4b74206539e9aa7ddacf4b243Casey Dahlin        last_checked_time, progress, update_status, new_version, new_size);
162a715f7b8a211b5c4b74206539e9aa7ddacf4b243Casey Dahlin  }
16397c870518ce1149b32966d98ebfe93f3eb5d1fefCasey Dahlin}
16497c870518ce1149b32966d98ebfe93f3eb5d1fefCasey Dahlin
165a715f7b8a211b5c4b74206539e9aa7ddacf4b243Casey Dahlinvoid DBusUpdateEngineClient::RunStatusUpdateHandlers(
166a93cd53c4f8ab8cb926ed9223373567ebbf45cb6Casey Dahlin    int64_t last_checked_time,
167a93cd53c4f8ab8cb926ed9223373567ebbf45cb6Casey Dahlin    double progress,
168a93cd53c4f8ab8cb926ed9223373567ebbf45cb6Casey Dahlin    const string& current_operation,
169a93cd53c4f8ab8cb926ed9223373567ebbf45cb6Casey Dahlin    const string& new_version,
17097c870518ce1149b32966d98ebfe93f3eb5d1fefCasey Dahlin    int64_t new_size) {
17197c870518ce1149b32966d98ebfe93f3eb5d1fefCasey Dahlin  UpdateStatus status;
17297c870518ce1149b32966d98ebfe93f3eb5d1fefCasey Dahlin  StringToUpdateStatus(current_operation, &status);
17397c870518ce1149b32966d98ebfe93f3eb5d1fefCasey Dahlin
174a715f7b8a211b5c4b74206539e9aa7ddacf4b243Casey Dahlin  for (auto handler : handlers_) {
175a715f7b8a211b5c4b74206539e9aa7ddacf4b243Casey Dahlin    handler->HandleStatusUpdate(
176a715f7b8a211b5c4b74206539e9aa7ddacf4b243Casey Dahlin        last_checked_time, progress, status, new_version, new_size);
177a715f7b8a211b5c4b74206539e9aa7ddacf4b243Casey Dahlin  }
178a715f7b8a211b5c4b74206539e9aa7ddacf4b243Casey Dahlin}
179a715f7b8a211b5c4b74206539e9aa7ddacf4b243Casey Dahlin
180a715f7b8a211b5c4b74206539e9aa7ddacf4b243Casey Dahlinbool DBusUpdateEngineClient::UnregisterStatusUpdateHandler(
181a715f7b8a211b5c4b74206539e9aa7ddacf4b243Casey Dahlin    StatusUpdateHandler* handler) {
182b3fa53bf760bd0a6fd1ef9df28cb425586d733f6Alex Deymo  auto it = std::find(handlers_.begin(), handlers_.end(), handler);
183a715f7b8a211b5c4b74206539e9aa7ddacf4b243Casey Dahlin  if (it != handlers_.end()) {
184a715f7b8a211b5c4b74206539e9aa7ddacf4b243Casey Dahlin    handlers_.erase(it);
185a715f7b8a211b5c4b74206539e9aa7ddacf4b243Casey Dahlin    return true;
186a715f7b8a211b5c4b74206539e9aa7ddacf4b243Casey Dahlin  }
187a715f7b8a211b5c4b74206539e9aa7ddacf4b243Casey Dahlin
188a715f7b8a211b5c4b74206539e9aa7ddacf4b243Casey Dahlin  return false;
18997c870518ce1149b32966d98ebfe93f3eb5d1fefCasey Dahlin}
19097c870518ce1149b32966d98ebfe93f3eb5d1fefCasey Dahlin
19140892497a9b1ea124058baf09f5f2873a15cb696Casey Dahlinbool DBusUpdateEngineClient::RegisterStatusUpdateHandler(
19297c870518ce1149b32966d98ebfe93f3eb5d1fefCasey Dahlin    StatusUpdateHandler* handler) {
193194414134a954d921c8063610304c4fd21f19df2Casey Dahlin  if (!base::MessageLoopForIO::current()) {
194194414134a954d921c8063610304c4fd21f19df2Casey Dahlin    LOG(FATAL) << "Cannot get UpdateEngineClient outside of message loop.";
19540892497a9b1ea124058baf09f5f2873a15cb696Casey Dahlin    return false;
196194414134a954d921c8063610304c4fd21f19df2Casey Dahlin  }
197194414134a954d921c8063610304c4fd21f19df2Casey Dahlin
198a715f7b8a211b5c4b74206539e9aa7ddacf4b243Casey Dahlin  handlers_.push_back(handler);
199a715f7b8a211b5c4b74206539e9aa7ddacf4b243Casey Dahlin
200a715f7b8a211b5c4b74206539e9aa7ddacf4b243Casey Dahlin  if (dbus_handler_registered_) {
201a715f7b8a211b5c4b74206539e9aa7ddacf4b243Casey Dahlin    StatusUpdateHandlersRegistered(handler);
202a715f7b8a211b5c4b74206539e9aa7ddacf4b243Casey Dahlin    return true;
203a715f7b8a211b5c4b74206539e9aa7ddacf4b243Casey Dahlin  }
204a715f7b8a211b5c4b74206539e9aa7ddacf4b243Casey Dahlin
20597c870518ce1149b32966d98ebfe93f3eb5d1fefCasey Dahlin  proxy_->RegisterStatusUpdateSignalHandler(
206a715f7b8a211b5c4b74206539e9aa7ddacf4b243Casey Dahlin      base::Bind(&DBusUpdateEngineClient::RunStatusUpdateHandlers,
207a715f7b8a211b5c4b74206539e9aa7ddacf4b243Casey Dahlin                 base::Unretained(this)),
208492eaf5067c88db3477538d935ffb0a0ec0c1936Alex Deymo      base::Bind(&DBusUpdateEngineClient::DBusStatusHandlersRegistered,
209492eaf5067c88db3477538d935ffb0a0ec0c1936Alex Deymo                 base::Unretained(this)));
210a715f7b8a211b5c4b74206539e9aa7ddacf4b243Casey Dahlin
211a715f7b8a211b5c4b74206539e9aa7ddacf4b243Casey Dahlin  dbus_handler_registered_ = true;
21240892497a9b1ea124058baf09f5f2873a15cb696Casey Dahlin
21340892497a9b1ea124058baf09f5f2873a15cb696Casey Dahlin  return true;
21497c870518ce1149b32966d98ebfe93f3eb5d1fefCasey Dahlin}
21597c870518ce1149b32966d98ebfe93f3eb5d1fefCasey Dahlin
216a93cd53c4f8ab8cb926ed9223373567ebbf45cb6Casey Dahlinbool DBusUpdateEngineClient::SetTargetChannel(const string& in_target_channel,
21787ab88e35fac5d3ded1c70c8911d307ec47a7db9Casey Dahlin                                              bool allow_powerwash) {
21897c870518ce1149b32966d98ebfe93f3eb5d1fefCasey Dahlin  return proxy_->SetChannel(in_target_channel, allow_powerwash, nullptr);
21916daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley}
22016daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley
221a93cd53c4f8ab8cb926ed9223373567ebbf45cb6Casey Dahlinbool DBusUpdateEngineClient::GetTargetChannel(string* out_channel) const {
22297c870518ce1149b32966d98ebfe93f3eb5d1fefCasey Dahlin  return proxy_->GetChannel(false,  // Get the target channel.
223a93cd53c4f8ab8cb926ed9223373567ebbf45cb6Casey Dahlin                            out_channel,
224a93cd53c4f8ab8cb926ed9223373567ebbf45cb6Casey Dahlin                            nullptr);
22516daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley}
22616daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley
227a93cd53c4f8ab8cb926ed9223373567ebbf45cb6Casey Dahlinbool DBusUpdateEngineClient::GetChannel(string* out_channel) const {
22897c870518ce1149b32966d98ebfe93f3eb5d1fefCasey Dahlin  return proxy_->GetChannel(true,  // Get the current channel.
229a93cd53c4f8ab8cb926ed9223373567ebbf45cb6Casey Dahlin                            out_channel,
230a93cd53c4f8ab8cb926ed9223373567ebbf45cb6Casey Dahlin                            nullptr);
23116daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley}
23216daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley
2332997173235e88c5e4cb13d2844f74afc7b25d6e2Shuqian Zhaobool DBusUpdateEngineClient::GetLastAttemptError(
2342997173235e88c5e4cb13d2844f74afc7b25d6e2Shuqian Zhao    int32_t* last_attempt_error) const {
2352997173235e88c5e4cb13d2844f74afc7b25d6e2Shuqian Zhao  return proxy_->GetLastAttemptError(last_attempt_error, nullptr);
2362997173235e88c5e4cb13d2844f74afc7b25d6e2Shuqian Zhao}
2372997173235e88c5e4cb13d2844f74afc7b25d6e2Shuqian Zhao
238b3fa53bf760bd0a6fd1ef9df28cb425586d733f6Alex Deymobool DBusUpdateEngineClient::GetEolStatus(int32_t* eol_status) const {
239b3fa53bf760bd0a6fd1ef9df28cb425586d733f6Alex Deymo  return proxy_->GetEolStatus(eol_status, nullptr);
240b3fa53bf760bd0a6fd1ef9df28cb425586d733f6Alex Deymo}
241b3fa53bf760bd0a6fd1ef9df28cb425586d733f6Alex Deymo
24216daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley}  // namespace internal
24316daa08470beb5021b85618f1b3ee214d89e59a1Christopher Wiley}  // namespace update_engine
244