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
This commit is contained in:
Danny Baumann 2016-09-12 16:18:22 +02:00
parent f15f366c62
commit fceb077b6f
1 changed files with 1 additions and 0 deletions

View File

@ -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;