summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTao Bao <tbao@google.com>2017-08-04 00:27:28 +0200
committerandroid-build-merger <android-build-merger@google.com>2017-08-04 00:27:28 +0200
commit5ac17d1633c715254caf3661c5f4b8edf677db7f (patch)
treeecce5209a54b80e47fcdf959672755dcc5e32fee
parentui: Move the support for touch inputs into RecoveryUI. am: af9f8b4d97 (diff)
parentMerge "ui: Check for bootreason=recovery_ui." am: f49cc02e86 am: 7c0b8a4322 am: 7f5b514411 (diff)
downloadandroid_bootable_recovery-5ac17d1633c715254caf3661c5f4b8edf677db7f.tar
android_bootable_recovery-5ac17d1633c715254caf3661c5f4b8edf677db7f.tar.gz
android_bootable_recovery-5ac17d1633c715254caf3661c5f4b8edf677db7f.tar.bz2
android_bootable_recovery-5ac17d1633c715254caf3661c5f4b8edf677db7f.tar.lz
android_bootable_recovery-5ac17d1633c715254caf3661c5f4b8edf677db7f.tar.xz
android_bootable_recovery-5ac17d1633c715254caf3661c5f4b8edf677db7f.tar.zst
android_bootable_recovery-5ac17d1633c715254caf3661c5f4b8edf677db7f.zip
Diffstat (limited to '')
-rw-r--r--ui.cpp20
-rw-r--r--ui.h1
2 files changed, 21 insertions, 0 deletions
diff --git a/ui.cpp b/ui.cpp
index eadcdd433..e80d7ed04 100644
--- a/ui.cpp
+++ b/ui.cpp
@@ -69,6 +69,7 @@ RecoveryUI::RecoveryUI()
has_down_key(false),
has_touch_screen(false),
touch_slot_(0),
+ is_bootreason_recovery_ui_(false),
screensaver_state_(ScreensaverState::DISABLED) {
pthread_mutex_init(&key_queue_mutex, nullptr);
pthread_cond_init(&key_queue_cond, nullptr);
@@ -142,6 +143,19 @@ bool RecoveryUI::Init(const std::string& locale) {
if (touch_screen_allowed_) {
ev_iterate_touch_inputs(std::bind(&RecoveryUI::OnKeyDetected, this, std::placeholders::_1));
+
+ // Parse /proc/cmdline to determine if it's booting into recovery with a bootreason of
+ // "recovery_ui". This specific reason is set by some (wear) bootloaders, to allow an easier way
+ // to turn on text mode. It will only be set if the recovery boot is triggered from fastboot, or
+ // with 'adb reboot recovery'. Note that this applies to all build variants. Otherwise the text
+ // mode will be turned on automatically on debuggable builds, even without a swipe.
+ std::string cmdline;
+ if (android::base::ReadFileToString("/proc/cmdline", &cmdline)) {
+ is_bootreason_recovery_ui_ = cmdline.find("bootreason=recovery_ui") != std::string::npos;
+ } else {
+ // Non-fatal, and won't affect Init() result.
+ PLOG(WARNING) << "Failed to read /proc/cmdline";
+ }
}
if (!InitScreensaver()) {
@@ -168,6 +182,12 @@ void RecoveryUI::OnTouchDetected(int dx, int dy) {
return;
}
+ // Allow turning on text mode with any swipe, if bootloader has set a bootreason of recovery_ui.
+ if (is_bootreason_recovery_ui_ && !IsTextVisible()) {
+ ShowText(true);
+ return;
+ }
+
LOG(DEBUG) << "Swipe direction=" << direction;
switch (direction) {
case SwipeDirection::UP:
diff --git a/ui.h b/ui.h
index 5cda7af0f..3d9afece0 100644
--- a/ui.h
+++ b/ui.h
@@ -170,6 +170,7 @@ class RecoveryUI {
int touch_start_Y_;
bool touch_finger_down_;
bool touch_swiping_;
+ bool is_bootreason_recovery_ui_;
struct key_timer_t {
RecoveryUI* ui;