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 17 #ifndef ANDROID_AUTOMOTIVE_EVS_V1_1_DISPLAYPROXY_H 18 #define ANDROID_AUTOMOTIVE_EVS_V1_1_DISPLAYPROXY_H 19 20 #include <limits> 21 22 #include <android/hardware/automotive/evs/1.1/types.h> 23 #include <android/hardware/automotive/evs/1.1/IEvsDisplay.h> 24 25 using namespace ::android::hardware::automotive::evs::V1_1; 26 using ::android::hardware::Return; 27 using ::android::hardware::Void; 28 using ::android::hardware::hidl_handle; 29 using ::android::hardware::automotive::evs::V1_0::EvsResult; 30 using BufferDesc_1_0 = ::android::hardware::automotive::evs::V1_0::BufferDesc; 31 using EvsDisplayState = ::android::hardware::automotive::evs::V1_0::DisplayState; 32 using IEvsDisplay_1_0 = ::android::hardware::automotive::evs::V1_0::IEvsDisplay; 33 using IEvsDisplay_1_1 = ::android::hardware::automotive::evs::V1_1::IEvsDisplay; 34 35 namespace android { 36 namespace automotive { 37 namespace evs { 38 namespace V1_1 { 39 namespace implementation { 40 41 // TODO(129284474): This class has been defined to wrap the IEvsDisplay object the driver 42 // returns because of b/129284474 and represents an EVS display to the client 43 // application. With a proper bug fix, we may remove this class and update the 44 // manager directly to use the IEvsDisplay object the driver provides. 45 class HalDisplay : public IEvsDisplay_1_1 { 46 public: 47 explicit HalDisplay(sp<IEvsDisplay_1_0> display, 48 int32_t port = std::numeric_limits<int32_t>::min()); 49 virtual ~HalDisplay() override; 50 51 inline void shutdown(); 52 sp<IEvsDisplay_1_0> getHwDisplay(); 53 54 // Methods from ::android::hardware::automotive::evs::V1_0::IEvsDisplay follow. 55 Return<void> getDisplayInfo(getDisplayInfo_cb _hidl_cb) override; 56 Return<EvsResult> setDisplayState(EvsDisplayState state) override; 57 Return<EvsDisplayState> getDisplayState() override; 58 Return<void> getTargetBuffer(getTargetBuffer_cb _hidl_cb) override; 59 Return<EvsResult> returnTargetBufferForDisplay(const BufferDesc_1_0& buffer) override; 60 61 // Methods from ::android::hardware::automotive::evs::V1_1::IEvsDisplay follow. 62 Return<void> getDisplayInfo_1_1(getDisplayInfo_1_1_cb _info_cb) override; 63 64 // Returns a string showing the current status 65 std::string toString(const char* indent = ""); 66 67 private: 68 sp<IEvsDisplay_1_0> mHwDisplay; // The low level display interface that backs this proxy 69 int32_t mId; // Display identifier 70 }; 71 72 } // namespace implementation 73 } // namespace V1_1 74 } // namespace evs 75 } // namespace automotive 76 } // namespace android 77 78 #endif // ANDROID_AUTOMOTIVE_EVS_V1_1_DISPLAYPROXY_H 79