| Haoxiang Li | 95917b1 | 2019-11-15 11:29:05 -0800 | [diff] [blame] | 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 |  | 
| Changyeon Jo | 4ff8fb0 | 2020-02-05 21:56:59 -0800 | [diff] [blame] | 18 | #include <android/frameworks/automotive/display/1.0/IAutomotiveDisplayProxyService.h> | 
| Haoxiang Li | 95917b1 | 2019-11-15 11:29:05 -0800 | [diff] [blame] | 19 | #include <gui/IGraphicBufferProducer.h> | 
| Changyeon Jo | 75c8aa9 | 2019-12-30 11:12:53 -0800 | [diff] [blame] | 20 | #include <gui/ISurfaceComposer.h> | 
| Haoxiang Li | 95917b1 | 2019-11-15 11:29:05 -0800 | [diff] [blame] | 21 | #include <gui/Surface.h> | 
 | 22 | #include <gui/SurfaceComposerClient.h> | 
| Changyeon Jo | e1dd30a | 2020-01-06 16:51:23 -0800 | [diff] [blame] | 23 | #include <ui/DisplayConfig.h> | 
 | 24 | #include <ui/DisplayState.h> | 
| Changyeon Jo | 75c8aa9 | 2019-12-30 11:12:53 -0800 | [diff] [blame] | 25 | #include <tuple> | 
 | 26 | #include <vector> | 
| Haoxiang Li | 95917b1 | 2019-11-15 11:29:05 -0800 | [diff] [blame] | 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; | 
| Haoxiang Li | 95917b1 | 2019-11-15 11:29:05 -0800 | [diff] [blame] | 36 | using ::android::hardware::graphics::bufferqueue::V2_0::IGraphicBufferProducer; | 
| Changyeon Jo | 75c8aa9 | 2019-12-30 11:12:53 -0800 | [diff] [blame] | 37 | using ::android::sp; | 
 | 38 |  | 
 | 39 |  | 
 | 40 | typedef struct DisplayDesc { | 
 | 41 |     sp<IBinder>        token; | 
 | 42 |     sp<SurfaceControl> surfaceControl; | 
 | 43 | } DisplayDesc; | 
 | 44 |  | 
| Haoxiang Li | 95917b1 | 2019-11-15 11:29:05 -0800 | [diff] [blame] | 45 |  | 
| Changyeon Jo | 4ff8fb0 | 2020-02-05 21:56:59 -0800 | [diff] [blame] | 46 | class AutomotiveDisplayProxyService : public IAutomotiveDisplayProxyService { | 
| Haoxiang Li | 95917b1 | 2019-11-15 11:29:05 -0800 | [diff] [blame] | 47 | public: | 
| Changyeon Jo | 75c8aa9 | 2019-12-30 11:12:53 -0800 | [diff] [blame] | 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; | 
| Haoxiang Li | 95917b1 | 2019-11-15 11:29:05 -0800 | [diff] [blame] | 53 |  | 
 | 54 | private: | 
| Changyeon Jo | 75c8aa9 | 2019-12-30 11:12:53 -0800 | [diff] [blame] | 55 |     uint8_t getDisplayPort(const uint64_t id) { return (id & 0xF); } | 
 | 56 |  | 
 | 57 |     std::unordered_map<uint64_t, DisplayDesc> mDisplays; | 
| Haoxiang Li | 95917b1 | 2019-11-15 11:29:05 -0800 | [diff] [blame] | 58 | }; | 
| Changyeon Jo | 75c8aa9 | 2019-12-30 11:12:53 -0800 | [diff] [blame] | 59 |  | 
| Haoxiang Li | 95917b1 | 2019-11-15 11:29:05 -0800 | [diff] [blame] | 60 | }  // namespace implementation | 
 | 61 | }  // namespace V1_0 | 
 | 62 | }  // namespace display | 
 | 63 | }  // namespace automotive | 
 | 64 | }  // namespace frameworks | 
 | 65 | }  // namespace android | 
 | 66 |  |