Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b4d49dd4 authored by Ehud Shabtai's avatar Ehud Shabtai Committed by Steve Kondik
Browse files

Add option for blending pulse notification.

parent d5c89993
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -1425,6 +1425,14 @@ public final class Settings {
         */
        public static final String NOTIFICATION_LIGHT_PULSE = "notification_light_pulse";

        /**
         * Whether the notification LED color should be blended with all
	 * active notifications.
	 * The value is boolean (1 or 0).
         * @hide
         */
        public static final String NOTIFICATION_PULSE_BLEND = "notification_light_pulse_blend";

        /**
         * Whether to pulse the notification LED while the screen is on. The value is
         * boolean (1 or 0).
+16 −7
Original line number Diff line number Diff line
@@ -100,6 +100,7 @@ class NotificationManagerService extends INotificationManager.Stub
    private boolean mScreenOn = true;
    private boolean mNotificationScreenOn;
    private boolean mNotificationPulseEnabled;
    private boolean mNotificationPulseBlend;
    private boolean mPulseBreathingLight;
    private int mBreathingLightColor;

@@ -386,6 +387,12 @@ class NotificationManagerService extends INotificationManager.Stub
                mNotificationPulseEnabled = pulseEnabled;
                updateNotificationPulse();
            }
            boolean pulseBlend = Settings.System.getInt(resolver,
                        Settings.System.NOTIFICATION_PULSE_BLEND, 0) != 0;
            if (mNotificationPulseBlend != pulseBlend) {
                mNotificationPulseBlend = pulseBlend;
                updateNotificationPulse();
            }
            boolean screenOn = Settings.System.getInt(resolver,
                        Settings.System.NOTIFICATION_SCREEN_ON, 0) != 0;
            if (mNotificationScreenOn != screenOn) {
@@ -1041,13 +1048,6 @@ class NotificationManagerService extends INotificationManager.Stub
            }
        }

        // Blend all the colors together
        int ledARGB = 0;
        if (mLedNotification != null) ledARGB = mLedNotification.notification.ledARGB;
        for (int n=0; n < mLights.size(); n++) {
            ledARGB |= mLights.get(n).notification.ledARGB;
        }
	
        // we only flash if screen is off and persistent pulsing is enabled
        if (mLedNotification == null || (mScreenOn && !mNotificationScreenOn) || !mNotificationPulseEnabled) {
            if (mPulseBreathingLight) {
@@ -1056,6 +1056,15 @@ class NotificationManagerService extends INotificationManager.Stub
                mHardware.setLightOff_UNCHECKED(HardwareService.LIGHT_ID_NOTIFICATIONS);
            }
        } else {
            int ledARGB = mLedNotification.notification.ledARGB;

            if (mNotificationPulseBlend) {
                // Blend all the colors together
                for (int n=0; n < mLights.size(); n++) {
                    ledARGB |= mLights.get(n).notification.ledARGB;
                }
            }
	
            mHardware.setLightFlashing_UNCHECKED(
                    HardwareService.LIGHT_ID_NOTIFICATIONS,
                    ledARGB,