blob: 81adc954496f06bbf1fed6df07f3786fe078f31c [file] [log] [blame]
Dan Stozaf0eaf252014-03-21 13:05:51 -07001/*
2 * Copyright 2014 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#include <binder/Parcel.h>
18
19#include <gui/IProducerListener.h>
20
21namespace android {
22
23enum {
24 ON_BUFFER_RELEASED = IBinder::FIRST_CALL_TRANSACTION,
25};
26
27class BpProducerListener : public BpInterface<IProducerListener>
28{
29public:
30 BpProducerListener(const sp<IBinder>& impl)
31 : BpInterface<IProducerListener>(impl) {}
32
Dan Stozad723bd72014-11-18 10:24:03 -080033 virtual ~BpProducerListener();
34
Dan Stozaf0eaf252014-03-21 13:05:51 -070035 virtual void onBufferReleased() {
36 Parcel data, reply;
37 data.writeInterfaceToken(IProducerListener::getInterfaceDescriptor());
38 remote()->transact(ON_BUFFER_RELEASED, data, &reply, IBinder::FLAG_ONEWAY);
39 }
40};
41
Dan Stozad723bd72014-11-18 10:24:03 -080042// Out-of-line virtual method definition to trigger vtable emission in this
43// translation unit (see clang warning -Wweak-vtables)
44BpProducerListener::~BpProducerListener() {}
45
Dan Stozaf0eaf252014-03-21 13:05:51 -070046IMPLEMENT_META_INTERFACE(ProducerListener, "android.gui.IProducerListener")
47
48status_t BnProducerListener::onTransact(uint32_t code, const Parcel& data,
49 Parcel* reply, uint32_t flags) {
50 switch (code) {
51 case ON_BUFFER_RELEASED:
52 CHECK_INTERFACE(IProducerListener, data, reply);
53 onBufferReleased();
54 return NO_ERROR;
55 }
56 return BBinder::onTransact(code, data, reply, flags);
57}
58
59} // namespace android