blob: d7dd452833b57c9997bbeebafe626fb4926788a0 [file] [log] [blame]
Doug Zongkerdaefc1d2011-10-31 09:34:15 -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
Doug Zongkerdaefc1d2011-10-31 09:34:15 -070017#include "device.h"
18#include "screen_ui.h"
19
Doug Zongkerdaefc1d2011-10-31 09:34:15 -070020class DefaultDevice : public Device {
Elliott Hughes9e7ae8a2015-04-09 13:40:31 -070021 public:
22 DefaultDevice() : Device(new ScreenRecoveryUI) {
23 }
24
25 // TODO: make this handle more cases, and move the default implementation into Device too.
26 int HandleMenuKey(int key, int visible) {
27 if (visible) {
28 switch (key) {
29 case KEY_DOWN:
30 case KEY_VOLUMEDOWN:
31 return kHighlightDown;
32
33 case KEY_UP:
34 case KEY_VOLUMEUP:
35 return kHighlightUp;
36
37 case KEY_ENTER:
38 case KEY_POWER:
39 return kInvokeItem;
40 }
Doug Zongkerdaefc1d2011-10-31 09:34:15 -070041 }
42
Elliott Hughes9e7ae8a2015-04-09 13:40:31 -070043 return kNoAction;
44 }
Doug Zongkerdaefc1d2011-10-31 09:34:15 -070045};
46
47Device* make_device() {
Elliott Hughes9e7ae8a2015-04-09 13:40:31 -070048 return new DefaultDevice;
Doug Zongkerdaefc1d2011-10-31 09:34:15 -070049}