forked from DooMLoRD/CWM-Recovery-Modded-Kindle-Fire
-
Notifications
You must be signed in to change notification settings - Fork 12
/
default_recovery_ui.c
183 lines (158 loc) · 4.4 KB
/
default_recovery_ui.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
/*
* Copyright (C) 2009 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <linux/input.h>
#include "recovery_ui.h"
#include "common.h"
#include "extendedcommands.h"
/*
to enable on-screen debug code printing set this to 1
to disable on-screen debug code printing set this to 0
*/
int TOUCH_CONTROL_DEBUG = 0;
/*
to enable on-sccreen log printing set this to 0
to disable on-screen log printing set this to 1
*/
int TOUCH_NOSHOW_LOG = 0;
//In this case MENU_SELECT icon has maximum possible height.
#define MENU_MAX_HEIGHT 80 //gr_get_height(gMenuIcon[MENU_SELECT]) //Maximum allowed height for navigation icons
//Device specific boundaries for touch recognition
/*
WARNING
these might not be the same as resX, resY (from below)
these have to be found by setting them to zero and then in debug mode
check the values returned by on screen touch output by click on the
touch panel extremeties
*/
int maxX=0; //Set to 0 for debugging
int maxY=0; //Set to 0 for debugging
/*
the values of following two variables are dependent on specifc device resolution
and can be obtained using the outputs of the gr_fb functions
*/
int resX=0; //Value obtained from function 'gr_fb_width()'
int resY=0; //Value obtained from function 'gr_fb_height()'
/*
set the following value to restrict the touch boundaries so that
only the buttons are active instead of the full screen; set to 0
for full screen and debugging
*/
int touchY=0;
/*
define a storage limit for backup requirements, we recommend setting
this to something appropriate to your device
*/
int minimum_storage=512;
// define what line to draw the battery indicator on
int BATT_LINE=0;
// define the screen position of the battery indicator
int BATT_POS=RIGHT_ALIGN;
// define what line to draw the clock on
int TIME_LINE=1;
// define the screen position of the clock
int TIME_POS=RIGHT_ALIGN;
char* MENU_HEADERS[] = { NULL };
char* MENU_ITEMS[] = { "Boot Android",
"ZIP Flashing",
"Factory Reset",
"Pre-flash Wipe",
"Nandroid",
"Storage Management",
"COT Options",
"Power Options",
NULL };
void device_ui_init(UIParameters* ui_parameters) {
}
int device_recovery_start() {
return 0;
}
int device_reboot_now(volatile char* key_pressed, int key_code) {
return 0;
}
int device_perform_action(int which) {
return which;
}
int device_wipe_data() {
return 0;
}
int get_menu_icon_info(int indx1, int indx2) {
//ToDo: Following switch case should be replaced by array or structure
int caseN = indx1*4 + indx2;
/*
int MENU_ICON1[] = {
{ 1*resX/8, (resY - MENU_MAX_HEIGHT/2), 0*resX/4, 1*resX/4 },
{ 3*resX/8, (resY - MENU_MAX_HEIGHT/2), 1*resX/4, 2*resX/4 },
{ 5*resX/8, (resY - MENU_MAX_HEIGHT/2), 2*resX/4, 3*resX/4 },
{ 7*resX/8, (resY - MENU_MAX_HEIGHT/2), 3*resX/4, 4*resX/4 },
};
*/
switch (caseN) {
case 0:
return 1*resX/8;
case 1:
return (resY - MENU_MAX_HEIGHT/2);
case 2:
return 0*resX/4;
case 3:
return 1*resX/4;
case 4:
return 3*resX/8;
case 5:
return (resY - MENU_MAX_HEIGHT/2);
case 6:
return 1*resX/4;
case 7:
return 2*resX/4;
case 8:
return 5*resX/8;
case 9:
return (resY - MENU_MAX_HEIGHT/2);
case 10:
return 2*resX/4;
case 11:
return 3*resX/4;
case 12:
return 7*resX/8;
case 13:
return (resY - MENU_MAX_HEIGHT/2);
case 14:
return 3*resX/4;
case 15:
return 4*resX/4;
}
return 0;
}
//For those devices which has skewed X axis and Y axis detection limit (Not similar to XY resolution of device), So need normalization
int MT_X(int x)
{
int out;
#ifndef BUILD_IN_LANDSCAPE
out = maxX ? (x*resX/maxX) : x;
#else
out = x/4;
#endif
return out;
}
int MT_Y(int y)
{
int out;
#ifndef BUILD_IN_LANDSCAPE
out = maxY ? (y*resY/maxY) : y;
#else
out = y/4;
#endif
return out;
}