blob: a56b3f7250a95258c8b43e011f4a6f16a035ae83 [file] [log] [blame]
Tianjie Xu09a8f762019-06-27 15:01:55 -07001/*
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/stub_ui.h"
18
19#include <android-base/logging.h>
20
21#include "recovery_ui/device.h"
22
23size_t StubRecoveryUI::ShowMenu(const std::vector<std::string>& /* headers */,
24 const std::vector<std::string>& /* items */,
25 size_t /* initial_selection */, bool /* menu_only */,
26 const std::function<int(int, bool)>& /*key_handler*/) {
27 while (true) {
28 int key = WaitKey();
29 // Exit the loop in the case of interruption or time out.
30 if (key == static_cast<int>(KeyError::INTERRUPTED) ||
31 key == static_cast<int>(KeyError::TIMED_OUT)) {
32 return static_cast<size_t>(key);
33 }
34 }
35 LOG(FATAL) << "Unreachable key selected in ShowMenu of stub UI";
36}