diff options
-rw-r--r-- | Android.mk | 27 | ||||
-rw-r--r-- | binder_service_android.h | 3 | ||||
-rw-r--r-- | binder_service_brillo.h | 2 | ||||
-rw-r--r-- | common_service.cc | 2 | ||||
-rw-r--r-- | daemon.cc | 8 | ||||
-rw-r--r-- | daemon.h | 8 | ||||
-rw-r--r-- | dbus_service.h | 3 | ||||
-rw-r--r-- | fake_system_state.h | 2 | ||||
-rw-r--r-- | real_system_state.cc | 5 | ||||
-rw-r--r-- | real_system_state.h | 7 | ||||
-rw-r--r-- | service_observer_interface.h | 3 | ||||
-rw-r--r-- | sideload_main.cc | 2 | ||||
-rw-r--r-- | system_state.h | 4 | ||||
-rw-r--r-- | update_attempter.cc | 47 | ||||
-rw-r--r-- | update_attempter.h | 15 | ||||
-rw-r--r-- | update_engine.gyp | 13 | ||||
-rw-r--r-- | update_status_utils.cc | 43 | ||||
-rw-r--r-- | update_status_utils.h | 4 | ||||
-rw-r--r-- | weave_service.cc | 133 | ||||
-rw-r--r-- | weave_service.h | 66 | ||||
-rw-r--r-- | weave_service_factory.cc | 40 | ||||
-rw-r--r-- | weave_service_factory.h | 35 | ||||
-rw-r--r-- | weave_service_interface.h | 62 | ||||
-rw-r--r-- | weaved/traits/updater.json | 52 |
24 files changed, 9 insertions, 577 deletions
@@ -26,7 +26,6 @@ local_use_hwid_override := \ # the system layer. local_use_libcros := $(if $(BRILLO_USE_LIBCROS),$(BRILLO_USE_LIBCROS),0) local_use_mtd := $(if $(BRILLO_USE_MTD),$(BRILLO_USE_MTD),0) -local_use_weave := $(if $(BRILLO_USE_WEAVE),$(BRILLO_USE_WEAVE),0) # IoT devices use Omaha for updates. local_use_omaha := $(if $(filter true,$(PRODUCT_IOT)),1,0) @@ -37,7 +36,6 @@ ue_common_cflags := \ -DUSE_LIBCROS=$(local_use_libcros) \ -DUSE_MTD=$(local_use_mtd) \ -DUSE_OMAHA=$(local_use_omaha) \ - -DUSE_WEAVE=$(local_use_weave) \ -D_FILE_OFFSET_BITS=64 \ -D_POSIX_C_SOURCE=199309L \ -Wa,--noexecstack \ @@ -260,12 +258,6 @@ ue_libupdate_engine_exported_shared_libraries += \ libbrillo-binder \ libutils endif # local_use_binder == 1 -ifeq ($(local_use_weave),1) -ue_libupdate_engine_exported_shared_libraries += \ - libbinderwrapper \ - libbrillo-binder \ - libweaved -endif # local_use_weave == 1 include $(CLEAR_VARS) LOCAL_MODULE := libupdate_engine @@ -327,8 +319,7 @@ LOCAL_SRC_FILES := \ update_manager/state_factory.cc \ update_manager/update_manager.cc \ update_status_utils.cc \ - utils_android.cc \ - weave_service_factory.cc + utils_android.cc ifeq ($(local_use_binder),1) LOCAL_AIDL_INCLUDES += $(LOCAL_PATH)/binder_bindings LOCAL_SRC_FILES += \ @@ -337,10 +328,6 @@ LOCAL_SRC_FILES += \ binder_service_brillo.cc \ parcelable_update_engine_status.cc endif # local_use_binder == 1 -ifeq ($(local_use_weave),1) -LOCAL_SRC_FILES += \ - weave_service.cc -endif # local_use_weave == 1 ifeq ($(local_use_libcros),1) LOCAL_SRC_FILES += \ chrome_browser_proxy_resolver.cc @@ -425,9 +412,6 @@ LOCAL_MODULE := update_engine LOCAL_MODULE_CLASS := EXECUTABLES LOCAL_REQUIRED_MODULES := \ cacerts_google -ifeq ($(local_use_weave),1) -LOCAL_REQUIRED_MODULES += updater.json -endif # local_use_weave == 1 LOCAL_CPP_EXTENSION := .cc LOCAL_CLANG := true LOCAL_CFLAGS := $(ue_common_cflags) @@ -1037,15 +1021,6 @@ LOCAL_SRC_FILES += \ endif # local_use_libcros == 1 include $(BUILD_NATIVE_TEST) -# Weave schema files -# ======================================================== -include $(CLEAR_VARS) -LOCAL_MODULE := updater.json -LOCAL_MODULE_CLASS := ETC -LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/weaved/traits -LOCAL_SRC_FILES := weaved/traits/$(LOCAL_MODULE) -include $(BUILD_PREBUILT) - # Update payload signing public key. # ======================================================== ifdef BRILLO diff --git a/binder_service_android.h b/binder_service_android.h index 3fb38bc5..3293c0e8 100644 --- a/binder_service_android.h +++ b/binder_service_android.h @@ -52,9 +52,6 @@ class BinderUpdateEngineAndroidService : public android::os::BnUpdateEngine, int64_t new_size) override; void SendPayloadApplicationComplete(ErrorCode error_code) override; - // Channel tracking changes are ignored. - void SendChannelChangeUpdate(const std::string& tracking_channel) override {} - // android::os::BnUpdateEngine overrides. android::binder::Status applyPayload( const android::String16& url, diff --git a/binder_service_brillo.h b/binder_service_brillo.h index fad0f8c0..982c7b18 100644 --- a/binder_service_brillo.h +++ b/binder_service_brillo.h @@ -52,8 +52,6 @@ class BinderUpdateEngineBrilloService : public android::brillo::BnUpdateEngine, const std::string& new_version, int64_t new_size) override; void SendPayloadApplicationComplete(ErrorCode error_code) override {} - // Channel tracking changes are ignored. - void SendChannelChangeUpdate(const std::string& tracking_channel) override {} // android::brillo::BnUpdateEngine overrides. android::binder::Status AttemptUpdate(const android::String16& app_version, diff --git a/common_service.cc b/common_service.cc index c2473b25..1a41b633 100644 --- a/common_service.cc +++ b/common_service.cc @@ -173,8 +173,6 @@ bool UpdateEngineService::SetChannel(ErrorPtr* error, LogAndSetError(error, FROM_HERE, error_message); return false; } - // Update the weave state because updated the target channel. - system_state_->update_attempter()->BroadcastChannel(); return true; } @@ -20,9 +20,9 @@ #include <base/bind.h> #include <base/location.h> -#if USE_WEAVE || USE_BINDER +#if USE_BINDER #include <binderwrapper/binder_wrapper.h> -#endif // USE_WEAVE || USE_BINDER +#endif // USE_BINDER #if USE_OMAHA #include "update_engine/real_system_state.h" @@ -41,10 +41,10 @@ int UpdateEngineDaemon::OnInit() { if (exit_code != EX_OK) return exit_code; -#if USE_WEAVE || USE_BINDER +#if USE_BINDER android::BinderWrapper::Create(); binder_watcher_.Init(); -#endif // USE_WEAVE || USE_BINDER +#endif // USE_BINDER #if USE_OMAHA // Initialize update engine global state but continue if something fails. @@ -20,9 +20,9 @@ #include <memory> #include <string> -#if USE_WEAVE || USE_BINDER +#if USE_BINDER #include <brillo/binder_watcher.h> -#endif // USE_WEAVE || USE_BINDER +#endif // USE_BINDER #include <brillo/daemons/daemon.h> #if USE_BINDER @@ -63,9 +63,9 @@ class UpdateEngineDaemon : public brillo::Daemon { // the main() function. Subprocess subprocess_; -#if USE_WEAVE || USE_BINDER +#if USE_BINDER brillo::BinderWatcher binder_watcher_; -#endif // USE_WEAVE || USE_BINDER +#endif // USE_BINDER #if USE_BINDER #if USE_OMAHA diff --git a/dbus_service.h b/dbus_service.h index 62984f6b..2b36ae9d 100644 --- a/dbus_service.h +++ b/dbus_service.h @@ -175,9 +175,6 @@ class UpdateEngineAdaptor : public org::chromium::UpdateEngineInterfaceAdaptor, void SendPayloadApplicationComplete(ErrorCode error_code) override {} - // Channel tracking changes are ignored. - void SendChannelChangeUpdate(const std::string& tracking_channel) override {} - private: scoped_refptr<dbus::Bus> bus_; DBusUpdateEngineService dbus_service_; diff --git a/fake_system_state.h b/fake_system_state.h index 030cb079..22259332 100644 --- a/fake_system_state.h +++ b/fake_system_state.h @@ -84,8 +84,6 @@ class FakeSystemState : public SystemState { return update_attempter_; } - inline WeaveServiceInterface* weave_service() override { return nullptr; } - inline OmahaRequestParams* request_params() override { return request_params_; } diff --git a/real_system_state.cc b/real_system_state.cc index 5fc0b71f..aab074f8 100644 --- a/real_system_state.cc +++ b/real_system_state.cc @@ -31,7 +31,6 @@ #include "update_engine/common/hardware.h" #include "update_engine/common/utils.h" #include "update_engine/update_manager/state_factory.h" -#include "update_engine/weave_service_factory.h" using brillo::MessageLoop; @@ -140,10 +139,6 @@ bool RealSystemState::Initialize() { new UpdateAttempter(this, certificate_checker_.get(), libcros_proxy)); update_attempter_->Init(); - weave_service_ = ConstructWeaveService(update_attempter_.get()); - if (weave_service_) - update_attempter_->AddObserver(weave_service_.get()); - // Initialize the Update Manager using the default state factory. chromeos_update_manager::State* um_state = chromeos_update_manager::DefaultStateFactory( diff --git a/real_system_state.h b/real_system_state.h index 0964f100..270d8d21 100644 --- a/real_system_state.h +++ b/real_system_state.h @@ -37,7 +37,6 @@ #include "update_engine/power_manager_interface.h" #include "update_engine/update_attempter.h" #include "update_engine/update_manager/update_manager.h" -#include "update_engine/weave_service_interface.h" namespace chromeos_update_engine { @@ -106,10 +105,6 @@ class RealSystemState : public SystemState, public DaemonStateInterface { return update_attempter_.get(); } - inline WeaveServiceInterface* weave_service() override { - return weave_service_.get(); - } - inline OmahaRequestParams* request_params() override { return &request_params_; } @@ -176,8 +171,6 @@ class RealSystemState : public SystemState, public DaemonStateInterface { std::unique_ptr<P2PManager> p2p_manager_; - std::unique_ptr<WeaveServiceInterface> weave_service_; - std::unique_ptr<chromeos_update_manager::UpdateManager> update_manager_; policy::PolicyProvider policy_provider_; diff --git a/service_observer_interface.h b/service_observer_interface.h index 75a739ff..893df044 100644 --- a/service_observer_interface.h +++ b/service_observer_interface.h @@ -40,9 +40,6 @@ class ServiceObserverInterface { // Called whenever an update attempt is completed. virtual void SendPayloadApplicationComplete(ErrorCode error_code) = 0; - // Called whenever the channel we are tracking changes. - virtual void SendChannelChangeUpdate(const std::string& tracking_channel) = 0; - protected: ServiceObserverInterface() = default; }; diff --git a/sideload_main.cc b/sideload_main.cc index d02af0e9..574d0625 100644 --- a/sideload_main.cc +++ b/sideload_main.cc @@ -112,8 +112,6 @@ class SideloadDaemonState : public DaemonStateInterface, brillo::MessageLoop::current()->BreakLoop(); } - void SendChannelChangeUpdate(const string& tracking_channel) override {} - // Getters. UpdateStatus status() { return status_; } ErrorCode error_code() { return error_code_; } diff --git a/system_state.h b/system_state.h index 4d040ec0..d5384274 100644 --- a/system_state.h +++ b/system_state.h @@ -46,7 +46,6 @@ class PayloadStateInterface; class PowerManagerInterface; class PrefsInterface; class UpdateAttempter; -class WeaveServiceInterface; // An interface to global system context, including platform resources, // the current state of the system, high-level objects whose lifetime is same @@ -94,9 +93,6 @@ class SystemState { // Returns a pointer to the update attempter object. virtual UpdateAttempter* update_attempter() = 0; - // Returns a pointer to the WeaveServiceInterface class or nullptr if none. - virtual WeaveServiceInterface* weave_service() = 0; - // Returns a pointer to the object that stores the parameters that are // common to all Omaha requests. virtual OmahaRequestParams* request_params() = 0; diff --git a/update_attempter.cc b/update_attempter.cc index d36f7fd4..1bdd0eb6 100644 --- a/update_attempter.cc +++ b/update_attempter.cc @@ -409,8 +409,6 @@ bool UpdateAttempter::CalculateUpdateParams(const string& app_version, &error_message)) { LOG(ERROR) << "Setting the channel failed: " << error_message; } - // Notify observers the target channel change. - BroadcastChannel(); // Since this is the beginning of a new attempt, update the download // channel. The download channel won't be updated until the next attempt, @@ -1066,44 +1064,6 @@ void UpdateAttempter::DownloadComplete() { system_state_->payload_state()->DownloadComplete(); } -bool UpdateAttempter::OnCheckForUpdates(brillo::ErrorPtr* error) { - CheckForUpdate( - "" /* app_version */, "" /* omaha_url */, true /* interactive */); - return true; -} - -bool UpdateAttempter::OnTrackChannel(const string& channel, - brillo::ErrorPtr* error) { - LOG(INFO) << "Setting destination channel to: " << channel; - string error_message; - if (!system_state_->request_params()->SetTargetChannel( - channel, false /* powerwash_allowed */, &error_message)) { - brillo::Error::AddTo(error, - FROM_HERE, - brillo::errors::dbus::kDomain, - "set_target_error", - error_message); - return false; - } - // Notify observers the target channel change. - BroadcastChannel(); - return true; -} - -bool UpdateAttempter::GetWeaveState(int64_t* last_checked_time, - double* progress, - UpdateStatus* update_status, - string* current_channel, - string* tracking_channel) { - *last_checked_time = last_checked_time_; - *progress = download_progress_; - *update_status = status_; - OmahaRequestParams* rp = system_state_->request_params(); - *current_channel = rp->current_channel(); - *tracking_channel = rp->target_channel(); - return true; -} - void UpdateAttempter::ProgressUpdate(double progress) { // Self throttle based on progress. Also send notifications if progress is // too slow. @@ -1221,13 +1181,6 @@ void UpdateAttempter::BroadcastStatus() { last_notify_time_ = TimeTicks::Now(); } -void UpdateAttempter::BroadcastChannel() { - for (const auto& observer : service_observers_) { - observer->SendChannelChangeUpdate( - system_state_->request_params()->target_channel()); - } -} - uint32_t UpdateAttempter::GetErrorCodeFlags() { uint32_t flags = 0; diff --git a/update_attempter.h b/update_attempter.h index 104975c7..f6547fe0 100644 --- a/update_attempter.h +++ b/update_attempter.h @@ -45,7 +45,6 @@ #include "update_engine/system_state.h" #include "update_engine/update_manager/policy.h" #include "update_engine/update_manager/update_manager.h" -#include "update_engine/weave_service_interface.h" class MetricsLibraryInterface; @@ -61,7 +60,6 @@ class UpdateEngineAdaptor; class UpdateAttempter : public ActionProcessorDelegate, public DownloadActionDelegate, public CertificateChecker::Observer, - public WeaveServiceInterface::DelegateInterface, public PostinstallRunnerAction::DelegateInterface { public: using UpdateStatus = update_engine::UpdateStatus; @@ -100,16 +98,6 @@ class UpdateAttempter : public ActionProcessorDelegate, AbstractAction* action, ErrorCode code) override; - // WeaveServiceInterface::DelegateInterface overrides. - bool OnCheckForUpdates(brillo::ErrorPtr* error) override; - bool OnTrackChannel(const std::string& channel, - brillo::ErrorPtr* error) override; - bool GetWeaveState(int64_t* last_checked_time, - double* progress, - UpdateStatus* update_status, - std::string* current_channel, - std::string* tracking_channel) override; - // PostinstallRunnerAction::DelegateInterface void ProgressUpdate(double progress) override; @@ -181,9 +169,6 @@ class UpdateAttempter : public ActionProcessorDelegate, // Broadcasts the current status to all observers. void BroadcastStatus(); - // Broadcasts the current tracking channel to all observers. - void BroadcastChannel(); - // Returns the special flags to be added to ErrorCode values based on the // parameters used in the current update attempt. uint32_t GetErrorCodeFlags(); diff --git a/update_engine.gyp b/update_engine.gyp index 31296a5e..8ca46c10 100644 --- a/update_engine.gyp +++ b/update_engine.gyp @@ -29,7 +29,6 @@ 'USE_libcros%': '1', 'USE_mtd%': '0', 'USE_power_management%': '0', - 'USE_buffet%': '0', }, 'cflags': [ '-g', @@ -57,7 +56,6 @@ 'USE_MTD=<(USE_mtd)', 'USE_OMAHA=1', 'USE_SHILL=1', - 'USE_WEAVE=<(USE_buffet)', ], 'include_dirs': [ # We need this include dir because we include all the local code as @@ -287,19 +285,8 @@ 'update_manager/state_factory.cc', 'update_manager/update_manager.cc', 'update_status_utils.cc', - 'weave_service_factory.cc', ], 'conditions': [ - ['USE_buffet == 1', { - 'sources': [ - 'weave_service.cc', - ], - 'variables': { - 'exported_deps': [ - 'libweave-<(libbase_ver)', - ], - }, - }], ['USE_libcros == 1', { 'dependencies': [ 'update_engine-other-dbus-proxies', diff --git a/update_status_utils.cc b/update_status_utils.cc index 96858531..ff039b8c 100644 --- a/update_status_utils.cc +++ b/update_status_utils.cc @@ -20,21 +20,6 @@ using update_engine::UpdateStatus; -namespace { - -const char kWeaveStatusIdle[] = "idle"; -const char kWeaveStatusCheckingForUpdate[] = "checkingForUpdate"; -const char kWeaveStatusUpdateAvailable[] = "updateAvailable"; -const char kWeaveStatusDownloading[] = "downloading"; -const char kWeaveStatusVerifying[] = "verifying"; -const char kWeaveStatusFinalizing[] = "finalizing"; -const char kWeaveStatusUpdatedNeedReboot[] = "updatedNeedReboot"; -const char kWeaveStatusReportingErrorEvent[] = "reportingErrorEvent"; -const char kWeaveStatusAttemptingRollback[] = "attemptingRollback"; -const char kWeaveStatusDisabled[] = "disabled"; - -} // namespace - namespace chromeos_update_engine { const char* UpdateStatusToString(const UpdateStatus& status) { @@ -65,34 +50,6 @@ const char* UpdateStatusToString(const UpdateStatus& status) { return nullptr; } -const char* UpdateStatusToWeaveStatus(const UpdateStatus& status) { - switch (status) { - case UpdateStatus::IDLE: - return kWeaveStatusIdle; - case UpdateStatus::CHECKING_FOR_UPDATE: - return kWeaveStatusCheckingForUpdate; - case UpdateStatus::UPDATE_AVAILABLE: - return kWeaveStatusUpdateAvailable; - case UpdateStatus::DOWNLOADING: - return kWeaveStatusDownloading; - case UpdateStatus::VERIFYING: - return kWeaveStatusVerifying; - case UpdateStatus::FINALIZING: - return kWeaveStatusFinalizing; - case UpdateStatus::UPDATED_NEED_REBOOT: - return kWeaveStatusUpdatedNeedReboot; - case UpdateStatus::REPORTING_ERROR_EVENT: - return kWeaveStatusReportingErrorEvent; - case UpdateStatus::ATTEMPTING_ROLLBACK: - return kWeaveStatusAttemptingRollback; - case UpdateStatus::DISABLED: - return kWeaveStatusDisabled; - } - - NOTREACHED(); - return nullptr; -} - bool StringToUpdateStatus(const std::string& s, UpdateStatus* status) { if (s == update_engine::kUpdateStatusIdle) { diff --git a/update_status_utils.h b/update_status_utils.h index 9d851441..30ae53b7 100644 --- a/update_status_utils.h +++ b/update_status_utils.h @@ -25,10 +25,6 @@ namespace chromeos_update_engine { const char* UpdateStatusToString(const update_engine::UpdateStatus& status); -// Convert the UpdateStatus |status| to the string reported in the weave status. -const char* UpdateStatusToWeaveStatus( - const update_engine::UpdateStatus& status); - bool StringToUpdateStatus(const std::string& update_status_as_string, update_engine::UpdateStatus* status); diff --git a/weave_service.cc b/weave_service.cc deleted file mode 100644 index 0a145e4e..00000000 --- a/weave_service.cc +++ /dev/null @@ -1,133 +0,0 @@ -// -// Copyright (C) 2015 The Android Open Source Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -#include "update_engine/weave_service.h" - -#include <cmath> -#include <string> - -#include <base/bind.h> -#include <brillo/errors/error.h> -#include <brillo/message_loops/message_loop.h> - -#include "update_engine/update_status_utils.h" - -using std::string; - -namespace { - -const char kWeaveComponent[] = "updater"; -const char kWeaveTrait[] = "_updater"; - -} // namespace - -namespace chromeos_update_engine { - -bool WeaveService::Init(DelegateInterface* delegate) { - delegate_ = delegate; - weave_service_subscription_ = weaved::Service::Connect( - brillo::MessageLoop::current(), - base::Bind(&WeaveService::OnWeaveServiceConnected, - base::Unretained(this))); - return true; -} - -void WeaveService::OnWeaveServiceConnected( - const std::weak_ptr<weaved::Service>& service) { - weave_service_ = service; - auto weave_service = weave_service_.lock(); - if (!weave_service) - return; - - weave_service->AddComponent(kWeaveComponent, {kWeaveTrait}, nullptr); - weave_service->AddCommandHandler( - kWeaveComponent, kWeaveTrait, "checkForUpdates", - base::Bind(&WeaveService::OnCheckForUpdates, base::Unretained(this))); - weave_service->AddCommandHandler( - kWeaveComponent, kWeaveTrait, "trackChannel", - base::Bind(&WeaveService::OnTrackChannel, base::Unretained(this))); - UpdateWeaveState(); -} - -void WeaveService::SendStatusUpdate(int64_t /* last_checked_time */, - double /* progress */, - update_engine::UpdateStatus /* status */, - const string& /* new_version */, - int64_t /* new_size */) { - // We query the Weave - UpdateWeaveState(); -} - -void WeaveService::SendChannelChangeUpdate( - const string& /* tracking_channel */) { - UpdateWeaveState(); -} - -void WeaveService::UpdateWeaveState() { - auto weave_service = weave_service_.lock(); - if (!weave_service || !delegate_) - return; - - int64_t last_checked_time; - double progress; - update_engine::UpdateStatus update_status; - string current_channel; - string tracking_channel; - - if (!delegate_->GetWeaveState(&last_checked_time, - &progress, - &update_status, - ¤t_channel, - &tracking_channel)) - return; - - // Round to progress to 1% (0.01) to avoid excessive and meaningless state - // changes. - progress = std::floor(progress * 100.) / 100.; - - base::DictionaryValue state; - state.SetString("_updater.currentChannel", current_channel); - state.SetString("_updater.trackingChannel", tracking_channel); - state.SetString("_updater.status", UpdateStatusToWeaveStatus(update_status)); - state.SetDouble("_updater.progress", progress); - state.SetDouble("_updater.lastUpdateCheckTimestamp", - static_cast<double>(last_checked_time)); - - if (!weave_service->SetStateProperties(kWeaveComponent, state, nullptr)) { - LOG(ERROR) << "Failed to update _updater state."; - } -} - -void WeaveService::OnCheckForUpdates(std::unique_ptr<weaved::Command> command) { - brillo::ErrorPtr error; - if (!delegate_->OnCheckForUpdates(&error)) { - command->AbortWithCustomError(error.get(), nullptr); - return; - } - command->Complete({}, nullptr); -} - -void WeaveService::OnTrackChannel(std::unique_ptr<weaved::Command> command) { - string channel = command->GetParameter<string>("channel"); - brillo::ErrorPtr error; - if (!delegate_->OnTrackChannel(channel, &error)) { - command->AbortWithCustomError(error.get(), nullptr); - return; - } - command->Complete({}, nullptr); -} - -} // namespace chromeos_update_engine diff --git a/weave_service.h b/weave_service.h deleted file mode 100644 index 5a3aff3f..00000000 --- a/weave_service.h +++ /dev/null @@ -1,66 +0,0 @@ -// -// Copyright (C) 2015 The Android Open Source Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -#ifndef UPDATE_ENGINE_WEAVE_SERVICE_H_ -#define UPDATE_ENGINE_WEAVE_SERVICE_H_ - -#include <memory> -#include <string> - -#include <base/memory/weak_ptr.h> -#include <libweaved/command.h> -#include <libweaved/service.h> - -#include "update_engine/weave_service_interface.h" - -namespace chromeos_update_engine { - -class WeaveService : public WeaveServiceInterface { - public: - WeaveService() = default; - ~WeaveService() override = default; - - bool Init(DelegateInterface* delegate); - - // ServiceObserverInterface overrides. - void SendStatusUpdate(int64_t last_checked_time, - double progress, - update_engine::UpdateStatus status, - const std::string& new_version, - int64_t new_size) override; - void SendChannelChangeUpdate(const std::string& tracking_channel) override; - void SendPayloadApplicationComplete(ErrorCode error_code) override {} - - private: - // Force a weave update. - void UpdateWeaveState(); - - void OnWeaveServiceConnected(const std::weak_ptr<weaved::Service>& service); - - // Weave command handlers. These are called from the message loop whenever a - // command is received and dispatch the synchronous call to the |delegate_|. - void OnCheckForUpdates(std::unique_ptr<weaved::Command> cmd); - void OnTrackChannel(std::unique_ptr<weaved::Command> cmd); - - WeaveServiceInterface::DelegateInterface* delegate_{nullptr}; - - std::unique_ptr<weaved::Service::Subscription> weave_service_subscription_; - std::weak_ptr<weaved::Service> weave_service_; -}; - -} // namespace chromeos_update_engine - -#endif // UPDATE_ENGINE_WEAVE_SERVICE_H_ diff --git a/weave_service_factory.cc b/weave_service_factory.cc deleted file mode 100644 index 24b9b792..00000000 --- a/weave_service_factory.cc +++ /dev/null @@ -1,40 +0,0 @@ -// -// Copyright (C) 2015 The Android Open Source Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -#include "update_engine/weave_service_factory.h" - -#if USE_WEAVE -#include "update_engine/weave_service.h" -#endif - -namespace chromeos_update_engine { - -std::unique_ptr<WeaveServiceInterface> ConstructWeaveService( - WeaveServiceInterface::DelegateInterface* delegate) { - std::unique_ptr<WeaveServiceInterface> result; - if (!delegate) - return result; - -#if USE_WEAVE - WeaveService* weave_service = new WeaveService(); - result.reset(weave_service); - if (!weave_service->Init(delegate)) - result.reset(); -#endif - return result; -} - -} // namespace chromeos_update_engine diff --git a/weave_service_factory.h b/weave_service_factory.h deleted file mode 100644 index 7b129ab3..00000000 --- a/weave_service_factory.h +++ /dev/null @@ -1,35 +0,0 @@ -// -// Copyright (C) 2015 The Android Open Source Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -#ifndef UPDATE_ENGINE_WEAVE_SERVICE_FACTORY_H_ -#define UPDATE_ENGINE_WEAVE_SERVICE_FACTORY_H_ - -#include <memory> - -#include <base/memory/ref_counted.h> - -#include "update_engine/weave_service_interface.h" - -namespace chromeos_update_engine { - -// Create a new WeaveServiceInterface instance. In case of error or when weaved -// is disabled, returns an empty pointer. -std::unique_ptr<WeaveServiceInterface> ConstructWeaveService( - WeaveServiceInterface::DelegateInterface* delegate); - -} // namespace chromeos_update_engine - -#endif // UPDATE_ENGINE_WEAVE_SERVICE_FACTORY_H_ diff --git a/weave_service_interface.h b/weave_service_interface.h deleted file mode 100644 index a7e603e4..00000000 --- a/weave_service_interface.h +++ /dev/null @@ -1,62 +0,0 @@ -// -// Copyright (C) 2015 The Android Open Source Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -#ifndef UPDATE_ENGINE_WEAVE_SERVICE_INTERFACE_H_ -#define UPDATE_ENGINE_WEAVE_SERVICE_INTERFACE_H_ - -#include <string> - -#include <brillo/errors/error.h> - -#include "update_engine/client_library/include/update_engine/update_status.h" -#include "update_engine/service_observer_interface.h" - -namespace chromeos_update_engine { - -// A WeaveServiceInterface instance allows to register the daemon with weaved, -// handle commands and update the weave status. This class only handles the -// registration with weaved and the connection, the actual work to handle the -// commands is implemented by the DelegateInterface, which will be called from -// this class. -class WeaveServiceInterface : public ServiceObserverInterface { - public: - // The delegate class that actually handles the command execution from - class DelegateInterface { - public: - virtual ~DelegateInterface() = default; - - virtual bool OnCheckForUpdates(brillo::ErrorPtr* error) = 0; - - virtual bool OnTrackChannel(const std::string& channel, - brillo::ErrorPtr* error) = 0; - - // Return the current status. - virtual bool GetWeaveState(int64_t* last_checked_time, - double* progress, - update_engine::UpdateStatus* update_status, - std::string* current_channel, - std::string* tracking_channel) = 0; - }; - - virtual ~WeaveServiceInterface() = default; - - protected: - WeaveServiceInterface() = default; -}; - -} // namespace chromeos_update_engine - -#endif // UPDATE_ENGINE_WEAVE_SERVICE_INTERFACE_H_ diff --git a/weaved/traits/updater.json b/weaved/traits/updater.json deleted file mode 100644 index 52b1a556..00000000 --- a/weaved/traits/updater.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "_updater": { - "commands": { - "checkForUpdates": { - "minimalRole": "manager", - "parameters": {} - }, - "trackChannel": { - "minimalRole": "manager", - "parameters": { - "channel": { - "type": "string", - "enum": ["stable-channel", "beta-channel", "dev-channel", "canary-channel"] - } - } - } - }, - "state": { - "currentChannel": { - "type": "string", - "enum": ["stable-channel", "beta-channel", "dev-channel", "canary-channel"] - }, - "trackingChannel": { - "type": "string", - "enum": ["stable-channel", "beta-channel", "dev-channel", "canary-channel"] - }, - "status": { - "type": "string", - "enum": [ - "idle", - "checkingForUpdate", - "updateAvailable", - "downloading", - "verifying", - "finalizing", - "updatedNeedReboot", - "reportingErrorEvent", - "attemptingRollback", - "disabled" - ] - }, - "progress": { - "type": "number", - "minimum": 0, - "maximum": 1 - }, - "lastUpdateCheckTimestamp": { - "type": "number" - } - } - } -} |