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

Commit e3c51fea authored by AdrianDC's avatar AdrianDC Committed by Michael Bestas
Browse files

Lights with Screen On [1/2]: Optional allowment of lights

Implement a setting allowing lights to be activated
for new notifications even if the screen is on.

Lights with screen on and Custom values are separated
in an advanced section for a cleaner overview.

This setting gives the user an oportunity to activate lights
with the screen on and also during DayDream screensaver.
The option is not activated by default.

Changes include :
  frameworks/base
  packages/Apps/Settings

Screenshot of the Settings :
  http://i1285.photobucket.com/albums/a583/adriandc/Screenshot_2015-07-20-23-47-13_zpstpmemwwn.png~original



Change-Id: I2071147d8ddab80ba0e1e7310e785ac3e03b3c7c
Signed-off-by: default avatarAdrianDC <radian.dc@gmail.com>
parent ce30097f
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -2820,6 +2820,14 @@ public final class Settings {
        @Deprecated
        public static final String SHOW_WEB_SUGGESTIONS = "show_web_suggestions";

        /**
         * Whether to allow notifications with the screen on or DayDreams.
         * The value is boolean (1 or 0). Default will always be false.
         * @hide
         */
        public static final String NOTIFICATION_LIGHT_SCREEN_ON =
                "notification_light_screen_on_enable";

        /**
         * Whether the notification LED should repeatedly flash when a notification is
         * pending. The value is boolean (1 or 0).
@@ -3629,7 +3637,8 @@ public final class Settings {
            DISPLAY_AUTO_OUTDOOR_MODE,
            LIVE_DISPLAY_HINTED,
            NONE_IS_SILENT,
            ALLOW_LIGHTS
            ALLOW_LIGHTS,
            NOTIFICATION_LIGHT_SCREEN_ON
        };

        /**
+13 −1
Original line number Diff line number Diff line
/*
 * Copyright (C) 2007 The Android Open Source Project
 * Copyright (C) 2015 The CyanogenMod Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
@@ -216,6 +217,9 @@ public class NotificationManagerService extends SystemService {
    private int mDefaultNotificationLedOff;
    private long[] mDefaultVibrationPattern;

    private boolean mScreenOnEnabled = false;
    private boolean mScreenOnDefault = false;

    private long[] mFallbackVibrationPattern;
    private boolean mUseAttentionLight;
    boolean mSystemReady;
@@ -876,6 +880,9 @@ public class NotificationManagerService extends SystemService {
            resolver.registerContentObserver(Settings.System.getUriFor(
                    Settings.System.NOTIFICATION_LIGHT_PULSE_CUSTOM_VALUES),
                    false, this, UserHandle.USER_ALL);
            resolver.registerContentObserver(Settings.System.getUriFor(
                    Settings.System.NOTIFICATION_LIGHT_SCREEN_ON),
                    false, this, UserHandle.USER_ALL);
            resolver.registerContentObserver(Settings.Global.getUriFor(
                    Settings.Global.ZEN_DISABLE_DUCKING_DURING_MEDIA_PLAYBACK), false,
                    this, UserHandle.USER_ALL);
@@ -918,6 +925,11 @@ public class NotificationManagerService extends SystemService {
                        UserHandle.USER_CURRENT));
            }

            // Notification lights with screen on
            mScreenOnEnabled = (Settings.System.getIntForUser(resolver,
                    Settings.System.NOTIFICATION_LIGHT_SCREEN_ON,
                    mScreenOnDefault ? 1 : 0, UserHandle.USER_CURRENT) != 0);

            updateNotificationPulse();

            mDisableDuckingWhileMedia = Settings.Global.getInt(mContext.getContentResolver(),
@@ -3006,7 +3018,7 @@ public class NotificationManagerService extends SystemService {
            enableLed = false;
        } else if (isLedNotificationForcedOn(ledNotification)) {
            enableLed = true;
        } else if (mInCall || mScreenOn) {
        } else if (!mScreenOnEnabled && (mInCall || mScreenOn)) {
            enableLed = false;
        } else {
            enableLed = true;