aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDanny Baumann <dannybaumann@web.de>2016-09-12 16:18:22 +0200
committerDanny Baumann <dannybaumann@web.de>2016-09-12 07:31:07 -0700
commitfceb077b6f4e691f031b027e1584e82ce350a5a6 (patch)
treeba366dc10bb5da0b8b1501a1350a0bdc7a5466d6
parentf15f366c625a02bfe5987eb14e3a29a66b27b676 (diff)
downloadvendor_cmsdk-fceb077b6f4e691f031b027e1584e82ce350a5a6.zip
vendor_cmsdk-fceb077b6f4e691f031b027e1584e82ce350a5a6.tar.gz
vendor_cmsdk-fceb077b6f4e691f031b027e1584e82ce350a5a6.tar.bz2
Don't unboundedly enqueue transition messages.
As long as the light sensor is providing values, each value change will enqueue a transition message, which may queue up. Stop doing that and ensure only one transition message is queued at any given time. Change-Id: I6e9c5b265066089ff9e0cea7237c2023ed1af30c
-rw-r--r--cm/lib/main/java/org/cyanogenmod/platform/internal/display/AmbientLuxObserver.java1
1 files changed, 1 insertions, 0 deletions
diff --git a/cm/lib/main/java/org/cyanogenmod/platform/internal/display/AmbientLuxObserver.java b/cm/lib/main/java/org/cyanogenmod/platform/internal/display/AmbientLuxObserver.java
index f0d67aa..3bca9cb 100644
--- a/cm/lib/main/java/org/cyanogenmod/platform/internal/display/AmbientLuxObserver.java
+++ b/cm/lib/main/java/org/cyanogenmod/platform/internal/display/AmbientLuxObserver.java
@@ -118,6 +118,7 @@ public class AmbientLuxObserver {
// check again in case we didn't get any
// more readings because the sensor settled
if (mRingBuffer.size() > 1) {
+ removeMessages(MSG_TRANSITION);
sendEmptyMessageDelayed(MSG_TRANSITION, mThresholdDuration / 2);
}
break;