blob: d635f5a8fee33bd378ebeea388cece4c4773d3e3 [file] [log] [blame]
Haoxiang Li95917b12019-11-15 11:29:05 -08001//
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 Joe1dd30a2020-01-06 16:51:23 -080023#include <ui/DisplayConfig.h>
24#include <ui/DisplayState.h>
Haoxiang Li95917b12019-11-15 11:29:05 -080025
26namespace android {
27namespace frameworks {
28namespace automotive {
29namespace display {
30namespace V1_0 {
31namespace implementation {
32
33using ::android::hardware::Return;
34using ::android::sp;
35using ::android::hardware::graphics::bufferqueue::V2_0::IGraphicBufferProducer;
36
37class CarWindowService : public ICarWindowService {
38public:
39 Return<sp<IGraphicBufferProducer>> getIGraphicBufferProducer() override;
40 Return<bool> showWindow() override;
41 Return<bool> hideWindow() override;
Changyeon Joe1dd30a2020-01-06 16:51:23 -080042 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 Li95917b12019-11-15 11:29:05 -080052
53private:
54 sp<android::Surface> mSurface;
55 sp<android::SurfaceComposerClient> mSurfaceComposerClient;
56 sp<android::SurfaceControl> mSurfaceControl;
Changyeon Joe1dd30a2020-01-06 16:51:23 -080057 DisplayConfig mDpyConfig;
58 DisplayState mDpyState;
Haoxiang Li95917b12019-11-15 11:29:05 -080059};
60} // namespace implementation
61} // namespace V1_0
62} // namespace display
63} // namespace automotive
64} // namespace frameworks
65} // namespace android
66