Loading packages/SystemUI/src/com/android/systemui/doze/DozeHost.java +3 −1 Original line number Diff line number Diff line Loading @@ -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. Loading packages/SystemUI/src/com/android/systemui/doze/DozeTriggers.java +22 −8 Original line number Diff line number Diff line Loading @@ -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) { Loading Loading @@ -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) -> { Loading Loading @@ -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); Loading @@ -357,6 +368,7 @@ public class DozeTriggers implements DozeMachine.Part { DozeLog.tracePulseDropped(mContext, mPulsePending, mMachine.getState(), mDozeHost.isPulsingBlocked()); } runIfNotNull(onPulseSuppressedListener); return; } Loading @@ -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); Loading Loading @@ -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); Loading Loading @@ -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 Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java +9 −0 Original line number Diff line number Diff line Loading @@ -165,6 +165,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); Loading Loading @@ -820,6 +821,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 { Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java +4 −1 Original line number Diff line number Diff line Loading @@ -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, Loading Loading @@ -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; Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +8 −3 Original line number Diff line number Diff line Loading @@ -1583,7 +1583,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(); } Loading Loading @@ -3938,9 +3939,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); } } Loading Loading
packages/SystemUI/src/com/android/systemui/doze/DozeHost.java +3 −1 Original line number Diff line number Diff line Loading @@ -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. Loading
packages/SystemUI/src/com/android/systemui/doze/DozeTriggers.java +22 −8 Original line number Diff line number Diff line Loading @@ -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) { Loading Loading @@ -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) -> { Loading Loading @@ -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); Loading @@ -357,6 +368,7 @@ public class DozeTriggers implements DozeMachine.Part { DozeLog.tracePulseDropped(mContext, mPulsePending, mMachine.getState(), mDozeHost.isPulsingBlocked()); } runIfNotNull(onPulseSuppressedListener); return; } Loading @@ -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); Loading Loading @@ -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); Loading Loading @@ -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 Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java +9 −0 Original line number Diff line number Diff line Loading @@ -165,6 +165,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); Loading Loading @@ -820,6 +821,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 { Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java +4 −1 Original line number Diff line number Diff line Loading @@ -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, Loading Loading @@ -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; Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +8 −3 Original line number Diff line number Diff line Loading @@ -1583,7 +1583,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(); } Loading Loading @@ -3938,9 +3939,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); } } Loading