remove DefaultDevice's UI subclass
RecoveryUI (which is the superclass of ScreenRecoveryUI), provides a
basic CheckKey method that is useful for devices that have KEY_POWER,
KEY_VOLUMEUP, and KEY_VOLUMEDOWN. Stop overriding it with a less
featureful method; with this no recovery UI customization is needed
for most handheld devices (phones, tablets, etc.).
Change-Id: I7d57cfaaef79afea8af4fc3dbc570afc61aeb5bc
diff --git a/default_device.cpp b/default_device.cpp
index 648eaec..1f18131 100644
--- a/default_device.cpp
+++ b/default_device.cpp
@@ -31,20 +31,10 @@
"wipe cache partition",
NULL };
-class DefaultUI : public ScreenRecoveryUI {
- public:
- virtual KeyAction CheckKey(int key) {
- if (key == KEY_HOME) {
- return TOGGLE;
- }
- return ENQUEUE;
- }
-};
-
class DefaultDevice : public Device {
public:
DefaultDevice() :
- ui(new DefaultUI) {
+ ui(new ScreenRecoveryUI) {
}
RecoveryUI* GetUI() { return ui; }
@@ -61,6 +51,7 @@
return kHighlightUp;
case KEY_ENTER:
+ case KEY_POWER:
return kInvokeItem;
}
}
diff --git a/ui.cpp b/ui.cpp
index 67a2500..091012f 100644
--- a/ui.cpp
+++ b/ui.cpp
@@ -276,7 +276,7 @@
// - Press power seven times in a row to reboot.
// - Alternate vol-up and vol-down seven times to mount /system.
RecoveryUI::KeyAction RecoveryUI::CheckKey(int key) {
- if (IsKeyPressed(KEY_POWER) && key == KEY_VOLUMEUP) {
+ if ((IsKeyPressed(KEY_POWER) && key == KEY_VOLUMEUP) || key == KEY_HOME) {
return TOGGLE;
}