summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Marshall <tdm@cyngn.com>2016-03-11 11:29:12 -0800
committerTom Marshall <tdm@cyngn.com>2016-03-14 15:15:35 -0700
commitb7fb1853f2bd2683c793dfe4b53704f3c631511d (patch)
treec4746bea0a08c7f483a4b4cdbd7b3024ccd24bc0
parentbc9052a7d47c1e077762cbbc23e9a05bcf1dfe63 (diff)
downloadbootable_recovery-b7fb1853f2bd2683c793dfe4b53704f3c631511d.zip
bootable_recovery-b7fb1853f2bd2683c793dfe4b53704f3c631511d.tar.gz
bootable_recovery-b7fb1853f2bd2683c793dfe4b53704f3c631511d.tar.bz2
recovery: Only set relevant sysbar state flags
Change-Id: I9fc0fa29299610865f622dc296bdadff59d74447
-rw-r--r--screen_ui.cpp12
-rw-r--r--screen_ui.h2
-rw-r--r--ui.cpp4
3 files changed, 15 insertions, 3 deletions
diff --git a/screen_ui.cpp b/screen_ui.cpp
index 849f6d1..46f4add 100644
--- a/screen_ui.cpp
+++ b/screen_ui.cpp
@@ -893,6 +893,18 @@ void ScreenRecoveryUI::SetHeadlessMode()
pthread_mutex_unlock(&updateMutex);
}
+void ScreenRecoveryUI::SetSysbarState(int state)
+{
+ if (HasBackKey()) {
+ state &= ~SYSBAR_BACK;
+ }
+ if (HasHomeKey()) {
+ state &= ~SYSBAR_HOME;
+ }
+ sysbar_state = state;
+ Redraw();
+}
+
void ScreenRecoveryUI::StartMenu(const char* const * headers, const char* const * items,
int initial_selection) {
pthread_mutex_lock(&updateMutex);
diff --git a/screen_ui.h b/screen_ui.h
index 9d7b263..78fcb9b 100644
--- a/screen_ui.h
+++ b/screen_ui.h
@@ -66,7 +66,7 @@ class ScreenRecoveryUI : public RecoveryUI {
// sysbar
int GetSysbarHeight() { return gr_get_height(sysbarBackHighlightIcon); }
int GetSysbarState() { return sysbar_state; }
- void SetSysbarState(int state) { sysbar_state = state; Redraw(); }
+ void SetSysbarState(int state);
// menu display
virtual int MenuItemStart() const { return menu_item_start_; }
diff --git a/ui.cpp b/ui.cpp
index 14f92b4..d28ede5 100644
--- a/ui.cpp
+++ b/ui.cpp
@@ -605,12 +605,12 @@ void RecoveryUI::handle_release(input_device* dev) {
int sysbar_state = GetSysbarState();
SetSysbarState(0);
- if (sysbar_state == 0x01) {
+ if (sysbar_state == SYSBAR_BACK) {
ProcessKey(dev, KEY_BACK, 1);
ProcessKey(dev, KEY_BACK, 0);
return;
}
- if (sysbar_state == 0x02) {
+ if (sysbar_state == SYSBAR_HOME) {
ProcessKey(dev, KEY_HOME, 1);
ProcessKey(dev, KEY_HOME, 0);
return;