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

Commit 815d19d7 authored by Steve Kondik's avatar Steve Kondik
Browse files

livedisplay: Implement active display adjustment

 * LiveDisplay is our new name for the various display technologies
   which adjust the screen based on environmental conditions other
   than the standard automatic backlight controls.
 * This patch implements automatic color temperature adjustment based
   on time of day. This is similar to f.lux or Redshift. My eyes are
   so happy now!
 * Automatic outdoor/SRE feature is now handled here.
 * Handling of CABC/CABL and color enhancements also handled here.
 * Manual RGB tweaking is handled here.
 * Can delegate to DisplayColor HAL if available, otherwise uses
   SurfaceFlinger's 1015 operation to apply changes.
 * Happily coexists with the new accessibility features for color
   blindness correction and color inversion.
 * All postprocessing will be disabled when powersave mode is
   activated.

Change-Id: Iac1b74f410957f8e2d8290465c4ce9cc1fd97a88
parent a17a01aa
Loading
Loading
Loading
Loading
+62 −1
Original line number Diff line number Diff line
@@ -3444,6 +3444,54 @@ public final class Settings {
         */
        public static final String KEY_APP_SWITCH_LONG_PRESS_ACTION = "key_app_switch_long_press_action";

        /**
         * Color temperature of the display during the day
         * @hide
         */
        public static final String DISPLAY_TEMPERATURE_DAY = "display_temperature_day";

        /**
         * Color temperature of the display at night
         * @hide
         */
        public static final String DISPLAY_TEMPERATURE_NIGHT = "display_temperature_night";

        /**
         * Display color temperature adjustment mode, one of DAY (default), NIGHT, or AUTO.
         * @hide
         */
        public static final String DISPLAY_TEMPERATURE_MODE = "display_temperature_mode";

        /**
         * Automatic outdoor mode
         * @hide
         */
        public static final String DISPLAY_AUTO_OUTDOOR_MODE = "display_auto_outdoor_mode";

        /**
         * Use display power saving features such as CABC or CABL
         * @hide
         */
        public static final String DISPLAY_LOW_POWER = "display_low_power";

        /**
         * Use color enhancement feature of display
         * @hide
         */
        public static final String DISPLAY_COLOR_ENHANCE = "display_color_enhance";

        /**
         * Manual display color adjustments (RGB values as floats, separated by spaces)
         * @hide
         */
        public static final String DISPLAY_COLOR_ADJUSTMENT = "display_color_adjustment";

        /**
         * Did we tell about how they can stop breaking their eyes?
         * @hide
         */
        public static final String LIVE_DISPLAY_HINTED = "live_display_hinted";

        /**
         * Settings to backup. This is here so that it's in the same place as the settings
         * keys and easy to update.
@@ -3497,7 +3545,12 @@ public final class Settings {
            RINGTONE,
            LOCK_TO_APP_ENABLED,
            NOTIFICATION_SOUND,
            WIFI_AUTO_CONNECT_TYPE
            WIFI_AUTO_CONNECT_TYPE,
            DISPLAY_TEMPERATURE_NIGHT,
            DISPLAY_TEMPERATURE_DAY,
            DISPLAY_TEMPERATURE_MODE,
            DISPLAY_AUTO_OUTDOOR_MODE,
            LIVE_DISPLAY_HINTED
        };

        /**
@@ -5918,6 +5971,14 @@ public final class Settings {
         */
        public static final String ASSISTANT = "assistant";

        /**
         * Stored color matrix for LiveDisplay. This is used to allow co-existence with
         * display tuning done by DisplayAdjustmentUtils when hardware support isn't
         * available.
         * @hide
         */
        public static final String LIVE_DISPLAY_COLOR_MATRIX = "live_display_color_matrix";

        /**
         * This are the settings to be backed up.
         *
+29 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
    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.
    You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="24dp"
    android:height="24dp"
    android:viewportWidth="24"
    android:viewportHeight="24">

    <path
        android:fillColor="#FFFFFF"
        android:pathData="M15.5,15.5c0.4-0.4,0.7-0.8,0.9-1.2c-1.9,1-4.3,0.7-5.8-0.9s-1.9-4-0.9-5.8C9.2,7.8,8.8,8.1,8.5,8.5
c-2,2-2,5.1,0,7.1S13.6,17.5,15.5,15.5z M19,5v14H5V5H19
M19,3H5C3.9,3,3,3.9,3,5v14c0,1.1,0.9,2,2,2h14c1.1,0,2-0.9,2-2V5
C21,3.9,20.1,3,19,3L19,3z" />
</vector>
 No newline at end of file
+23 −0
Original line number Diff line number Diff line
@@ -23,4 +23,27 @@
        <item>com.google.android.gsf|com.google.android.talk</item>
    </string-array>

    <string-array name="live_display_entries" translatable="false">
        <item>@string/live_display_auto</item>
        <item>@string/live_display_off</item>
        <item>@string/live_display_day</item>
        <item>@string/live_display_night</item>
        <item>@string/live_display_outdoor</item>
    </string-array>

    <string-array name="live_display_summaries" translatable="false">
        <item>@string/live_display_auto_summary</item>
        <item>@string/live_display_off_summary</item>
        <item>@string/live_display_day_summary</item>
        <item>@string/live_display_night_summary</item>
        <item>@string/live_display_outdoor_summary</item>
    </string-array>

    <string-array name="live_display_values" translatable="false">
        <item>2</item>
        <item>0</item>
        <item>4</item>
        <item>1</item>
        <item>3</item>
    </string-array>
</resources>
+33 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
     Copyright (C) 2012-2014 The CyanogenMod Project
     Copyright (c) 2013, The Linux Foundation. All rights reserved.

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">

    <!-- LiveDisplay strings -->
    <string name="live_display_title" translatable="false">LiveDisplay</string>
    <string name="live_display_auto">Automatic</string>
    <string name="live_display_auto_summary">Automatically adjust color temperature of screen after sunset and sunrise</string>
    <string name="live_display_off">Off</string>
    <string name="live_display_off_summary">Disable all adjustments</string>
    <string name="live_display_day">Day</string>
    <string name="live_display_day_summary">Use day settings only</string>
    <string name="live_display_night">Night</string>
    <string name="live_display_night_summary">Use night settings only</string>
    <string name="live_display_outdoor">Outdoor (bright sun)</string>
    <string name="live_display_outdoor_summary">Use outdoor settings only</string>
    <string name="live_display_hint">LiveDisplay can help reduce eyestrain and help you sleep at night. Click here to try it out!</string>
</resources>
+19 −0
Original line number Diff line number Diff line
@@ -26,4 +26,23 @@
    -->
    <!-- External CM specific core services -->
    <java-symbol type="array" name="config_externalCMServices" />
        <!-- LiveDisplay -->
    <java-symbol type="string" name="live_display_title" />
    <java-symbol type="string" name="live_display_hint" />
    <java-symbol type="string" name="live_display_auto" />
    <java-symbol type="string" name="live_display_auto_summary" />
    <java-symbol type="string" name="live_display_day" />
    <java-symbol type="string" name="live_display_day_summary" />
    <java-symbol type="string" name="live_display_night" />
    <java-symbol type="string" name="live_display_night_summary" />
    <java-symbol type="string" name="live_display_outdoor" />
    <java-symbol type="string" name="live_display_outdoor_summary" />
    <java-symbol type="array" name="live_display_entries" />
    <java-symbol type="array" name="live_display_summaries" />
    <java-symbol type="array" name="live_display_values" />
    <java-symbol type="drawable" name="ic_livedisplay_notif" />

    <java-symbol type="integer" name="config_dayColorTemperature" />
    <java-symbol type="integer" name="config_nightColorTemperature" />
    <java-symbol type="integer" name="config_outdoorAmbientLux" />
</resources>
Loading