1 /*
2  * Copyright 2020, 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 #pragma once
18 
19 #include <device_layout.h>
20 #include <layouts/layout.h>
21 #include <stdint.h>
22 #include <optional>
23 
24 namespace devices {
25 
26 /**
27  * Get the count of displays on which the confirmational UI should be
28  * simultaneously rendered.  Normally this is 1.
29  */
30 int getDisplayCount();
31 
32 /** Get the display context containing parameters needed to render a layout.
33  * This will be called for each active display (normally just once) to ge the
34  * context for rendering the layout.  The context contains parameters such as
35  * screen dimensions, button placements and so on.
36  *
37  * The display_index will identify the active display(s) for devices that
38  * have more than one screen.
39  *
40  * @param display_index  Index of the display for which the context is needed.
41  * @param magnified      If true, provide parameters for a magnified display.
42  * @return Either a context, or std::nullop.
43  */
44 std::optional<teeui::context<teeui::ConUIParameters>> getDisplayContext(
45         int display_index,
46         bool magnified);
47 
48 /**
49  * Get the layout for some display.
50  */
51 std::optional<std::unique_ptr<teeui::layouts::ILayout>> getDisplayLayout(
52         int display_index,
53         bool inverted,
54         const teeui::context<teeui::ConUIParameters>& ctx);
55 
56 }  // namespace devices
57