From 15bbec6c17117673e56c661dcee3fca0e1e9f689 Mon Sep 17 00:00:00 2001 From: Dave Mankoff Date: Thu, 27 Jun 2019 15:17:42 -0400 Subject: [PATCH] Ensure that notifications don't wake the screen even when far away. This means that, with AOD on _and_ with the setting to wake the screen for new notificdations, we still _don't_ wake the screen, if the phone doesn't think someone is nearby. Bug: 135452672 Test: manual. Change-Id: Ie2ca292bd7eb092a78e6e264b0e75e42b39d577f --- .../android/systemui/doze/DozeTriggers.java | 24 +++++++++++++++---- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/doze/DozeTriggers.java b/packages/SystemUI/src/com/android/systemui/doze/DozeTriggers.java index a381e7b60f0aa..e408d467bc492 100644 --- a/packages/SystemUI/src/com/android/systemui/doze/DozeTriggers.java +++ b/packages/SystemUI/src/com/android/systemui/doze/DozeTriggers.java @@ -107,9 +107,17 @@ public class DozeTriggers implements DozeMachine.Part { } private void onNotification() { - if (DozeMachine.DEBUG) Log.d(TAG, "requestNotificationPulse"); + if (DozeMachine.DEBUG) { + Log.d(TAG, "requestNotificationPulse"); + } + if (!sWakeDisplaySensorState) { + Log.d(TAG, "Wake display false. Pulse denied."); + return; + } mNotificationPulseTime = SystemClock.elapsedRealtime(); - if (!mConfig.pulseOnNotificationEnabled(UserHandle.USER_CURRENT)) return; + if (!mConfig.pulseOnNotificationEnabled(UserHandle.USER_CURRENT)) { + return; + } requestPulse(DozeLog.PULSE_REASON_NOTIFICATION, false /* performedProxCheck */); DozeLog.traceNotificationPulse(mContext); } @@ -216,15 +224,21 @@ public class DozeTriggers implements DozeMachine.Part { if (state == DozeMachine.State.DOZE_PULSING || state == DozeMachine.State.DOZE_PULSING_BRIGHT) { boolean ignoreTouch = near; - if (DEBUG) Log.i(TAG, "Prox changed, ignore touch = " + ignoreTouch); + if (DEBUG) { + Log.i(TAG, "Prox changed, ignore touch = " + ignoreTouch); + } mDozeHost.onIgnoreTouchWhilePulsing(ignoreTouch); } if (far && (paused || pausing)) { - if (DEBUG) Log.i(TAG, "Prox FAR, unpausing AOD"); + if (DEBUG) { + Log.i(TAG, "Prox FAR, unpausing AOD"); + } mMachine.requestState(DozeMachine.State.DOZE_AOD); } else if (near && aod) { - if (DEBUG) Log.i(TAG, "Prox NEAR, pausing AOD"); + if (DEBUG) { + Log.i(TAG, "Prox NEAR, pausing AOD"); + } mMachine.requestState(DozeMachine.State.DOZE_AOD_PAUSING); } }