summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Chan <mike@android.com>2010-03-25 10:50:17 -0700
committerMike Chan <mike@android.com>2010-03-25 11:01:58 -0700
commit9c8f3552f2456517bc537beb66f5f76acf8a7222 (patch)
tree406bc6870e8c747c15fe5246098e9e8f4c7abdb0
parent1176e1d98393775dc42a92d5cdb20f14b8a4970a (diff)
downloadpassion-common-9c8f3552f2456517bc537beb66f5f76acf8a7222.tar.gz
sensors: Close akm when frameworks calls disable.
Properly unregister sensor, fixes leaking sensor. Change-Id: I25d5587e664d3c2a40f2d126713fda5fdd6a2abf Signed-off-by: Andy Chuang <Andy_Chuang@htc.com> Signed-off-by: Mike Chan <mike@android.com>
-rw-r--r--libsensors/sensors.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libsensors/sensors.c b/libsensors/sensors.c
index 98db476..29ecc98 100644
--- a/libsensors/sensors.c
+++ b/libsensors/sensors.c
@@ -357,6 +357,9 @@ static uint32_t enable_disable_akm(struct sensors_control_context_t *dev,
LOGV("(after) akm sensors = %08x, real = %08x",
sensors, now_active_akm_sensors);
+ if (!sensors)
+ close_akm(dev);
+
return now_active_akm_sensors;
}
@@ -625,7 +628,7 @@ static int data__data_open(struct sensors_data_context_t *dev, native_handle_t*
LOGV("data__data_open: compass fd = %d", handle->data[0]);
LOGV("data__data_open: proximity fd = %d", handle->data[1]);
LOGV("data__data_open: light fd = %d", handle->data[2]);
- native_handle_close(handle);
+ // Framework will close the handle
native_handle_delete(handle);
dev->pendingSensors = 0;