summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArve Hjønnevåg <arve@google.com>2011-10-21 20:35:22 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-10-21 20:35:22 -0700
commit216ccd5723f5a5674d7b0c5821477bf5289e2e6e (patch)
tree18a443ce5be42ff2a49ad7455a64674020386b47
parent309c0d366d74035bbc3fca8a387a3326b2937513 (diff)
parentc1191a6c4c13d7b8bae00645b2b99f0347051cf7 (diff)
downloaddevice_samsung_tuna-216ccd5723f5a5674d7b0c5821477bf5289e2e6e.zip
device_samsung_tuna-216ccd5723f5a5674d7b0c5821477bf5289e2e6e.tar.gz
device_samsung_tuna-216ccd5723f5a5674d7b0c5821477bf5289e2e6e.tar.bz2
Merge "SensorHAL: clear previous light value on enable" into ics-mr0
-rw-r--r--libsensors/LightSensor.cpp8
-rw-r--r--libsensors/LightSensor.h1
2 files changed, 9 insertions, 0 deletions
diff --git a/libsensors/LightSensor.cpp b/libsensors/LightSensor.cpp
index 8c111f9..15ae4e2 100644
--- a/libsensors/LightSensor.cpp
+++ b/libsensors/LightSensor.cpp
@@ -34,7 +34,15 @@ LightSensor::LightSensor()
mPreviousLight = -1;
}
+int LightSensor::handleEnable(int en) {
+ mPreviousLight = -1;
+ return 0;
+}
+
bool LightSensor::handleEvent(input_event const *event) {
+ if (event->value == -1) {
+ return false;
+ }
mPendingEvent.light = indexToValue(event->value);
if (mPendingEvent.light != mPreviousLight) {
mPreviousLight = mPendingEvent.light;
diff --git a/libsensors/LightSensor.h b/libsensors/LightSensor.h
index ed639f4..ed3b435 100644
--- a/libsensors/LightSensor.h
+++ b/libsensors/LightSensor.h
@@ -33,6 +33,7 @@ struct input_event;
class LightSensor:public SamsungSensorBase {
float mPreviousLight;
+ virtual int handleEnable(int en);
virtual bool handleEvent(input_event const * event);
float indexToValue(size_t index) const;
public: