aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Marshall <tdm.code@gmail.com>2019-12-05 10:20:18 -0800
committerTom Marshall <tdm.code@gmail.com>2019-12-05 10:22:28 -0800
commit13c4f098c6ddd7bd197dbae14ee4e164e5d2133f (patch)
tree3782aaac26f2c55f4bb5660661716714ba8cbd30
parent2a99d0cde307d964f40c4b4c18f42ce70b53b2c4 (diff)
downloadandroid_bootable_recovery-13c4f098c6ddd7bd197dbae14ee4e164e5d2133f.tar.gz
android_bootable_recovery-13c4f098c6ddd7bd197dbae14ee4e164e5d2133f.tar.bz2
android_bootable_recovery-13c4f098c6ddd7bd197dbae14ee4e164e5d2133f.zip
recovery: Show slot indicator for A/B devices
When running on an A/B device, split the top version line horizontally to show the Android version on the left and the boot slot on the right. When not running on A/B device, center the Android version. Change-Id: Ica18af5e46dadf1088fdfd6d23d96db090195a6a
-rw-r--r--screen_ui.cpp22
-rw-r--r--ui.cpp4
-rw-r--r--ui.h1
3 files changed, 22 insertions, 5 deletions
diff --git a/screen_ui.cpp b/screen_ui.cpp
index 9376bdd7..af20942a 100644
--- a/screen_ui.cpp
+++ b/screen_ui.cpp
@@ -715,12 +715,24 @@ void ScreenRecoveryUI::draw_screen_locked() {
// Draw version info
if (menu_is_main_) {
int text_x, text_y;
- text_x = kMarginWidth + (gr_fb_width() - (android_version_.size() * char_width_)) / 2;
- text_y = gr_fb_height() - 2 * (char_height_ + 4);
SetColor(MENU);
- DrawTextLine(text_x, text_y, android_version_.c_str(), false);
- text_x = kMarginWidth + (gr_fb_width() - (lineage_version_.size() * char_width_)) / 2;
- text_y = gr_fb_height() - 1 * (char_height_ + 4);
+ text_y = gr_fb_height() - 2 * (char_height_ + 4);
+ if (boot_slot_.empty()) {
+ text_x = kMarginWidth + gr_fb_width() * 1 / 2 -
+ (android_version_.size() * char_width_) / 2;
+ DrawTextLine(text_x, text_y, android_version_.c_str(), false);
+ }
+ else {
+ text_x = kMarginWidth + gr_fb_width() * 1 / 4 -
+ (android_version_.size() * char_width_) / 2;
+ DrawTextLine(text_x, text_y, android_version_.c_str(), false);
+ text_x = kMarginWidth + gr_fb_width() * 3 / 4 -
+ (boot_slot_.size() * char_width_) / 2;
+ DrawTextLine(text_x, text_y, boot_slot_.c_str(), false);
+ }
+ text_y += char_height_ + 4;
+ text_x = kMarginWidth + gr_fb_width() * 1 / 2 -
+ (lineage_version_.size() * char_width_) / 2;
DrawTextLine(text_x, text_y, lineage_version_.c_str(), false);
}
} else {
diff --git a/ui.cpp b/ui.cpp
index 09b13779..126961c4 100644
--- a/ui.cpp
+++ b/ui.cpp
@@ -88,6 +88,10 @@ RecoveryUI::RecoveryUI()
char propval[PROPERTY_VALUE_MAX];
property_get("ro.build.version.release", propval, "(unknown)");
android_version_ = std::string("Android ") + propval;
+ property_get("ro.boot.slot_suffix", propval, "");
+ if (propval[0] == '_') {
+ boot_slot_ = std::string("Slot ") + &propval[1];
+ }
property_get("ro.lineage.version", propval, "(unknown)");
lineage_version_ = std::string("LineageOS ") + propval;
diff --git a/ui.h b/ui.h
index 6356d387..6cac86c3 100644
--- a/ui.h
+++ b/ui.h
@@ -272,6 +272,7 @@ class RecoveryUI {
void EnqueueTouch(const Point& pos);
std::string android_version_;
+ std::string boot_slot_;
std::string lineage_version_;
// The normal and dimmed brightness percentages (default: 50 and 25, which means 50% and 25% of