Merge "AOD: Fix possible NPE in DozeSensors" into oc-dr1-dev

This commit is contained in:
TreeHugger Robot
2017-07-07 17:40:13 +00:00
committed by Android (Google) Code Review

View File

@@ -233,7 +233,9 @@ public class DozeSensors {
mProxCallback.accept(mCurrentlyFar);
long now = SystemClock.elapsedRealtime();
if (!mCurrentlyFar) {
if (mCurrentlyFar == null) {
// Sensor has been unregistered by the proxCallback. Do nothing.
} else if (!mCurrentlyFar) {
mLastNear = now;
} else if (mCurrentlyFar && now - mLastNear < COOLDOWN_TRIGGER) {
// If the last near was very recent, we might be using more power for prox