2
* Copyright (C) 2011 The Android Open Source Project
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
8
* http://www.apache.org/licenses/LICENSE-2.0
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.
18
#include <sys/types.h>
20
#include <utils/Errors.h>
21
#include <utils/RefBase.h>
22
#include <utils/Timers.h>
24
#include <binder/Parcel.h>
25
#include <binder/IInterface.h>
27
#include <gui/IDisplayEventConnection.h>
28
#include <gui/BitTube.h>
31
// ----------------------------------------------------------------------------
34
GET_DATA_CHANNEL = IBinder::FIRST_CALL_TRANSACTION,
39
class BpDisplayEventConnection : public BpInterface<IDisplayEventConnection>
42
BpDisplayEventConnection(const sp<IBinder>& impl)
43
: BpInterface<IDisplayEventConnection>(impl)
47
virtual sp<BitTube> getDataChannel() const
50
data.writeInterfaceToken(IDisplayEventConnection::getInterfaceDescriptor());
51
remote()->transact(GET_DATA_CHANNEL, data, &reply);
52
return new BitTube(reply);
55
virtual void setVsyncRate(uint32_t count) {
57
data.writeInterfaceToken(IDisplayEventConnection::getInterfaceDescriptor());
58
data.writeInt32(count);
59
remote()->transact(SET_VSYNC_RATE, data, &reply);
62
virtual void requestNextVsync() {
64
data.writeInterfaceToken(IDisplayEventConnection::getInterfaceDescriptor());
65
remote()->transact(REQUEST_NEXT_VSYNC, data, &reply, IBinder::FLAG_ONEWAY);
69
IMPLEMENT_META_INTERFACE(DisplayEventConnection, "android.gui.DisplayEventConnection");
71
// ----------------------------------------------------------------------------
73
status_t BnDisplayEventConnection::onTransact(
74
uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
77
case GET_DATA_CHANNEL: {
78
CHECK_INTERFACE(IDisplayEventConnection, data, reply);
79
sp<BitTube> channel(getDataChannel());
80
channel->writeToParcel(reply);
83
case SET_VSYNC_RATE: {
84
CHECK_INTERFACE(IDisplayEventConnection, data, reply);
85
setVsyncRate(data.readInt32());
88
case REQUEST_NEXT_VSYNC: {
89
CHECK_INTERFACE(IDisplayEventConnection, data, reply);
94
return BBinder::onTransact(code, data, reply, flags);
97
// ----------------------------------------------------------------------------
98
}; // namespace android