blob: 9c192a24526609cce65728abece20fc97b7dec28 [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",
33 NULL };
34
35int device_recovery_start() {
36 return 0;
37}
38
39int device_toggle_display(volatile char* key_pressed, int key_code) {
40 int alt = key_pressed[KEY_LEFTALT] || key_pressed[KEY_RIGHTALT];
41 if (alt && key_code == KEY_L)
42 return 1;
43 // allow toggling of the display if the correct key is pressed, and the display toggle is allowed or the display is currently off
44 if (ui_get_showing_back_button()) {
45 return get_allow_toggle_display() && (key_code == KEY_HOME || key_code == KEY_MENU || key_code == KEY_END);
46 }
47 return get_allow_toggle_display() && (key_code == KEY_HOME || key_code == KEY_MENU || key_code == KEY_POWER || key_code == KEY_END);
48}
49
50int device_reboot_now(volatile char* key_pressed, int key_code) {
51 return 0;
52}
53
54int device_handle_key(int key_code, int visible) {
55 if (visible) {
56 switch (key_code) {
57 case KEY_CAPSLOCK:
58 case KEY_DOWN:
59 case KEY_VOLUMEDOWN:
60 return HIGHLIGHT_DOWN;
61
62 case KEY_LEFTSHIFT:
63 case KEY_UP:
64 case KEY_VOLUMEUP:
65 return HIGHLIGHT_UP;
66
67 case KEY_POWER:
68 if (ui_get_showing_back_button()) {
69 return SELECT_ITEM;
70 }
71 if (!get_allow_toggle_display())
72 return GO_BACK;
73 break;
74 case KEY_LEFTBRACE:
75 case KEY_ENTER:
76 case BTN_MOUSE:
77 case KEY_CENTER:
78 case KEY_CAMERA:
79 case KEY_F21:
80 case KEY_SEND:
81 return SELECT_ITEM;
82
83 case KEY_END:
84 case KEY_BACKSPACE:
85 case KEY_BACK:
86 if (!get_allow_toggle_display())
87 return GO_BACK;
88 }
89 }
90
91 return NO_ACTION;
92}
93
94int device_perform_action(int which) {
95 return which;
96}
97
98int device_wipe_data() {
99 return 0;
100}