1 /*
2  * Copyright 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_HARDWARE_GRAPHICS_BUFFERQUEUE_V2_0_H2BPRODUCERLISTENER_H
18 #define ANDROID_HARDWARE_GRAPHICS_BUFFERQUEUE_V2_0_H2BPRODUCERLISTENER_H
19 
20 #include <android/hardware/graphics/bufferqueue/2.0/IProducerListener.h>
21 #include <gui/IProducerListener.h>
22 #include <hidl/HybridInterface.h>
23 
24 namespace android {
25 namespace hardware {
26 namespace graphics {
27 namespace bufferqueue {
28 namespace V2_0 {
29 namespace utils {
30 
31 using HProducerListener = ::android::hardware::graphics::bufferqueue::V2_0::
32         IProducerListener;
33 
34 using BProducerListener = ::android::IProducerListener;
35 
36 #ifndef NO_BINDER
37 class H2BProducerListener
38       : public H2BConverter<HProducerListener, BnProducerListener> {
39 #else
40 class H2BProducerListener
41       : public BProducerListener {
42     sp<HProducerListener> mBase;
43 
44 #endif
45 public:
46     H2BProducerListener(sp<HProducerListener> const& base);
47     virtual void onBufferReleased() override;
48     virtual bool needsReleaseNotify() override;
49     virtual void onBuffersDiscarded(const std::vector<int32_t>& slots) override;
50 };
51 
52 }  // namespace utils
53 }  // namespace V2_0
54 }  // namespace bufferqueue
55 }  // namespace graphics
56 }  // namespace hardware
57 }  // namespace android
58 
59 #endif  // ANDROID_HARDWARE_GRAPHICS_BUFFERQUEUE_V2_0_H2BPRODUCERLISTENER_H
60 
61