summaryrefslogtreecommitdiffstats
path: root/services/accessibility
diff options
context:
space:
mode:
authorAlan Viverette <alanv@google.com>2014-05-12 15:26:45 -0700
committerAlan Viverette <alanv@google.com>2014-05-12 15:26:45 -0700
commite08340645d2539ab13900b5f835b84bcfe8b99e0 (patch)
treeb49994d8efa3210add9f92d501d675bbbdf30a5d /services/accessibility
parentcfd9d7eec23159c06faccf62d12d9a117a3067ef (diff)
downloadframeworks_base-e08340645d2539ab13900b5f835b84bcfe8b99e0.zip
frameworks_base-e08340645d2539ab13900b5f835b84bcfe8b99e0.tar.gz
frameworks_base-e08340645d2539ab13900b5f835b84bcfe8b99e0.tar.bz2
Simplify accessibility display adjustments
Makes the inversion bit public so apps can be smarter about rendering images non-inverted (if they are so inclined). BUG: 14680114 Change-Id: I8ca2b2517af2ffc13446d7e0b4e859c1171e2d0e
Diffstat (limited to 'services/accessibility')
-rw-r--r--services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java23
-rw-r--r--services/accessibility/java/com/android/server/accessibility/DisplayAdjustmentUtils.java71
2 files changed, 2 insertions, 92 deletions
diff --git a/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java b/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java
index 4a59a8f..36b5cfb 100644
--- a/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java
+++ b/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java
@@ -3698,17 +3698,8 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
private final Uri mEnhancedWebAccessibilityUri = Settings.Secure
.getUriFor(Settings.Secure.ACCESSIBILITY_SCRIPT_INJECTION);
- private final Uri mDisplayContrastEnabledUri = Settings.Secure.getUriFor(
- Settings.Secure.ACCESSIBILITY_DISPLAY_CONTRAST_ENABLED);
- private final Uri mDisplayContrastUri = Settings.Secure.getUriFor(
- Settings.Secure.ACCESSIBILITY_DISPLAY_CONTRAST);
- private final Uri mDisplayBrightnessUri = Settings.Secure.getUriFor(
- Settings.Secure.ACCESSIBILITY_DISPLAY_BRIGHTNESS);
-
private final Uri mDisplayInversionEnabledUri = Settings.Secure.getUriFor(
Settings.Secure.ACCESSIBILITY_DISPLAY_INVERSION_ENABLED);
- private final Uri mDisplayInversionUri = Settings.Secure.getUriFor(
- Settings.Secure.ACCESSIBILITY_DISPLAY_INVERSION);
private final Uri mDisplayDaltonizerEnabledUri = Settings.Secure.getUriFor(
Settings.Secure.ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED);
@@ -3734,16 +3725,8 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
contentResolver.registerContentObserver(mEnhancedWebAccessibilityUri,
false, this, UserHandle.USER_ALL);
contentResolver.registerContentObserver(
- mDisplayContrastEnabledUri, false, this, UserHandle.USER_ALL);
- contentResolver.registerContentObserver(
- mDisplayContrastUri, false, this, UserHandle.USER_ALL);
- contentResolver.registerContentObserver(
- mDisplayBrightnessUri, false, this, UserHandle.USER_ALL);
- contentResolver.registerContentObserver(
mDisplayInversionEnabledUri, false, this, UserHandle.USER_ALL);
contentResolver.registerContentObserver(
- mDisplayInversionUri, false, this, UserHandle.USER_ALL);
- contentResolver.registerContentObserver(
mDisplayDaltonizerEnabledUri, false, this, UserHandle.USER_ALL);
contentResolver.registerContentObserver(
mDisplayDaltonizerUri, false, this, UserHandle.USER_ALL);
@@ -3823,12 +3806,8 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
}
}
}
- } else if (mDisplayContrastEnabledUri.equals(uri)
- || mDisplayInversionEnabledUri.equals(uri)
+ } else if (mDisplayInversionEnabledUri.equals(uri)
|| mDisplayDaltonizerEnabledUri.equals(uri)
- || mDisplayContrastUri.equals(uri)
- || mDisplayBrightnessUri.equals(uri)
- || mDisplayInversionUri.equals(uri)
|| mDisplayDaltonizerUri.equals(uri)) {
synchronized (mLock) {
// Profiles share the accessibility state of the parent. Therefore,
diff --git a/services/accessibility/java/com/android/server/accessibility/DisplayAdjustmentUtils.java b/services/accessibility/java/com/android/server/accessibility/DisplayAdjustmentUtils.java
index 52bdeda..394c196 100644
--- a/services/accessibility/java/com/android/server/accessibility/DisplayAdjustmentUtils.java
+++ b/services/accessibility/java/com/android/server/accessibility/DisplayAdjustmentUtils.java
@@ -41,22 +41,6 @@ class DisplayAdjustmentUtils {
0, 0, 0, 1
};
- /** Matrix and offset used for standard display inversion. */
- private static final float[] INVERSION_MATRIX_STANDARD = new float[] {
- -1, 0, 0, 0,
- 0, -1, 0, 0,
- 0, 0, -1, 0,
- 1, 1, 1, 1
- };
-
- /** Matrix and offset used for hue-only display inversion. */
- private static final float[] INVERSION_MATRIX_HUE_ONLY = new float[] {
- 0, .5f, .5f, 0,
- .5f, 0, .5f, 0,
- .5f, .5f, 0, 0,
- 0, 0, 0, 1
- };
-
/** Matrix and offset used for value-only display inversion. */
private static final float[] INVERSION_MATRIX_VALUE_ONLY = new float[] {
0, -.5f, -.5f, 0,
@@ -65,15 +49,6 @@ class DisplayAdjustmentUtils {
1, 1, 1, 1
};
- /** Default contrast for display contrast enhancement. */
- private static final float DEFAULT_DISPLAY_CONTRAST = 2;
-
- /** Default brightness for display contrast enhancement. */
- private static final float DEFAULT_DISPLAY_BRIGHTNESS = 0;
-
- /** Default inversion mode for display color inversion. */
- private static final int DEFAULT_DISPLAY_INVERSION = AccessibilityManager.INVERSION_STANDARD;
-
/** Default inversion mode for display color correction. */
private static final int DEFAULT_DISPLAY_DALTONIZER =
AccessibilityManager.DALTONIZER_CORRECT_DEUTERANOMALY;
@@ -90,11 +65,6 @@ class DisplayAdjustmentUtils {
if (!hasColorTransform) {
hasColorTransform |= Settings.Secure.getIntForUser(
- cr, Settings.Secure.ACCESSIBILITY_DISPLAY_CONTRAST_ENABLED, 0, userId) == 1;
- }
-
- if (!hasColorTransform) {
- hasColorTransform |= Settings.Secure.getIntForUser(
cr, Settings.Secure.ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED, 0, userId) == 1;
}
@@ -115,21 +85,7 @@ class DisplayAdjustmentUtils {
final boolean inversionEnabled = Settings.Secure.getIntForUser(
cr, Settings.Secure.ACCESSIBILITY_DISPLAY_INVERSION_ENABLED, 0, userId) == 1;
if (inversionEnabled) {
- final int inversionMode = Settings.Secure.getIntForUser(cr,
- Settings.Secure.ACCESSIBILITY_DISPLAY_INVERSION, DEFAULT_DISPLAY_INVERSION,
- userId);
- final float[] inversionMatrix;
- switch (inversionMode) {
- case AccessibilityManager.INVERSION_HUE_ONLY:
- inversionMatrix = INVERSION_MATRIX_HUE_ONLY;
- break;
- case AccessibilityManager.INVERSION_VALUE_ONLY:
- inversionMatrix = INVERSION_MATRIX_VALUE_ONLY;
- break;
- default:
- inversionMatrix = INVERSION_MATRIX_STANDARD;
- }
-
+ final float[] inversionMatrix = INVERSION_MATRIX_VALUE_ONLY;
Matrix.multiplyMM(outputMatrix, 0, colorMatrix, 0, inversionMatrix, 0);
colorMatrix = outputMatrix;
@@ -138,31 +94,6 @@ class DisplayAdjustmentUtils {
hasColorTransform = true;
}
- final boolean contrastEnabled = Settings.Secure.getIntForUser(
- cr, Settings.Secure.ACCESSIBILITY_DISPLAY_CONTRAST_ENABLED, 0, userId) == 1;
- if (contrastEnabled) {
- final float contrast = Settings.Secure.getFloatForUser(cr,
- Settings.Secure.ACCESSIBILITY_DISPLAY_CONTRAST, DEFAULT_DISPLAY_CONTRAST,
- userId);
- final float brightness = Settings.Secure.getFloatForUser(cr,
- Settings.Secure.ACCESSIBILITY_DISPLAY_BRIGHTNESS, DEFAULT_DISPLAY_BRIGHTNESS,
- userId);
- final float off = brightness * contrast - 0.5f * contrast + 0.5f;
- final float[] contrastMatrix = {
- contrast, 0, 0, 0,
- 0, contrast, 0, 0,
- 0, 0, contrast, 0,
- off, off, off, 1
- };
-
- Matrix.multiplyMM(outputMatrix, 0, colorMatrix, 0, contrastMatrix, 0);
-
- colorMatrix = outputMatrix;
- outputMatrix = colorMatrix;
-
- hasColorTransform = true;
- }
-
final boolean daltonizerEnabled = Settings.Secure.getIntForUser(
cr, Settings.Secure.ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED, 0, userId) != 0;
if (daltonizerEnabled) {