summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/SystemUI/src/com/android/systemui/doze/DozeHost.java4
-rw-r--r--packages/SystemUI/src/com/android/systemui/doze/DozeTriggers.java30
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java9
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java5
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java11
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/doze/DozeTriggersTest.java4
6 files changed, 48 insertions, 15 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/doze/DozeHost.java b/packages/SystemUI/src/com/android/systemui/doze/DozeHost.java
index ae6dac59b2f5..07dd2cd77043 100644
--- a/packages/SystemUI/src/com/android/systemui/doze/DozeHost.java
+++ b/packages/SystemUI/src/com/android/systemui/doze/DozeHost.java
@@ -77,8 +77,10 @@ public interface DozeHost {
interface Callback {
/**
* Called when a high priority notification is added.
+ * @param onPulseSuppressedListener A listener that is invoked if the pulse is being
+ * supressed.
*/
- default void onNotificationAlerted() {}
+ default void onNotificationAlerted(Runnable onPulseSuppressedListener) {}
/**
* Called when battery state or power save mode changes.
diff --git a/packages/SystemUI/src/com/android/systemui/doze/DozeTriggers.java b/packages/SystemUI/src/com/android/systemui/doze/DozeTriggers.java
index 8ef01e8d608e..2ca85c074a89 100644
--- a/packages/SystemUI/src/com/android/systemui/doze/DozeTriggers.java
+++ b/packages/SystemUI/src/com/android/systemui/doze/DozeTriggers.java
@@ -106,22 +106,31 @@ public class DozeTriggers implements DozeMachine.Part {
mDockManager = dockManager;
}
- private void onNotification() {
+ private void onNotification(Runnable onPulseSuppressedListener) {
if (DozeMachine.DEBUG) {
Log.d(TAG, "requestNotificationPulse");
}
if (!sWakeDisplaySensorState) {
Log.d(TAG, "Wake display false. Pulse denied.");
+ runIfNotNull(onPulseSuppressedListener);
return;
}
mNotificationPulseTime = SystemClock.elapsedRealtime();
if (!mConfig.pulseOnNotificationEnabled(UserHandle.USER_CURRENT)) {
+ runIfNotNull(onPulseSuppressedListener);
return;
}
- requestPulse(DozeLog.PULSE_REASON_NOTIFICATION, false /* performedProxCheck */);
+ requestPulse(DozeLog.PULSE_REASON_NOTIFICATION, false /* performedProxCheck */,
+ onPulseSuppressedListener);
DozeLog.traceNotificationPulse(mContext);
}
+ private static void runIfNotNull(Runnable runnable) {
+ if (runnable != null) {
+ runnable.run();
+ }
+ }
+
private void proximityCheckThenCall(IntConsumer callback,
boolean alreadyPerformedProxCheck,
int reason) {
@@ -158,10 +167,11 @@ public class DozeTriggers implements DozeMachine.Part {
if (isWakeDisplay) {
onWakeScreen(wakeEvent, mMachine.isExecutingTransition() ? null : mMachine.getState());
} else if (isLongPress) {
- requestPulse(pulseReason, sensorPerformedProxCheck);
+ requestPulse(pulseReason, sensorPerformedProxCheck, null /* onPulseSupressedListener */);
} else if (isWakeLockScreen) {
if (wakeEvent) {
- requestPulse(pulseReason, sensorPerformedProxCheck);
+ requestPulse(pulseReason, sensorPerformedProxCheck,
+ null /* onPulseSupressedListener */);
}
} else {
proximityCheckThenCall((result) -> {
@@ -340,7 +350,8 @@ public class DozeTriggers implements DozeMachine.Part {
}
}
- private void requestPulse(final int reason, boolean performedProxCheck) {
+ private void requestPulse(final int reason, boolean performedProxCheck,
+ Runnable onPulseSuppressedListener) {
Assert.isMainThread();
mDozeHost.extendPulse(reason);
@@ -357,6 +368,7 @@ public class DozeTriggers implements DozeMachine.Part {
DozeLog.tracePulseDropped(mContext, mPulsePending, mMachine.getState(),
mDozeHost.isPulsingBlocked());
}
+ runIfNotNull(onPulseSuppressedListener);
return;
}
@@ -365,6 +377,7 @@ public class DozeTriggers implements DozeMachine.Part {
if (result == ProximityCheck.RESULT_NEAR) {
// in pocket, abort pulse
mPulsePending = false;
+ runIfNotNull(onPulseSuppressedListener);
} else {
// not in pocket, continue pulsing
continuePulseRequest(reason);
@@ -482,7 +495,8 @@ public class DozeTriggers implements DozeMachine.Part {
public void onReceive(Context context, Intent intent) {
if (PULSE_ACTION.equals(intent.getAction())) {
if (DozeMachine.DEBUG) Log.d(TAG, "Received pulse intent");
- requestPulse(DozeLog.PULSE_REASON_INTENT, false /* performedProxCheck */);
+ requestPulse(DozeLog.PULSE_REASON_INTENT, false, /* performedProxCheck */
+ null /* onPulseSupressedListener */);
}
if (UiModeManager.ACTION_ENTER_CAR_MODE.equals(intent.getAction())) {
mMachine.requestState(DozeMachine.State.FINISH);
@@ -532,8 +546,8 @@ public class DozeTriggers implements DozeMachine.Part {
private DozeHost.Callback mHostCallback = new DozeHost.Callback() {
@Override
- public void onNotificationAlerted() {
- onNotification();
+ public void onNotificationAlerted(Runnable onPulseSuppressedListener) {
+ onNotification(onPulseSuppressedListener);
}
@Override
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java
index b19d2ca29c96..3c4f6afdabf8 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java
@@ -176,6 +176,7 @@ public final class NotificationEntry {
private boolean mSensitive = true;
private Runnable mOnSensitiveChangedListener;
private boolean mAutoHeadsUp;
+ private boolean mPulseSupressed;
public NotificationEntry(StatusBarNotification n) {
this(n, null);
@@ -900,6 +901,14 @@ public final class NotificationEntry {
mOnSensitiveChangedListener = listener;
}
+ public boolean isPulseSuppressed() {
+ return mPulseSupressed;
+ }
+
+ public void setPulseSuppressed(boolean suppressed) {
+ mPulseSupressed = suppressed;
+ }
+
/** Information about a suggestion that is being edited. */
public static class EditedSuggestionInfo {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java
index 21de8a59836e..ba3406999388 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java
@@ -78,6 +78,7 @@ public class NotificationIconAreaController implements DarkReceiver,
private int mAodIconTint;
private boolean mFullyHidden;
private boolean mAodIconsVisible;
+ private boolean mIsPulsing;
public NotificationIconAreaController(Context context, StatusBar statusBar,
StatusBarStateController statusBarStateController,
@@ -265,7 +266,9 @@ public class NotificationIconAreaController implements DarkReceiver,
if (!showAmbient && entry.shouldSuppressStatusBar()) {
return false;
}
- if (hidePulsing && entry.showingPulsing()) {
+ if (hidePulsing && entry.showingPulsing()
+ && (!mWakeUpCoordinator.getNotificationsFullyHidden()
+ || !entry.isPulseSuppressed())) {
return false;
}
return true;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
index d93dc950a077..aefb79c22ef1 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
@@ -1578,7 +1578,8 @@ public class StatusBar extends SystemUI implements DemoMode,
public void onHeadsUpStateChanged(NotificationEntry entry, boolean isHeadsUp) {
mEntryManager.updateNotifications();
if (isDozing() && isHeadsUp) {
- mDozeServiceHost.fireNotificationPulse();
+ entry.setPulseSuppressed(false);
+ mDozeServiceHost.fireNotificationPulse(entry);
if (mPulsing) {
mDozeScrimController.cancelPendingPulseTimeout();
}
@@ -3920,9 +3921,13 @@ public class StatusBar extends SystemUI implements DemoMode,
}
}
- public void fireNotificationPulse() {
+ public void fireNotificationPulse(NotificationEntry entry) {
+ Runnable pulseSupressedListener = () -> {
+ entry.setPulseSuppressed(true);
+ mNotificationIconAreaController.updateAodNotificationIcons();
+ };
for (Callback callback : mCallbacks) {
- callback.onNotificationAlerted();
+ callback.onNotificationAlerted(pulseSupressedListener);
}
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/doze/DozeTriggersTest.java b/packages/SystemUI/tests/src/com/android/systemui/doze/DozeTriggersTest.java
index eb8ef09d0635..d4642238d8fd 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/doze/DozeTriggersTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/doze/DozeTriggersTest.java
@@ -95,13 +95,13 @@ public class DozeTriggersTest extends SysuiTestCase {
mTriggers.transitionTo(DozeMachine.State.INITIALIZED, DozeMachine.State.DOZE);
clearInvocations(mMachine);
- mHost.callback.onNotificationAlerted();
+ mHost.callback.onNotificationAlerted(null /* pulseSuppressedListener */);
mSensors.getMockProximitySensor().sendProximityResult(false); /* Near */
verify(mMachine, never()).requestState(any());
verify(mMachine, never()).requestPulse(anyInt());
- mHost.callback.onNotificationAlerted();
+ mHost.callback.onNotificationAlerted(null /* pulseSuppressedListener */);
mSensors.getMockProximitySensor().sendProximityResult(true); /* Far */
verify(mMachine).requestPulse(anyInt());