1 /*
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 
17 #include <recovery_ui/device.h>
18 #include <recovery_ui/screen_ui.h>
19 
20 namespace android {
21 namespace device {
22 namespace ti {
23 namespace beagle_x15 {
24 
25 class BeagleX15UI : public ::ScreenRecoveryUI
26 {
CheckKey(int key,bool is_long_press)27     RecoveryUI::KeyAction CheckKey(int key, bool is_long_press) {
28         // Use "Home" key (called USER5 on AM57x EVM) to select the item,
29         // because it's impossible to reproduce long press, and we can't use
30         // "Power" button as a chord for toggle
31         if (key == KEY_HOME) {
32             return RecoveryUI::TOGGLE;
33         }
34 
35         return RecoveryUI::CheckKey(key, is_long_press);
36     }
37 };
38 
39 } // namespace beagle_x15
40 } // namespace ti
41 } // namespace device
42 } // namespace android
43 
make_device()44 Device *make_device()
45 {
46     return new Device(new ::android::device::ti::beagle_x15::BeagleX15UI());
47 }
48