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 int32_t configureChannel(int32_t handle, int32_t rateLevel) = 0; }; // ---------------------------------------------------------------------------- Loading include/gui/ISensorServer.h +5 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,8 @@ #include <binder/IInterface.h> struct native_handle; typedef struct native_handle native_handle_t; namespace android { // ---------------------------------------------------------------------------- Loading @@ -43,6 +45,9 @@ public: virtual sp<ISensorEventConnection> createSensorEventConnection(const String8& packageName, int mode, const String16& opPackageName) = 0; virtual int32_t isDataInjectionEnabled() = 0; virtual sp<ISensorEventConnection> createSensorDirectConnection(const String16& opPackageName, uint32_t size, int32_t type, int32_t format, const native_handle_t *resource) = 0; }; // ---------------------------------------------------------------------------- Loading include/gui/Sensor.h +2 −0 Original line number Diff line number Diff line Loading @@ -91,6 +91,8 @@ public: bool isWakeUpSensor() const; bool isDynamicSensor() const; bool hasAdditionalInfo() const; int32_t getHighestDirectReportRateLevel() const; bool isDirectChannelTypeSupported(int32_t sharedMemType) const; int32_t getReportingMode() const; // Note that after setId() has been called, getUuid() no longer Loading include/gui/SensorManager.h +10 −0 Original line number Diff line number Diff line Loading @@ -34,10 +34,15 @@ #include <gui/SensorEventQueue.h> #include <unordered_map> // ---------------------------------------------------------------------------- // Concrete types for the NDK struct ASensorManager { }; struct native_handle; typedef struct native_handle native_handle_t; // ---------------------------------------------------------------------------- namespace android { // ---------------------------------------------------------------------------- Loading @@ -59,6 +64,9 @@ public: Sensor const* getDefaultSensor(int type); sp<SensorEventQueue> createEventQueue(String8 packageName = String8(""), int mode = 0); bool isDataInjectionEnabled(); int createDirectChannel(size_t size, int channelType, const native_handle_t *channelData); void destroyDirectChannel(int channelNativeHandle); int configureDirectChannel(int channelNativeHandle, int sensorHandle, int rateLevel); private: // DeathRecipient interface Loading @@ -77,6 +85,8 @@ private: Vector<Sensor> mSensors; sp<IBinder::DeathRecipient> mDeathObserver; const String16 mOpPackageName; std::unordered_map<int, sp<ISensorEventConnection>> mDirectConnection; int32_t mDirectConnectionHandle; }; // ---------------------------------------------------------------------------- Loading libs/gui/ISensorEventConnection.cpp +20 −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, CONFIGURE_CHANNEL }; class BpSensorEventConnection : public BpInterface<ISensorEventConnection> Loading Loading @@ -85,6 +86,15 @@ public: remote()->transact(FLUSH_SENSOR, data, &reply); return reply.readInt32(); } virtual int32_t configureChannel(int32_t handle, int32_t rateLevel) { Parcel data, reply; data.writeInterfaceToken(ISensorEventConnection::getInterfaceDescriptor()); data.writeInt32(handle); data.writeInt32(rateLevel); remote()->transact(CONFIGURE_CHANNEL, data, &reply); return reply.readInt32(); } }; // Out-of-line virtual method definition to trigger vtable emission in this Loading Loading @@ -131,6 +141,15 @@ status_t BnSensorEventConnection::onTransact( reply->writeInt32(result); return NO_ERROR; } case CONFIGURE_CHANNEL: { CHECK_INTERFACE(ISensorEventConnection, data, reply); int handle = data.readInt32(); int rateLevel = data.readInt32(); status_t result = configureChannel(handle, rateLevel); reply->writeInt32(result); return NO_ERROR; } } return BBinder::onTransact(code, data, reply, flags); } Loading 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 int32_t configureChannel(int32_t handle, int32_t rateLevel) = 0; }; // ---------------------------------------------------------------------------- Loading
include/gui/ISensorServer.h +5 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,8 @@ #include <binder/IInterface.h> struct native_handle; typedef struct native_handle native_handle_t; namespace android { // ---------------------------------------------------------------------------- Loading @@ -43,6 +45,9 @@ public: virtual sp<ISensorEventConnection> createSensorEventConnection(const String8& packageName, int mode, const String16& opPackageName) = 0; virtual int32_t isDataInjectionEnabled() = 0; virtual sp<ISensorEventConnection> createSensorDirectConnection(const String16& opPackageName, uint32_t size, int32_t type, int32_t format, const native_handle_t *resource) = 0; }; // ---------------------------------------------------------------------------- Loading
include/gui/Sensor.h +2 −0 Original line number Diff line number Diff line Loading @@ -91,6 +91,8 @@ public: bool isWakeUpSensor() const; bool isDynamicSensor() const; bool hasAdditionalInfo() const; int32_t getHighestDirectReportRateLevel() const; bool isDirectChannelTypeSupported(int32_t sharedMemType) const; int32_t getReportingMode() const; // Note that after setId() has been called, getUuid() no longer Loading
include/gui/SensorManager.h +10 −0 Original line number Diff line number Diff line Loading @@ -34,10 +34,15 @@ #include <gui/SensorEventQueue.h> #include <unordered_map> // ---------------------------------------------------------------------------- // Concrete types for the NDK struct ASensorManager { }; struct native_handle; typedef struct native_handle native_handle_t; // ---------------------------------------------------------------------------- namespace android { // ---------------------------------------------------------------------------- Loading @@ -59,6 +64,9 @@ public: Sensor const* getDefaultSensor(int type); sp<SensorEventQueue> createEventQueue(String8 packageName = String8(""), int mode = 0); bool isDataInjectionEnabled(); int createDirectChannel(size_t size, int channelType, const native_handle_t *channelData); void destroyDirectChannel(int channelNativeHandle); int configureDirectChannel(int channelNativeHandle, int sensorHandle, int rateLevel); private: // DeathRecipient interface Loading @@ -77,6 +85,8 @@ private: Vector<Sensor> mSensors; sp<IBinder::DeathRecipient> mDeathObserver; const String16 mOpPackageName; std::unordered_map<int, sp<ISensorEventConnection>> mDirectConnection; int32_t mDirectConnectionHandle; }; // ---------------------------------------------------------------------------- Loading
libs/gui/ISensorEventConnection.cpp +20 −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, CONFIGURE_CHANNEL }; class BpSensorEventConnection : public BpInterface<ISensorEventConnection> Loading Loading @@ -85,6 +86,15 @@ public: remote()->transact(FLUSH_SENSOR, data, &reply); return reply.readInt32(); } virtual int32_t configureChannel(int32_t handle, int32_t rateLevel) { Parcel data, reply; data.writeInterfaceToken(ISensorEventConnection::getInterfaceDescriptor()); data.writeInt32(handle); data.writeInt32(rateLevel); remote()->transact(CONFIGURE_CHANNEL, data, &reply); return reply.readInt32(); } }; // Out-of-line virtual method definition to trigger vtable emission in this Loading Loading @@ -131,6 +141,15 @@ status_t BnSensorEventConnection::onTransact( reply->writeInt32(result); return NO_ERROR; } case CONFIGURE_CHANNEL: { CHECK_INTERFACE(ISensorEventConnection, data, reply); int handle = data.readInt32(); int rateLevel = data.readInt32(); status_t result = configureChannel(handle, rateLevel); reply->writeInt32(result); return NO_ERROR; } } return BBinder::onTransact(code, data, reply, flags); } Loading