Loading include/android/sensor.h +3 −1 Original line number Diff line number Diff line Loading @@ -157,7 +157,9 @@ typedef struct ASensorEvent { uint64_t step_counter; } u64; }; int32_t reserved1[4]; uint32_t flags; int32_t reserved1[3]; } ASensorEvent; struct ASensorManager; Loading include/gui/ISensorEventConnection.h +1 −0 Original line number Diff line number Diff line Loading @@ -40,6 +40,7 @@ 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 include/gui/Sensor.h +3 −0 Original line number Diff line number Diff line Loading @@ -71,6 +71,7 @@ public: int32_t getFifoMaxEventCount() const; const String8& getStringType() const; const String8& getRequiredPermission() const; bool isWakeUpSensor() const; // LightFlattenable protocol inline bool isFixedSize() const { return false; } Loading @@ -93,6 +94,8 @@ private: int32_t mFifoMaxEventCount; String8 mStringType; String8 mRequiredPermission; // Todo: Surface this in java SDK. bool mWakeUpSensor; static void flattenString8(void*& buffer, size_t& size, const String8& string8); static bool unflattenString8(void const*& buffer, size_t& size, String8& outputString8); }; Loading include/gui/SensorEventQueue.h +3 −2 Original line number Diff line number Diff line Loading @@ -27,7 +27,7 @@ #include <gui/BitTube.h> // ---------------------------------------------------------------------------- #define WAKE_UP_SENSOR_EVENT_NEEDS_ACK (1 << 31) struct ALooper; struct ASensorEvent; Loading Loading @@ -75,7 +75,8 @@ public: int reservedFlags) const; status_t disableSensor(int32_t handle) const; status_t flush() const; // Send an ack for every wake_up sensor event that is set to WAKE_UP_SENSOR_EVENT_NEEDS_ACK. void sendAck(const ASensorEvent* events, int count); private: sp<Looper> getLooper() const; sp<ISensorEventConnection> mSensorEventConnection; Loading libs/gui/ISensorEventConnection.cpp +14 −1 Original line number Diff line number Diff line Loading @@ -34,7 +34,8 @@ enum { GET_SENSOR_CHANNEL = IBinder::FIRST_CALL_TRANSACTION, ENABLE_DISABLE, SET_EVENT_RATE, FLUSH_SENSOR FLUSH_SENSOR, DECREASE_WAKE_LOCK_REFCOUNT }; class BpSensorEventConnection : public BpInterface<ISensorEventConnection> Loading Loading @@ -83,6 +84,13 @@ 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 @@ -125,6 +133,11 @@ 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 Loading
include/android/sensor.h +3 −1 Original line number Diff line number Diff line Loading @@ -157,7 +157,9 @@ typedef struct ASensorEvent { uint64_t step_counter; } u64; }; int32_t reserved1[4]; uint32_t flags; int32_t reserved1[3]; } ASensorEvent; struct ASensorManager; Loading
include/gui/ISensorEventConnection.h +1 −0 Original line number Diff line number Diff line Loading @@ -40,6 +40,7 @@ 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
include/gui/Sensor.h +3 −0 Original line number Diff line number Diff line Loading @@ -71,6 +71,7 @@ public: int32_t getFifoMaxEventCount() const; const String8& getStringType() const; const String8& getRequiredPermission() const; bool isWakeUpSensor() const; // LightFlattenable protocol inline bool isFixedSize() const { return false; } Loading @@ -93,6 +94,8 @@ private: int32_t mFifoMaxEventCount; String8 mStringType; String8 mRequiredPermission; // Todo: Surface this in java SDK. bool mWakeUpSensor; static void flattenString8(void*& buffer, size_t& size, const String8& string8); static bool unflattenString8(void const*& buffer, size_t& size, String8& outputString8); }; Loading
include/gui/SensorEventQueue.h +3 −2 Original line number Diff line number Diff line Loading @@ -27,7 +27,7 @@ #include <gui/BitTube.h> // ---------------------------------------------------------------------------- #define WAKE_UP_SENSOR_EVENT_NEEDS_ACK (1 << 31) struct ALooper; struct ASensorEvent; Loading Loading @@ -75,7 +75,8 @@ public: int reservedFlags) const; status_t disableSensor(int32_t handle) const; status_t flush() const; // Send an ack for every wake_up sensor event that is set to WAKE_UP_SENSOR_EVENT_NEEDS_ACK. void sendAck(const ASensorEvent* events, int count); private: sp<Looper> getLooper() const; sp<ISensorEventConnection> mSensorEventConnection; Loading
libs/gui/ISensorEventConnection.cpp +14 −1 Original line number Diff line number Diff line Loading @@ -34,7 +34,8 @@ enum { GET_SENSOR_CHANNEL = IBinder::FIRST_CALL_TRANSACTION, ENABLE_DISABLE, SET_EVENT_RATE, FLUSH_SENSOR FLUSH_SENSOR, DECREASE_WAKE_LOCK_REFCOUNT }; class BpSensorEventConnection : public BpInterface<ISensorEventConnection> Loading Loading @@ -83,6 +84,13 @@ 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 @@ -125,6 +133,11 @@ 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