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

Commit 3d8260d6 authored by AdrianDC's avatar AdrianDC Committed by Steve Kondik
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>

Lights with screen on: Don't disable leds after the lockscreen

- If lights with screen on is enabled, do not disable leds
  when user passes through the lockscreen.

Change-Id: If8f5b867a34be09fb061bb7ad040b16730f4e263
Signed-off-by: default avatarAdrianDC <radian.dc@gmail.com>
parent 2f5d1201
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -3221,6 +3221,14 @@ public final class Settings {
        /** @hide */
        public static final Validator SHOW_WEB_SUGGESTIONS_VALIDATOR = sBooleanValidator;

        /**
         * 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).
@@ -3989,7 +3997,8 @@ public final class Settings {
            PHONE_BLACKLIST_NOTIFY_ENABLED,
            PHONE_BLACKLIST_PRIVATE_NUMBER_MODE,
            PHONE_BLACKLIST_UNKNOWN_NUMBER_MODE,
            PHONE_BLACKLIST_REGEX_ENABLED
            PHONE_BLACKLIST_REGEX_ENABLED,
            NOTIFICATION_LIGHT_SCREEN_ON
        };

        /**
+18 −3
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.
@@ -234,6 +235,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;
@@ -820,8 +824,11 @@ public class NotificationManagerService extends SystemService {
                }
            } else if (action.equals(Intent.ACTION_USER_PRESENT)) {
                // turn off LED when user passes through lock screen
                // if lights with screen on is disabled.
                if (!mScreenOnEnabled) {
                    mNotificationLight.turnOff();
                    mStatusBar.notificationLightOff();
                }
            } else if (action.equals(Intent.ACTION_USER_SWITCHED)) {
                final int user = intent.getIntExtra(Intent.EXTRA_USER_HANDLE, UserHandle.USER_NULL);
                // reload per-user settings
@@ -871,6 +878,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);
@@ -913,6 +923,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(resolver,
@@ -3262,7 +3277,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;