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:
parent
f15f366c62
commit
fceb077b6f
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue