From b63a2215b5e3fc9c7254aa783c7857ede79e6f4e Mon Sep 17 00:00:00 2001 From: Tianjie Xu Date: Mon, 29 Jul 2019 14:21:49 -0700 Subject: Remove common.h Additionally kill the global variable: reason, stage; move them to a separate BootState class instead. Vendor specific recovery code will need to call getters from Device() class to access these variables. Bug: 137705917 Test: unit tests pass, boot sailfish into recovery, code search and no code includes common.h in vendor specific recovery. Change-Id: Ia50a5ea951212c25548562f29cc9cf78505b5e34 --- recovery_ui/device.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'recovery_ui/device.cpp') diff --git a/recovery_ui/device.cpp b/recovery_ui/device.cpp index e7ae1a3e1..d46df92d3 100644 --- a/recovery_ui/device.cpp +++ b/recovery_ui/device.cpp @@ -23,6 +23,7 @@ #include +#include "otautil/boot_state.h" #include "recovery_ui/ui.h" static std::vector> g_menu_actions{ @@ -95,3 +96,15 @@ int Device::HandleMenuKey(int key, bool visible) { return ui_->HasThreeButtons() ? kNoAction : kHighlightDown; } } + +void Device::SetBootState(const BootState* state) { + boot_state_ = state; +} + +std::optional Device::GetReason() const { + return boot_state_ ? std::make_optional(boot_state_->reason()) : std::nullopt; +} + +std::optional Device::GetStage() const { + return boot_state_ ? std::make_optional(boot_state_->stage()) : std::nullopt; +} -- cgit v1.2.3