Skip to content

Commit 89c30a5

Browse files
committed
usea socketpair instead of a pipe in BitTube
Bug: 6252830 Change-Id: I363cc7e9f73a5b7d8bbccee312c6d8938c84e99a
1 parent ac21af3 commit 89c30a5

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

services/sensorservice/SensorService.cpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535

3636
#include <gui/ISensorServer.h>
3737
#include <gui/ISensorEventConnection.h>
38+
#include <gui/SensorEventQueue.h>
3839

3940
#include <hardware/sensors.h>
4041

@@ -587,20 +588,16 @@ status_t SensorService::SensorEventConnection::sendEvents(
587588
count = numEvents;
588589
}
589590

590-
if (count == 0)
591-
return 0;
592-
593-
ssize_t size = mChannel->write(scratch, count*sizeof(sensors_event_t));
591+
// NOTE: ASensorEvent and sensors_event_t are the same type
592+
ssize_t size = SensorEventQueue::write(mChannel,
593+
reinterpret_cast<ASensorEvent const*>(scratch), count);
594594
if (size == -EAGAIN) {
595595
// the destination doesn't accept events anymore, it's probably
596596
// full. For now, we just drop the events on the floor.
597597
//ALOGW("dropping %d events on the floor", count);
598598
return size;
599599
}
600600

601-
//ALOGE_IF(size<0, "dropping %d events on the floor (%s)",
602-
// count, strerror(-size));
603-
604601
return size < 0 ? status_t(size) : status_t(NO_ERROR);
605602
}
606603

0 commit comments

Comments
 (0)