ssize_t poll(sensors_event_t* buffer, size_t count);
status_t activate(void* ident, int handle, int enabled);
status_t setDelay(void* ident, int handle, int64_t ns);
- status_t resetStateWithoutActuatingHardware(void *ident, int handle);
+ void autoDisable(void *ident, int handle);
- void dump(String8& result, char* buffer, size_t SIZE);
+ void dump(String8& result);
};
// ---------------------------------------------------------------------------
status_t err = NO_ERROR;
for (int i=0 ; i<count ; i++) {
int handle = buffer[i].sensor;
- if (getSensorType(handle) == SENSOR_TYPE_SIGNIFICANT_MOTION) {
+ int type = buffer[i].type;
+ if (type == SENSOR_TYPE_SIGNIFICANT_MOTION) {
if (connection->hasSensor(handle)) {
sensor = mSensorMap.valueFor(handle);
- err = sensor ?sensor->resetStateWithoutActuatingHardware(connection.get(), handle)
- : status_t(BAD_VALUE);
- if (err != NO_ERROR) {
- ALOGE("Sensor Inteface: Resetting state failed with err: %d", err);
+ if (sensor != NULL) {
+ sensor->autoDisable(connection.get(), handle);
}
cleanupWithoutDisable(connection, handle);
}
DefaultKeyedVector<int, SensorInterface*> getActiveVirtualSensors() const;
String8 getSensorName(int handle) const;
- int getSensorType(int handle) const;
void recordLastValue(sensors_event_t const * buffer, size_t count);
static void sortEventBuffer(sensors_event_t* buffer, size_t count);
- void registerSensor(SensorInterface* sensor);
- void registerVirtualSensor(SensorInterface* sensor);
+ Sensor registerSensor(SensorInterface* sensor);
+ Sensor registerVirtualSensor(SensorInterface* sensor);
- status_t cleanupWithoutDisable(const sp<SensorEventConnection>& connection,
- int handle);
+ status_t cleanupWithoutDisable(
+ const sp<SensorEventConnection>& connection, int handle);
+ status_t cleanupWithoutDisableLocked(
+ const sp<SensorEventConnection>& connection, int handle);
void cleanupAutoDisabledSensor(const sp<SensorEventConnection>& connection,
- sensors_event_t const* buffer, const int count);
+ sensors_event_t const* buffer, const int count);
// constants
Vector<Sensor> mSensorList;