1 /*
2  * Copyright 2016, 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_V1_0_WPRODUCERLISTENER_H_
18 #define ANDROID_HARDWARE_GRAPHICS_BUFFERQUEUE_V1_0_WPRODUCERLISTENER_H_
19 
20 #include <hidl/MQDescriptor.h>
21 #include <hidl/Status.h>
22 
23 #include <gui/IProducerListener.h>
24 
25 #include <android/hardware/graphics/bufferqueue/1.0/IProducerListener.h>
26 
27 namespace android {
28 
29 using ::android::hidl::base::V1_0::IBase;
30 using ::android::hardware::hidl_array;
31 using ::android::hardware::hidl_memory;
32 using ::android::hardware::hidl_string;
33 using ::android::hardware::hidl_vec;
34 using ::android::hardware::Return;
35 using ::android::hardware::Void;
36 using ::android::sp;
37 
38 typedef ::android::hardware::graphics::bufferqueue::V1_0::IProducerListener
39         HProducerListener;
40 typedef ::android::IProducerListener
41         BProducerListener;
42 using ::android::BnProducerListener;
43 
44 struct TWProducerListener : public HProducerListener {
45     sp<BProducerListener> mBase;
46     TWProducerListener(sp<BProducerListener> const& base);
47     Return<void> onBufferReleased() override;
48     Return<bool> needsReleaseNotify() override;
49 };
50 
51 class LWProducerListener : public BnProducerListener {
52 public:
53     sp<HProducerListener> mBase;
54     LWProducerListener(sp<HProducerListener> const& base);
55     void onBufferReleased() override;
56     bool needsReleaseNotify() override;
57     void onBuffersDiscarded(const std::vector<int32_t>& slots) override;
58 };
59 
60 }  // namespace android
61 
62 #endif  // ANDROID_HARDWARE_GRAPHICS_BUFFERQUEUE_V1_0_WPRODUCERLISTENER_H_
63