From 47f1fe5285fcd9c1d880a1a71cb887e3400b614a Mon Sep 17 00:00:00 2001 From: Mathias Agopian Date: Tue, 8 Nov 2011 17:18:41 -0800 Subject: [PATCH] decrease the light-sensor rate to 1Hz (from ~15Hz) for ALS purposes. the intent here is to save power. Change-Id: I6cc1cae865cc46551afcfcec9ca03faaa5b6936f --- .../java/com/android/server/PowerManagerService.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/services/java/com/android/server/PowerManagerService.java b/services/java/com/android/server/PowerManagerService.java index 1b0addfdae4e0..6b23b33ae7bb1 100644 --- a/services/java/com/android/server/PowerManagerService.java +++ b/services/java/com/android/server/PowerManagerService.java @@ -100,10 +100,13 @@ public class PowerManagerService extends IPowerManager.Stub private static final int LONG_KEYLIGHT_DELAY = 6000; // t+6 sec private static final int LONG_DIM_TIME = 7000; // t+N-5 sec - // How long to wait to debounce light sensor changes. + // How long to wait to debounce light sensor changes in milliseconds private static final int LIGHT_SENSOR_DELAY = 2000; - // For debouncing the proximity sensor. + // light sensor events rate in microseconds + private static final int LIGHT_SENSOR_RATE = 1000000; + + // For debouncing the proximity sensor in milliseconds private static final int PROXIMITY_SENSOR_DELAY = 1000; // trigger proximity if distance is less than 5 cm @@ -3049,7 +3052,7 @@ private void enableLightSensorLocked(boolean enable) { try { if (enable) { mSensorManager.registerListener(mLightListener, mLightSensor, - SensorManager.SENSOR_DELAY_NORMAL); + LIGHT_SENSOR_RATE); } else { mSensorManager.unregisterListener(mLightListener); mHandler.removeCallbacks(mAutoBrightnessTask);