aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorElliott Hughes2015-04-09 17:53:34 -0500
committerGerrit Code Review2015-04-09 17:53:36 -0500
commite001074f227fb74f6ebf5b26c222d09fe69712c0 (patch)
treed3dd7ef908ce61cf4ef495b28122c745dbb24f03 /device.h
parent06522ef517196062299852d59593eba0ea2be3c0 (diff)
parent9e7ae8a62652258f3ecbf147b578b73286f6d4d8 (diff)
downloadplatform-bootable-recovery-e001074f227fb74f6ebf5b26c222d09fe69712c0.tar.gz
platform-bootable-recovery-e001074f227fb74f6ebf5b26c222d09fe69712c0.tar.xz
platform-bootable-recovery-e001074f227fb74f6ebf5b26c222d09fe69712c0.zip
Merge "Move default implementations into Device."
Diffstat (limited to 'device.h')
-rw-r--r--device.h28
1 files changed, 16 insertions, 12 deletions
diff --git a/device.h b/device.h
index 02f95648..97ec2fb4 100644
--- a/device.h
+++ b/device.h
@@ -21,13 +21,14 @@
21 21
22class Device { 22class Device {
23 public: 23 public:
24 Device(RecoveryUI* ui) : ui_(ui) { }
24 virtual ~Device() { } 25 virtual ~Device() { }
25 26
26 // Called to obtain the UI object that should be used to display 27 // Called to obtain the UI object that should be used to display
27 // the recovery user interface for this device. You should not 28 // the recovery user interface for this device. You should not
28 // have called Init() on the UI object already, the caller will do 29 // have called Init() on the UI object already, the caller will do
29 // that after this method returns. 30 // that after this method returns.
30 virtual RecoveryUI* GetUI() = 0; 31 virtual RecoveryUI* GetUI() { return ui_; }
31 32
32 // Called when recovery starts up (after the UI has been obtained 33 // Called when recovery starts up (after the UI has been obtained
33 // and initialized and after the arguments have been parsed, but 34 // and initialized and after the arguments have been parsed, but
@@ -60,6 +61,17 @@ class Device {
60 APPLY_ADB_SIDELOAD, WIPE_DATA, WIPE_CACHE, 61 APPLY_ADB_SIDELOAD, WIPE_DATA, WIPE_CACHE,
61 REBOOT_BOOTLOADER, SHUTDOWN, READ_RECOVERY_LASTLOG }; 62 REBOOT_BOOTLOADER, SHUTDOWN, READ_RECOVERY_LASTLOG };
62 63
64 // Return the headers (an array of strings, one per line,
65 // NULL-terminated) for the main menu. Typically these tell users
66 // what to push to move the selection and invoke the selected
67 // item.
68 virtual const char* const* GetMenuHeaders();
69
70 // Return the list of menu items (an array of strings,
71 // NULL-terminated). The menu_position passed to InvokeMenuItem
72 // will correspond to the indexes into this array.
73 virtual const char* const* GetMenuItems();
74
63 // Perform a recovery action selected from the menu. 75 // Perform a recovery action selected from the menu.
64 // 'menu_position' will be the item number of the selected menu 76 // 'menu_position' will be the item number of the selected menu
65 // item, or a non-negative number returned from 77 // item, or a non-negative number returned from
@@ -69,7 +81,7 @@ class Device {
69 // builtin actions, you can just return the corresponding enum 81 // builtin actions, you can just return the corresponding enum
70 // value. If it is an action specific to your device, you 82 // value. If it is an action specific to your device, you
71 // actually perform it here and return NO_ACTION. 83 // actually perform it here and return NO_ACTION.
72 virtual BuiltinAction InvokeMenuItem(int menu_position) = 0; 84 virtual BuiltinAction InvokeMenuItem(int menu_position);
73 85
74 static const int kNoAction = -1; 86 static const int kNoAction = -1;
75 static const int kHighlightUp = -2; 87 static const int kHighlightUp = -2;
@@ -84,16 +96,8 @@ class Device {
84 // are erased AFTER this returns (whether it returns success or not). 96 // are erased AFTER this returns (whether it returns success or not).
85 virtual int WipeData() { return 0; } 97 virtual int WipeData() { return 0; }
86 98
87 // Return the headers (an array of strings, one per line, 99 private:
88 // NULL-terminated) for the main menu. Typically these tell users 100 RecoveryUI* ui_;
89 // what to push to move the selection and invoke the selected
90 // item.
91 virtual const char* const* GetMenuHeaders() = 0;
92
93 // Return the list of menu items (an array of strings,
94 // NULL-terminated). The menu_position passed to InvokeMenuItem
95 // will correspond to the indexes into this array.
96 virtual const char* const* GetMenuItems() = 0;
97}; 101};
98 102
99// The device-specific library must define this function (or the 103// The device-specific library must define this function (or the