From 78503734837062306099460a61eb36646099fedd Mon Sep 17 00:00:00 2001 From: John Spurlock Date: Mon, 10 Nov 2014 09:41:41 -0500 Subject: Doze: Fix trigger sensor re-registration. Bug: 17541271 Change-Id: I3f19f86165dd4e3677af5ed354e4fc120f9bb407 --- packages/SystemUI/src/com/android/systemui/doze/DozeService.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'packages/SystemUI/src/com/android') diff --git a/packages/SystemUI/src/com/android/systemui/doze/DozeService.java b/packages/SystemUI/src/com/android/systemui/doze/DozeService.java index f8c5e9c..8f14abb 100644 --- a/packages/SystemUI/src/com/android/systemui/doze/DozeService.java +++ b/packages/SystemUI/src/com/android/systemui/doze/DozeService.java @@ -449,10 +449,12 @@ public class DozeService extends DreamService { private void updateListener() { if (!mConfigured || mSensor == null) return; - if (mRequested && !mDisabled) { + if (mRequested && !mDisabled && !mRegistered) { mRegistered = mSensors.requestTriggerSensor(this, mSensor); + if (DEBUG) Log.d(mTag, "requestTriggerSensor " + mRegistered); } else if (mRegistered) { - mSensors.cancelTriggerSensor(this, mSensor); + final boolean rt = mSensors.cancelTriggerSensor(this, mSensor); + if (DEBUG) Log.d(mTag, "cancelTriggerSensor " + rt); mRegistered = false; } } @@ -483,7 +485,8 @@ public class DozeService extends DreamService { } requestPulse(); - setListening(true); // reregister, this sensor only fires once + mRegistered = false; + updateListener(); // reregister, this sensor only fires once // reset the notification pulse schedule, but only if we think we were not triggered // by a notification-related vibration -- cgit v1.1