Loading include/gui/BitTube.h +3 −0 Original line number Diff line number Diff line Loading @@ -48,6 +48,9 @@ public: // get receive file-descriptor int getFd() const; // get the send file-descriptor. int getSendFd() const; // send objects (sized blobs). All objects are guaranteed to be written or the call fails. template <typename T> static ssize_t sendObjects(const sp<BitTube>& tube, Loading include/gui/ISensorEventConnection.h +0 −1 Original line number Diff line number Diff line Loading @@ -40,7 +40,6 @@ public: nsecs_t maxBatchReportLatencyNs, int reservedFlags) = 0; virtual status_t setEventRate(int handle, nsecs_t ns) = 0; virtual status_t flush() = 0; virtual void decreaseWakeLockRefCount() = 0; }; // ---------------------------------------------------------------------------- Loading libs/gui/BitTube.cpp +5 −0 Original line number Diff line number Diff line Loading @@ -99,6 +99,11 @@ int BitTube::getFd() const return mReceiveFd; } int BitTube::getSendFd() const { return mSendFd; } ssize_t BitTube::write(void const* vaddr, size_t size) { ssize_t err, len; Loading libs/gui/ISensorEventConnection.cpp +1 −14 Original line number Diff line number Diff line Loading @@ -34,8 +34,7 @@ enum { GET_SENSOR_CHANNEL = IBinder::FIRST_CALL_TRANSACTION, ENABLE_DISABLE, SET_EVENT_RATE, FLUSH_SENSOR, DECREASE_WAKE_LOCK_REFCOUNT FLUSH_SENSOR }; class BpSensorEventConnection : public BpInterface<ISensorEventConnection> Loading Loading @@ -84,13 +83,6 @@ public: remote()->transact(FLUSH_SENSOR, data, &reply); return reply.readInt32(); } virtual void decreaseWakeLockRefCount() { Parcel data, reply; data.writeInterfaceToken(ISensorEventConnection::getInterfaceDescriptor()); remote()->transact(DECREASE_WAKE_LOCK_REFCOUNT, data, &reply, IBinder::FLAG_ONEWAY); return; } }; IMPLEMENT_META_INTERFACE(SensorEventConnection, "android.gui.SensorEventConnection"); Loading Loading @@ -133,11 +125,6 @@ status_t BnSensorEventConnection::onTransact( reply->writeInt32(result); return NO_ERROR; } break; case DECREASE_WAKE_LOCK_REFCOUNT: { CHECK_INTERFACE(ISensorEventConnection, data, reply); decreaseWakeLockRefCount(); return NO_ERROR; } break; } return BBinder::onTransact(code, data, reply, flags); } Loading libs/gui/SensorEventQueue.cpp +9 −1 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ #include <stdint.h> #include <sys/types.h> #include <sys/socket.h> #include <utils/Errors.h> #include <utils/RefBase.h> Loading Loading @@ -147,7 +148,14 @@ status_t SensorEventQueue::setEventRate(Sensor const* sensor, nsecs_t ns) const void SensorEventQueue::sendAck(const ASensorEvent* events, int count) { for (int i = 0; i < count; ++i) { if (events[i].flags & WAKE_UP_SENSOR_EVENT_NEEDS_ACK) { mSensorEventConnection->decreaseWakeLockRefCount(); // Send just a byte of data to acknowledge for the wake up sensor events // received char buf = '1'; ssize_t size = ::send(mSensorChannel->getFd(), &buf, sizeof(buf), MSG_DONTWAIT | MSG_NOSIGNAL); if (size < 0) { ALOGE("sendAck failure %d", size); } } } return; Loading Loading
include/gui/BitTube.h +3 −0 Original line number Diff line number Diff line Loading @@ -48,6 +48,9 @@ public: // get receive file-descriptor int getFd() const; // get the send file-descriptor. int getSendFd() const; // send objects (sized blobs). All objects are guaranteed to be written or the call fails. template <typename T> static ssize_t sendObjects(const sp<BitTube>& tube, Loading
include/gui/ISensorEventConnection.h +0 −1 Original line number Diff line number Diff line Loading @@ -40,7 +40,6 @@ public: nsecs_t maxBatchReportLatencyNs, int reservedFlags) = 0; virtual status_t setEventRate(int handle, nsecs_t ns) = 0; virtual status_t flush() = 0; virtual void decreaseWakeLockRefCount() = 0; }; // ---------------------------------------------------------------------------- Loading
libs/gui/BitTube.cpp +5 −0 Original line number Diff line number Diff line Loading @@ -99,6 +99,11 @@ int BitTube::getFd() const return mReceiveFd; } int BitTube::getSendFd() const { return mSendFd; } ssize_t BitTube::write(void const* vaddr, size_t size) { ssize_t err, len; Loading
libs/gui/ISensorEventConnection.cpp +1 −14 Original line number Diff line number Diff line Loading @@ -34,8 +34,7 @@ enum { GET_SENSOR_CHANNEL = IBinder::FIRST_CALL_TRANSACTION, ENABLE_DISABLE, SET_EVENT_RATE, FLUSH_SENSOR, DECREASE_WAKE_LOCK_REFCOUNT FLUSH_SENSOR }; class BpSensorEventConnection : public BpInterface<ISensorEventConnection> Loading Loading @@ -84,13 +83,6 @@ public: remote()->transact(FLUSH_SENSOR, data, &reply); return reply.readInt32(); } virtual void decreaseWakeLockRefCount() { Parcel data, reply; data.writeInterfaceToken(ISensorEventConnection::getInterfaceDescriptor()); remote()->transact(DECREASE_WAKE_LOCK_REFCOUNT, data, &reply, IBinder::FLAG_ONEWAY); return; } }; IMPLEMENT_META_INTERFACE(SensorEventConnection, "android.gui.SensorEventConnection"); Loading Loading @@ -133,11 +125,6 @@ status_t BnSensorEventConnection::onTransact( reply->writeInt32(result); return NO_ERROR; } break; case DECREASE_WAKE_LOCK_REFCOUNT: { CHECK_INTERFACE(ISensorEventConnection, data, reply); decreaseWakeLockRefCount(); return NO_ERROR; } break; } return BBinder::onTransact(code, data, reply, flags); } Loading
libs/gui/SensorEventQueue.cpp +9 −1 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ #include <stdint.h> #include <sys/types.h> #include <sys/socket.h> #include <utils/Errors.h> #include <utils/RefBase.h> Loading Loading @@ -147,7 +148,14 @@ status_t SensorEventQueue::setEventRate(Sensor const* sensor, nsecs_t ns) const void SensorEventQueue::sendAck(const ASensorEvent* events, int count) { for (int i = 0; i < count; ++i) { if (events[i].flags & WAKE_UP_SENSOR_EVENT_NEEDS_ACK) { mSensorEventConnection->decreaseWakeLockRefCount(); // Send just a byte of data to acknowledge for the wake up sensor events // received char buf = '1'; ssize_t size = ::send(mSensorChannel->getFd(), &buf, sizeof(buf), MSG_DONTWAIT | MSG_NOSIGNAL); if (size < 0) { ALOGE("sendAck failure %d", size); } } } return; Loading