blob: 6d61581737994c50675c9c96a728583116f3723b [file] [log] [blame]
preludedrew38058dc2011-01-29 23:30:44 -07001/*
2 * Copyright (C) 2009 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include <linux/input.h>
18
19#include "recovery_ui.h"
20#include "common.h"
21#include "extendedcommands.h"
22
23char* MENU_HEADERS[] = { NULL };
24
25char* MENU_ITEMS[] = { "reboot system now",
26 "apply update from sdcard",
27 "wipe data/factory reset",
28 "wipe cache partition",
29 "install zip from sdcard",
30 "backup and restore",
31 "mounts and storage",
32 "advanced",
andrew.boren1acd15e2011-03-31 21:41:22 -070033 "power off",
preludedrew38058dc2011-01-29 23:30:44 -070034 NULL };
35
36int device_recovery_start() {
37 return 0;
38}
39
40int device_toggle_display(volatile char* key_pressed, int key_code) {
41 int alt = key_pressed[KEY_LEFTALT] || key_pressed[KEY_RIGHTALT];
42 if (alt && key_code == KEY_L)
43 return 1;
44 // allow toggling of the display if the correct key is pressed, and the display toggle is allowed or the display is currently off
45 if (ui_get_showing_back_button()) {
andrew.boren1acd15e2011-03-31 21:41:22 -070046 return 0;
47 //return get_allow_toggle_display() && (key_code == KEY_HOME || key_code == KEY_MENU || key_code == KEY_END);
preludedrew38058dc2011-01-29 23:30:44 -070048 }
49 return get_allow_toggle_display() && (key_code == KEY_HOME || key_code == KEY_MENU || key_code == KEY_POWER || key_code == KEY_END);
50}
51
52int device_reboot_now(volatile char* key_pressed, int key_code) {
53 return 0;
54}
55
56int device_handle_key(int key_code, int visible) {
57 if (visible) {
58 switch (key_code) {
59 case KEY_CAPSLOCK:
60 case KEY_DOWN:
61 case KEY_VOLUMEDOWN:
andrew.boren1acd15e2011-03-31 21:41:22 -070062 case KEY_MENU:
preludedrew38058dc2011-01-29 23:30:44 -070063 return HIGHLIGHT_DOWN;
64
65 case KEY_LEFTSHIFT:
66 case KEY_UP:
67 case KEY_VOLUMEUP:
andrew.boren1acd15e2011-03-31 21:41:22 -070068 case KEY_HOME:
preludedrew38058dc2011-01-29 23:30:44 -070069 return HIGHLIGHT_UP;
70
71 case KEY_POWER:
72 if (ui_get_showing_back_button()) {
73 return SELECT_ITEM;
74 }
75 if (!get_allow_toggle_display())
76 return GO_BACK;
77 break;
78 case KEY_LEFTBRACE:
79 case KEY_ENTER:
80 case BTN_MOUSE:
81 case KEY_CENTER:
82 case KEY_CAMERA:
83 case KEY_F21:
84 case KEY_SEND:
85 return SELECT_ITEM;
86
87 case KEY_END:
88 case KEY_BACKSPACE:
andrew.boren1acd15e2011-03-31 21:41:22 -070089 case KEY_SEARCH:
90 if (ui_get_showing_back_button()) {
91 return SELECT_ITEM;
92 }
preludedrew38058dc2011-01-29 23:30:44 -070093 if (!get_allow_toggle_display())
94 return GO_BACK;
andrew.boren1acd15e2011-03-31 21:41:22 -070095 case KEY_BACK:
96 return GO_BACK;
preludedrew38058dc2011-01-29 23:30:44 -070097 }
98 }
99
100 return NO_ACTION;
101}
102
103int device_perform_action(int which) {
104 return which;
105}
106
107int device_wipe_data() {
108 return 0;
109}