blob: e82be6a6b929843fcea1e00f3a286cf89c6b680b [file] [log] [blame]
Alistair Strachan10c509c2018-11-20 18:09:27 -08001/*
2 * Copyright (C) 2019 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
xunchang73c3b392019-03-20 10:47:41 -070017#include <recovery_ui/device.h>
18#include <recovery_ui/screen_ui.h>
Alistair Strachan10c509c2018-11-20 18:09:27 -080019
20namespace android {
21namespace device {
22namespace linaro {
23namespace hikey {
24
25class HikeyUI : public ::ScreenRecoveryUI
26{
27 RecoveryUI::KeyAction CheckKey(int key, bool is_long_press) {
28 // Recovery core can't tolerate using KEY_POWER as an alias for
29 // KEY_DOWN, and a reboot is always triggered. Remap any power
30 // key press to KEY_DOWN to allow us to use the power key as
31 // a regular key.
32 if (key == KEY_POWER && !is_long_press) {
33 RecoveryUI::EnqueueKey(KEY_DOWN);
34 return RecoveryUI::IGNORE;
35 }
36
37 return RecoveryUI::CheckKey(key, is_long_press);
38 }
39};
40
41} // namespace hikey
42} // namespace linaro
43} // namespace device
44} // namespace android
45
46Device *make_device()
47{
48 return new Device(new ::android::device::linaro::hikey::HikeyUI());
49}