blob: 6b92cc8a0ef09ba636f290322d15a2bb2a63af2d [file] [log] [blame]
Mathias Agopiand0566bc2011-11-17 17:49:17 -08001/*
2 * Copyright (C) 2011 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
Mathias Agopian841cde52012-03-01 15:44:37 -080017#define ATRACE_TAG ATRACE_TAG_GRAPHICS
18
Mathias Agopiand0566bc2011-11-17 17:49:17 -080019#include <stdint.h>
20#include <sys/types.h>
21
Mathias Agopiana4cb35a2012-08-20 20:07:34 -070022#include <cutils/compiler.h>
23
Mathias Agopiand0566bc2011-11-17 17:49:17 -080024#include <gui/DisplayEventReceiver.h>
Lloyd Pique78ce4182018-01-31 16:39:51 -080025#include <gui/IDisplayEventConnection.h>
Mathias Agopiand0566bc2011-11-17 17:49:17 -080026
27#include <utils/Errors.h>
Mathias Agopian921e6ac2012-07-23 23:11:29 -070028#include <utils/String8.h>
Mathias Agopian841cde52012-03-01 15:44:37 -080029#include <utils/Trace.h>
Mathias Agopiand0566bc2011-11-17 17:49:17 -080030
Mathias Agopiand0566bc2011-11-17 17:49:17 -080031#include "EventThread.h"
32#include "SurfaceFlinger.h"
33
34// ---------------------------------------------------------------------------
Mathias Agopiand0566bc2011-11-17 17:49:17 -080035namespace android {
Mathias Agopiand0566bc2011-11-17 17:49:17 -080036// ---------------------------------------------------------------------------
37
Irvelab046852016-07-28 11:23:08 -070038EventThread::EventThread(const sp<VSyncSource>& src, SurfaceFlinger& flinger, bool interceptVSyncs)
Lloyd Pique78ce4182018-01-31 16:39:51 -080039 : mVSyncSource(src),
40 mFlinger(flinger),
41 mUseSoftwareVSync(false),
42 mVsyncEnabled(false),
43 mDebugVsyncEnabled(false),
44 mInterceptVSyncs(interceptVSyncs) {
45 for (int32_t i = 0; i < DisplayDevice::NUM_BUILTIN_DISPLAY_TYPES; i++) {
Mathias Agopianff28e202012-09-20 23:24:19 -070046 mVSyncEvent[i].header.type = DisplayEventReceiver::DISPLAY_EVENT_VSYNC;
47 mVSyncEvent[i].header.id = 0;
48 mVSyncEvent[i].header.timestamp = 0;
Lloyd Pique78ce4182018-01-31 16:39:51 -080049 mVSyncEvent[i].vsync.count = 0;
Mathias Agopianff28e202012-09-20 23:24:19 -070050 }
Ruchi Kandoief472ec2014-04-02 12:50:06 -070051}
52
Dan Stozadb4ac3c2015-04-14 11:34:01 -070053void EventThread::setPhaseOffset(nsecs_t phaseOffset) {
54 Mutex::Autolock _l(mLock);
55 mVSyncSource->setPhaseOffset(phaseOffset);
56}
57
Mathias Agopiand0566bc2011-11-17 17:49:17 -080058void EventThread::onFirstRef() {
59 run("EventThread", PRIORITY_URGENT_DISPLAY + PRIORITY_MORE_FAVORABLE);
60}
61
Mathias Agopiancb9732a2012-04-03 17:48:03 -070062sp<EventThread::Connection> EventThread::createEventConnection() const {
63 return new Connection(const_cast<EventThread*>(this));
Mathias Agopian8aedd472012-01-24 16:39:14 -080064}
65
Mathias Agopiand0566bc2011-11-17 17:49:17 -080066status_t EventThread::registerDisplayEventConnection(
Mathias Agopiancb9732a2012-04-03 17:48:03 -070067 const sp<EventThread::Connection>& connection) {
Mathias Agopiand0566bc2011-11-17 17:49:17 -080068 Mutex::Autolock _l(mLock);
Mathias Agopiancb9732a2012-04-03 17:48:03 -070069 mDisplayEventConnections.add(connection);
Mathias Agopian7d886472012-06-14 23:39:35 -070070 mCondition.broadcast();
Mathias Agopiand0566bc2011-11-17 17:49:17 -080071 return NO_ERROR;
72}
73
Lloyd Pique78ce4182018-01-31 16:39:51 -080074void EventThread::removeDisplayEventConnection(const wp<EventThread::Connection>& connection) {
Mathias Agopian23748662011-12-05 14:33:34 -080075 Mutex::Autolock _l(mLock);
Mathias Agopiancb9732a2012-04-03 17:48:03 -070076 mDisplayEventConnections.remove(connection);
Mathias Agopian478ae5e2011-12-06 17:22:19 -080077}
78
Lloyd Pique78ce4182018-01-31 16:39:51 -080079void EventThread::setVsyncRate(uint32_t count, const sp<EventThread::Connection>& connection) {
Mathias Agopian478ae5e2011-12-06 17:22:19 -080080 if (int32_t(count) >= 0) { // server must protect against bad params
81 Mutex::Autolock _l(mLock);
Mathias Agopiancb9732a2012-04-03 17:48:03 -070082 const int32_t new_count = (count == 0) ? -1 : count;
83 if (connection->count != new_count) {
84 connection->count = new_count;
Mathias Agopian7d886472012-06-14 23:39:35 -070085 mCondition.broadcast();
Mathias Agopian478ae5e2011-12-06 17:22:19 -080086 }
87 }
88}
89
Lloyd Pique78ce4182018-01-31 16:39:51 -080090void EventThread::requestNextVsync(const sp<EventThread::Connection>& connection) {
Mathias Agopian478ae5e2011-12-06 17:22:19 -080091 Mutex::Autolock _l(mLock);
Tim Murray4a4e4a22016-04-19 16:29:23 +000092
93 mFlinger.resyncWithRateLimit();
94
Mathias Agopiancb9732a2012-04-03 17:48:03 -070095 if (connection->count < 0) {
96 connection->count = 0;
Mathias Agopian7d886472012-06-14 23:39:35 -070097 mCondition.broadcast();
Mathias Agopian478ae5e2011-12-06 17:22:19 -080098 }
Mathias Agopian23748662011-12-05 14:33:34 -080099}
100
Mathias Agopian22ffb112012-04-10 21:04:02 -0700101void EventThread::onScreenReleased() {
102 Mutex::Autolock _l(mLock);
Mathias Agopian22ffb112012-04-10 21:04:02 -0700103 if (!mUseSoftwareVSync) {
Mathias Agopian7d886472012-06-14 23:39:35 -0700104 // disable reliance on h/w vsync
105 mUseSoftwareVSync = true;
106 mCondition.broadcast();
Mathias Agopian22ffb112012-04-10 21:04:02 -0700107 }
Mathias Agopian22ffb112012-04-10 21:04:02 -0700108}
109
110void EventThread::onScreenAcquired() {
111 Mutex::Autolock _l(mLock);
Mathias Agopian7d886472012-06-14 23:39:35 -0700112 if (mUseSoftwareVSync) {
113 // resume use of h/w vsync
114 mUseSoftwareVSync = false;
115 mCondition.broadcast();
116 }
Mathias Agopian22ffb112012-04-10 21:04:02 -0700117}
118
Jamie Gennisfaf77cc2013-07-30 15:10:32 -0700119void EventThread::onVSyncEvent(nsecs_t timestamp) {
Mathias Agopian3eb38cb2012-04-03 22:09:52 -0700120 Mutex::Autolock _l(mLock);
Jamie Gennisfaf77cc2013-07-30 15:10:32 -0700121 mVSyncEvent[0].header.type = DisplayEventReceiver::DISPLAY_EVENT_VSYNC;
122 mVSyncEvent[0].header.id = 0;
123 mVSyncEvent[0].header.timestamp = timestamp;
124 mVSyncEvent[0].vsync.count++;
125 mCondition.broadcast();
Mathias Agopian3eb38cb2012-04-03 22:09:52 -0700126}
127
Mathias Agopian148994e2012-09-19 17:31:36 -0700128void EventThread::onHotplugReceived(int type, bool connected) {
Jesse Hall9e663de2013-08-16 14:28:37 -0700129 ALOGE_IF(type >= DisplayDevice::NUM_BUILTIN_DISPLAY_TYPES,
Lloyd Pique78ce4182018-01-31 16:39:51 -0800130 "received hotplug event for an invalid display (id=%d)", type);
Mathias Agopianff28e202012-09-20 23:24:19 -0700131
Mathias Agopian148994e2012-09-19 17:31:36 -0700132 Mutex::Autolock _l(mLock);
Jesse Hall9e663de2013-08-16 14:28:37 -0700133 if (type < DisplayDevice::NUM_BUILTIN_DISPLAY_TYPES) {
Mathias Agopianff28e202012-09-20 23:24:19 -0700134 DisplayEventReceiver::Event event;
135 event.header.type = DisplayEventReceiver::DISPLAY_EVENT_HOTPLUG;
136 event.header.id = type;
137 event.header.timestamp = systemTime();
138 event.hotplug.connected = connected;
139 mPendingEvents.add(event);
140 mCondition.broadcast();
141 }
Mathias Agopian148994e2012-09-19 17:31:36 -0700142}
143
Mathias Agopiand0566bc2011-11-17 17:49:17 -0800144bool EventThread::threadLoop() {
Mathias Agopianb4d18ed2012-09-20 23:14:05 -0700145 DisplayEventReceiver::Event event;
Lloyd Pique78ce4182018-01-31 16:39:51 -0800146 Vector<sp<EventThread::Connection> > signalConnections;
Mathias Agopianb4d18ed2012-09-20 23:14:05 -0700147 signalConnections = waitForEvent(&event);
Mathias Agopian3eb38cb2012-04-03 22:09:52 -0700148
Mathias Agopian148994e2012-09-19 17:31:36 -0700149 // dispatch events to listeners...
Mathias Agopiana4cb35a2012-08-20 20:07:34 -0700150 const size_t count = signalConnections.size();
Lloyd Pique78ce4182018-01-31 16:39:51 -0800151 for (size_t i = 0; i < count; i++) {
Mathias Agopiana4cb35a2012-08-20 20:07:34 -0700152 const sp<Connection>& conn(signalConnections[i]);
Mathias Agopianb4d18ed2012-09-20 23:14:05 -0700153 // now see if we still need to report this event
154 status_t err = conn->postEvent(event);
Mathias Agopiana4cb35a2012-08-20 20:07:34 -0700155 if (err == -EAGAIN || err == -EWOULDBLOCK) {
156 // The destination doesn't accept events anymore, it's probably
157 // full. For now, we just drop the events on the floor.
Mathias Agopianb4d18ed2012-09-20 23:14:05 -0700158 // FIXME: Note that some events cannot be dropped and would have
159 // to be re-sent later.
160 // Right-now we don't have the ability to do this.
Lloyd Pique78ce4182018-01-31 16:39:51 -0800161 ALOGW("EventThread: dropping event (%08x) for connection %p", event.header.type,
162 conn.get());
Mathias Agopiana4cb35a2012-08-20 20:07:34 -0700163 } else if (err < 0) {
164 // handle any other error on the pipe as fatal. the only
165 // reasonable thing to do is to clean-up this connection.
166 // The most common error we'll get here is -EPIPE.
167 removeDisplayEventConnection(signalConnections[i]);
Mathias Agopiand0566bc2011-11-17 17:49:17 -0800168 }
169 }
Mathias Agopiand0566bc2011-11-17 17:49:17 -0800170 return true;
171}
172
Andy McFadden6bf552e2012-08-30 16:34:41 -0700173// This will return when (1) a vsync event has been received, and (2) there was
174// at least one connection interested in receiving it when we started waiting.
Lloyd Pique78ce4182018-01-31 16:39:51 -0800175Vector<sp<EventThread::Connection> > EventThread::waitForEvent(DisplayEventReceiver::Event* event) {
Mathias Agopianf6bbd442012-08-21 15:47:28 -0700176 Mutex::Autolock _l(mLock);
Lloyd Pique78ce4182018-01-31 16:39:51 -0800177 Vector<sp<EventThread::Connection> > signalConnections;
Mathias Agopianf6bbd442012-08-21 15:47:28 -0700178
179 do {
Mathias Agopian148994e2012-09-19 17:31:36 -0700180 bool eventPending = false;
Mathias Agopianf6bbd442012-08-21 15:47:28 -0700181 bool waitForVSync = false;
Mathias Agopianf6bbd442012-08-21 15:47:28 -0700182
Mathias Agopianff28e202012-09-20 23:24:19 -0700183 size_t vsyncCount = 0;
184 nsecs_t timestamp = 0;
Lloyd Pique78ce4182018-01-31 16:39:51 -0800185 for (int32_t i = 0; i < DisplayDevice::NUM_BUILTIN_DISPLAY_TYPES; i++) {
Mathias Agopianff28e202012-09-20 23:24:19 -0700186 timestamp = mVSyncEvent[i].header.timestamp;
187 if (timestamp) {
188 // we have a vsync event to dispatch
Irvelab046852016-07-28 11:23:08 -0700189 if (mInterceptVSyncs) {
190 mFlinger.mInterceptor.saveVSyncEvent(timestamp);
191 }
Mathias Agopianff28e202012-09-20 23:24:19 -0700192 *event = mVSyncEvent[i];
193 mVSyncEvent[i].header.timestamp = 0;
194 vsyncCount = mVSyncEvent[i].vsync.count;
195 break;
196 }
197 }
198
199 if (!timestamp) {
200 // no vsync event, see if there are some other event
Mathias Agopian148994e2012-09-19 17:31:36 -0700201 eventPending = !mPendingEvents.isEmpty();
202 if (eventPending) {
203 // we have some other event to dispatch
204 *event = mPendingEvents[0];
205 mPendingEvents.removeAt(0);
206 }
207 }
208
Mathias Agopianf6bbd442012-08-21 15:47:28 -0700209 // find out connections waiting for events
210 size_t count = mDisplayEventConnections.size();
Lloyd Pique78ce4182018-01-31 16:39:51 -0800211 for (size_t i = 0; i < count;) {
Mathias Agopianf6bbd442012-08-21 15:47:28 -0700212 sp<Connection> connection(mDisplayEventConnections[i].promote());
Peiyong Lin566a3b42018-01-09 18:22:43 -0800213 if (connection != nullptr) {
Mathias Agopianb4d18ed2012-09-20 23:14:05 -0700214 bool added = false;
Mathias Agopianf6bbd442012-08-21 15:47:28 -0700215 if (connection->count >= 0) {
216 // we need vsync events because at least
217 // one connection is waiting for it
218 waitForVSync = true;
219 if (timestamp) {
220 // we consume the event only if it's time
221 // (ie: we received a vsync event)
222 if (connection->count == 0) {
223 // fired this time around
224 connection->count = -1;
225 signalConnections.add(connection);
Mathias Agopianb4d18ed2012-09-20 23:14:05 -0700226 added = true;
Mathias Agopianf6bbd442012-08-21 15:47:28 -0700227 } else if (connection->count == 1 ||
Lloyd Pique78ce4182018-01-31 16:39:51 -0800228 (vsyncCount % connection->count) == 0) {
Mathias Agopianf6bbd442012-08-21 15:47:28 -0700229 // continuous event, and time to report it
230 signalConnections.add(connection);
Mathias Agopianb4d18ed2012-09-20 23:14:05 -0700231 added = true;
Mathias Agopianf6bbd442012-08-21 15:47:28 -0700232 }
233 }
234 }
Mathias Agopianb4d18ed2012-09-20 23:14:05 -0700235
236 if (eventPending && !timestamp && !added) {
237 // we don't have a vsync event to process
238 // (timestamp==0), but we have some pending
239 // messages.
240 signalConnections.add(connection);
241 }
Ivan Lozano01be49f2017-11-09 10:03:38 -0800242 ++i;
Mathias Agopianf6bbd442012-08-21 15:47:28 -0700243 } else {
244 // we couldn't promote this reference, the connection has
245 // died, so clean-up!
246 mDisplayEventConnections.removeAt(i);
Ivan Lozano01be49f2017-11-09 10:03:38 -0800247 --count;
Mathias Agopianf6bbd442012-08-21 15:47:28 -0700248 }
249 }
250
251 // Here we figure out if we need to enable or disable vsyncs
252 if (timestamp && !waitForVSync) {
253 // we received a VSYNC but we have no clients
254 // don't report it, and disable VSYNC events
255 disableVSyncLocked();
256 } else if (!timestamp && waitForVSync) {
Andy McFadden6bf552e2012-08-30 16:34:41 -0700257 // we have at least one client, so we want vsync enabled
258 // (TODO: this function is called right after we finish
259 // notifying clients of a vsync, so this call will be made
260 // at the vsync rate, e.g. 60fps. If we can accurately
261 // track the current state we could avoid making this call
262 // so often.)
Mathias Agopianf6bbd442012-08-21 15:47:28 -0700263 enableVSyncLocked();
264 }
265
Andy McFadden6bf552e2012-08-30 16:34:41 -0700266 // note: !timestamp implies signalConnections.isEmpty(), because we
267 // don't populate signalConnections if there's no vsync pending
Mathias Agopian148994e2012-09-19 17:31:36 -0700268 if (!timestamp && !eventPending) {
Mathias Agopianf6bbd442012-08-21 15:47:28 -0700269 // wait for something to happen
Andy McFadden6bf552e2012-08-30 16:34:41 -0700270 if (waitForVSync) {
271 // This is where we spend most of our time, waiting
272 // for vsync events and new client registrations.
273 //
274 // If the screen is off, we can't use h/w vsync, so we
275 // use a 16ms timeout instead. It doesn't need to be
276 // precise, we just need to keep feeding our clients.
277 //
278 // We don't want to stall if there's a driver bug, so we
279 // use a (long) timeout when waiting for h/w vsync, and
280 // generate fake events when necessary.
281 bool softwareSync = mUseSoftwareVSync;
282 nsecs_t timeout = softwareSync ? ms2ns(16) : ms2ns(1000);
283 if (mCondition.waitRelative(mLock, timeout) == TIMED_OUT) {
284 if (!softwareSync) {
285 ALOGW("Timed out waiting for hw vsync; faking it");
286 }
Mathias Agopianff28e202012-09-20 23:24:19 -0700287 // FIXME: how do we decide which display id the fake
288 // vsync came from ?
289 mVSyncEvent[0].header.type = DisplayEventReceiver::DISPLAY_EVENT_VSYNC;
Jesse Hall9e663de2013-08-16 14:28:37 -0700290 mVSyncEvent[0].header.id = DisplayDevice::DISPLAY_PRIMARY;
Mathias Agopianff28e202012-09-20 23:24:19 -0700291 mVSyncEvent[0].header.timestamp = systemTime(SYSTEM_TIME_MONOTONIC);
292 mVSyncEvent[0].vsync.count++;
Mathias Agopianf6bbd442012-08-21 15:47:28 -0700293 }
294 } else {
Andy McFadden6bf552e2012-08-30 16:34:41 -0700295 // Nobody is interested in vsync, so we just want to sleep.
296 // h/w vsync should be disabled, so this will wait until we
297 // get a new connection, or an existing connection becomes
298 // interested in receiving vsync again.
Mathias Agopianf6bbd442012-08-21 15:47:28 -0700299 mCondition.wait(mLock);
300 }
301 }
302 } while (signalConnections.isEmpty());
303
304 // here we're guaranteed to have a timestamp and some connections to signal
Andy McFadden6bf552e2012-08-30 16:34:41 -0700305 // (The connections might have dropped out of mDisplayEventConnections
306 // while we were asleep, but we'll still have strong references to them.)
Mathias Agopianf6bbd442012-08-21 15:47:28 -0700307 return signalConnections;
308}
309
Mathias Agopian22ffb112012-04-10 21:04:02 -0700310void EventThread::enableVSyncLocked() {
311 if (!mUseSoftwareVSync) {
312 // never enable h/w VSYNC when screen is off
Jamie Gennisfaf77cc2013-07-30 15:10:32 -0700313 if (!mVsyncEnabled) {
314 mVsyncEnabled = true;
315 mVSyncSource->setCallback(static_cast<VSyncSource::Callback*>(this));
316 mVSyncSource->setVSyncEnabled(true);
Jamie Gennisfaf77cc2013-07-30 15:10:32 -0700317 }
Mathias Agopian22ffb112012-04-10 21:04:02 -0700318 }
Mathias Agopiane2c4f4e2012-04-10 18:25:31 -0700319 mDebugVsyncEnabled = true;
320}
321
Mathias Agopian22ffb112012-04-10 21:04:02 -0700322void EventThread::disableVSyncLocked() {
Jamie Gennisfaf77cc2013-07-30 15:10:32 -0700323 if (mVsyncEnabled) {
324 mVsyncEnabled = false;
325 mVSyncSource->setVSyncEnabled(false);
Jamie Gennisfaf77cc2013-07-30 15:10:32 -0700326 mDebugVsyncEnabled = false;
327 }
Mathias Agopiane2c4f4e2012-04-10 18:25:31 -0700328}
329
Mathias Agopian74d211a2013-04-22 16:55:35 +0200330void EventThread::dump(String8& result) const {
Mathias Agopiand0566bc2011-11-17 17:49:17 -0800331 Mutex::Autolock _l(mLock);
Lloyd Pique78ce4182018-01-31 16:39:51 -0800332 result.appendFormat("VSYNC state: %s\n", mDebugVsyncEnabled ? "enabled" : "disabled");
333 result.appendFormat(" soft-vsync: %s\n", mUseSoftwareVSync ? "enabled" : "disabled");
Greg Hackmann86efcc02014-03-07 12:44:02 -0800334 result.appendFormat(" numListeners=%zu,\n events-delivered: %u\n",
Lloyd Pique78ce4182018-01-31 16:39:51 -0800335 mDisplayEventConnections.size(),
336 mVSyncEvent[DisplayDevice::DISPLAY_PRIMARY].vsync.count);
337 for (size_t i = 0; i < mDisplayEventConnections.size(); i++) {
338 sp<Connection> connection = mDisplayEventConnections.itemAt(i).promote();
339 result.appendFormat(" %p: count=%d\n", connection.get(),
340 connection != nullptr ? connection->count : 0);
Mathias Agopiane2c4f4e2012-04-10 18:25:31 -0700341 }
Mathias Agopiand0566bc2011-11-17 17:49:17 -0800342}
343
344// ---------------------------------------------------------------------------
345
Lloyd Pique78ce4182018-01-31 16:39:51 -0800346EventThread::Connection::Connection(const sp<EventThread>& eventThread)
347 : count(-1), mEventThread(eventThread), mChannel(gui::BitTube::DefaultSize) {}
Mathias Agopiancb9732a2012-04-03 17:48:03 -0700348
349EventThread::Connection::~Connection() {
Mathias Agopianf6bbd442012-08-21 15:47:28 -0700350 // do nothing here -- clean-up will happen automatically
351 // when the main thread wakes up
Mathias Agopiancb9732a2012-04-03 17:48:03 -0700352}
353
354void EventThread::Connection::onFirstRef() {
355 // NOTE: mEventThread doesn't hold a strong reference on us
356 mEventThread->registerDisplayEventConnection(this);
357}
358
Dan Stoza6b698e42017-04-03 13:09:08 -0700359status_t EventThread::Connection::stealReceiveChannel(gui::BitTube* outChannel) {
360 outChannel->setReceiveFd(mChannel.moveReceiveFd());
Dan Stozae1c599b2017-03-30 16:37:19 -0700361 return NO_ERROR;
Mathias Agopiancb9732a2012-04-03 17:48:03 -0700362}
363
Dan Stozae1c599b2017-03-30 16:37:19 -0700364status_t EventThread::Connection::setVsyncRate(uint32_t count) {
Mathias Agopiancb9732a2012-04-03 17:48:03 -0700365 mEventThread->setVsyncRate(count, this);
Dan Stozae1c599b2017-03-30 16:37:19 -0700366 return NO_ERROR;
Mathias Agopiancb9732a2012-04-03 17:48:03 -0700367}
368
369void EventThread::Connection::requestNextVsync() {
370 mEventThread->requestNextVsync(this);
371}
372
Lloyd Pique78ce4182018-01-31 16:39:51 -0800373status_t EventThread::Connection::postEvent(const DisplayEventReceiver::Event& event) {
Dan Stoza6b698e42017-04-03 13:09:08 -0700374 ssize_t size = DisplayEventReceiver::sendEvents(&mChannel, &event, 1);
Mathias Agopiancb9732a2012-04-03 17:48:03 -0700375 return size < 0 ? status_t(size) : status_t(NO_ERROR);
376}
377
378// ---------------------------------------------------------------------------
379
Mathias Agopiand0566bc2011-11-17 17:49:17 -0800380}; // namespace android