diff options
| author | Steve Kondik <steve@cyngn.com> | 2015-02-18 03:52:24 -0800 |
|---|---|---|
| committer | Steve Kondik <steve@cyngn.com> | 2015-10-18 22:37:44 -0700 |
| commit | 815d19d74a713e62247c970416fb40774ee797dd (patch) | |
| tree | 34f3e4e55e966450665de9953c22b79f9a138c5a /services/accessibility/java/com/android | |
| parent | a17a01aa535cc8b669b4f0574a72c25ed82541dc (diff) | |
| download | frameworks_base-815d19d74a713e62247c970416fb40774ee797dd.zip frameworks_base-815d19d74a713e62247c970416fb40774ee797dd.tar.gz frameworks_base-815d19d74a713e62247c970416fb40774ee797dd.tar.bz2 | |
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
Diffstat (limited to 'services/accessibility/java/com/android')
| -rw-r--r-- | services/accessibility/java/com/android/server/accessibility/DisplayAdjustmentUtils.java | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/services/accessibility/java/com/android/server/accessibility/DisplayAdjustmentUtils.java b/services/accessibility/java/com/android/server/accessibility/DisplayAdjustmentUtils.java index d0b5898..ab8eacf 100644 --- a/services/accessibility/java/com/android/server/accessibility/DisplayAdjustmentUtils.java +++ b/services/accessibility/java/com/android/server/accessibility/DisplayAdjustmentUtils.java @@ -30,7 +30,7 @@ import android.view.accessibility.AccessibilityManager; /** * Utility methods for performing accessibility display adjustments. */ -class DisplayAdjustmentUtils { +public class DisplayAdjustmentUtils { private static final String LOG_TAG = DisplayAdjustmentUtils.class.getSimpleName(); /** Matrix and offset used for converting color to gray-scale. */ @@ -76,6 +76,11 @@ class DisplayAdjustmentUtils { return true; } + if (Settings.Secure.getStringForUser(cr, + Settings.Secure.LIVE_DISPLAY_COLOR_MATRIX, userId) != null) { + return true; + } + return false; } @@ -91,6 +96,23 @@ class DisplayAdjustmentUtils { colorMatrix = multiply(colorMatrix, INVERSION_MATRIX_VALUE_ONLY); } + String adj = Settings.Secure.getStringForUser(cr, + Settings.Secure.LIVE_DISPLAY_COLOR_MATRIX, userId); + if (adj != null) { + String[] tmp = adj.split(" "); + if (tmp.length == 16) { + float[] adjMatrix = new float[16]; + try { + for (int i = 0; i < 16; i++) { + adjMatrix[i] = Float.parseFloat(tmp[i]); + } + colorMatrix = multiply(colorMatrix, adjMatrix); + } catch (NumberFormatException e) { + Slog.e(LOG_TAG, e.getMessage(), e); + } + } + } + if (Settings.Secure.getIntForUser(cr, Settings.Secure.ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED, 0, userId) != 0) { final int daltonizerMode = Settings.Secure.getIntForUser(cr, |
