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 #pragma once
17 
18 #include <android/frameworks/automotive/display/1.0/IAutomotiveDisplayProxyService.h>
19 #include <gui/IGraphicBufferProducer.h>
20 #include <gui/ISurfaceComposer.h>
21 #include <gui/Surface.h>
22 #include <gui/SurfaceComposerClient.h>
23 #include <ui/DisplayMode.h>
24 #include <ui/DisplayState.h>
25 #include <tuple>
26 #include <vector>
27 
28 namespace android {
29 namespace frameworks {
30 namespace automotive {
31 namespace display {
32 namespace V1_0 {
33 namespace implementation {
34 
35 using ::android::hardware::Return;
36 using ::android::hardware::graphics::bufferqueue::V2_0::IGraphicBufferProducer;
37 using ::android::sp;
38 
39 
40 typedef struct DisplayDesc {
41     sp<IBinder>        token;
42     sp<SurfaceControl> surfaceControl;
43 } DisplayDesc;
44 
45 
46 class AutomotiveDisplayProxyService : public IAutomotiveDisplayProxyService {
47 public:
48     Return<sp<IGraphicBufferProducer>> getIGraphicBufferProducer(uint64_t id) override;
49     Return<bool> showWindow(uint64_t id) override;
50     Return<bool> hideWindow(uint64_t id) override;
51     Return<void> getDisplayIdList(getDisplayIdList_cb _cb) override;
52     Return<void> getDisplayInfo(uint64_t, getDisplayInfo_cb _cb) override;
53 
54 private:
getDisplayPort(const uint64_t id)55     uint8_t getDisplayPort(const uint64_t id) { return (id & 0xF); }
56 
57     std::unordered_map<uint64_t, DisplayDesc> mDisplays;
58 };
59 
60 }  // namespace implementation
61 }  // namespace V1_0
62 }  // namespace display
63 }  // namespace automotive
64 }  // namespace frameworks
65 }  // namespace android
66 
67