Doug Zongker | daefc1d | 2011-10-31 09:34:15 -0700 | [diff] [blame] | 1 | /* |
| 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 Zongker | daefc1d | 2011-10-31 09:34:15 -0700 | [diff] [blame] | 17 | #include "device.h" |
| 18 | #include "screen_ui.h" |
| 19 | |
Doug Zongker | daefc1d | 2011-10-31 09:34:15 -0700 | [diff] [blame] | 20 | class DefaultDevice : public Device { |
Elliott Hughes | 9e7ae8a | 2015-04-09 13:40:31 -0700 | [diff] [blame] | 21 | 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 Zongker | daefc1d | 2011-10-31 09:34:15 -0700 | [diff] [blame] | 41 | } |
| 42 | |
Elliott Hughes | 9e7ae8a | 2015-04-09 13:40:31 -0700 | [diff] [blame] | 43 | return kNoAction; |
| 44 | } |
Doug Zongker | daefc1d | 2011-10-31 09:34:15 -0700 | [diff] [blame] | 45 | }; |
| 46 | |
| 47 | Device* make_device() { |
Elliott Hughes | 9e7ae8a | 2015-04-09 13:40:31 -0700 | [diff] [blame] | 48 | return new DefaultDevice; |
Doug Zongker | daefc1d | 2011-10-31 09:34:15 -0700 | [diff] [blame] | 49 | } |