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 | |
| 18 | #include <android/frameworks/automotive/display/1.0/ICarWindowService.h> |
| 19 | #include <gui/ISurfaceComposer.h> |
| 20 | #include <gui/IGraphicBufferProducer.h> |
| 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> |
Haoxiang Li | 95917b1 | 2019-11-15 11:29:05 -0800 | [diff] [blame] | 25 | |
| 26 | namespace android { |
| 27 | namespace frameworks { |
| 28 | namespace automotive { |
| 29 | namespace display { |
| 30 | namespace V1_0 { |
| 31 | namespace implementation { |
| 32 | |
| 33 | using ::android::hardware::Return; |
| 34 | using ::android::sp; |
| 35 | using ::android::hardware::graphics::bufferqueue::V2_0::IGraphicBufferProducer; |
| 36 | |
| 37 | class CarWindowService : public ICarWindowService { |
| 38 | public: |
| 39 | Return<sp<IGraphicBufferProducer>> getIGraphicBufferProducer() override; |
| 40 | Return<bool> showWindow() override; |
| 41 | Return<bool> hideWindow() override; |
Changyeon Jo | e1dd30a | 2020-01-06 16:51:23 -0800 | [diff] [blame] | 42 | Return<void> getDisplayInfo(getDisplayInfo_cb _info_cb) override { |
| 43 | HwDisplayConfig cfg; |
| 44 | cfg.setToExternal((uint8_t*)&mDpyConfig, sizeof(DisplayConfig)); |
| 45 | |
| 46 | HwDisplayState state; |
| 47 | state.setToExternal((uint8_t*)&mDpyState, sizeof(DisplayState)); |
| 48 | |
| 49 | _info_cb(cfg, state); |
| 50 | return hardware::Void(); |
| 51 | } |
Haoxiang Li | 95917b1 | 2019-11-15 11:29:05 -0800 | [diff] [blame] | 52 | |
| 53 | private: |
| 54 | sp<android::Surface> mSurface; |
| 55 | sp<android::SurfaceComposerClient> mSurfaceComposerClient; |
| 56 | sp<android::SurfaceControl> mSurfaceControl; |
Changyeon Jo | e1dd30a | 2020-01-06 16:51:23 -0800 | [diff] [blame] | 57 | DisplayConfig mDpyConfig; |
Changyeon Jo | ab614c4 | 2020-02-03 16:34:50 -0800 | [diff] [blame^] | 58 | ui::DisplayState mDpyState; |
Haoxiang Li | 95917b1 | 2019-11-15 11:29:05 -0800 | [diff] [blame] | 59 | }; |
| 60 | } // namespace implementation |
| 61 | } // namespace V1_0 |
| 62 | } // namespace display |
| 63 | } // namespace automotive |
| 64 | } // namespace frameworks |
| 65 | } // namespace android |
| 66 | |