diff options
4 files changed, 3 insertions, 141 deletions
diff --git a/api/current.txt b/api/current.txt index 3ceea24..a35b0a9 100644 --- a/api/current.txt +++ b/api/current.txt @@ -23498,6 +23498,7 @@ package android.provider { method public static boolean putLong(android.content.ContentResolver, java.lang.String, long); method public static boolean putString(android.content.ContentResolver, java.lang.String, java.lang.String); method public static final deprecated void setLocationProviderEnabled(android.content.ContentResolver, java.lang.String, boolean); + field public static final java.lang.String ACCESSIBILITY_DISPLAY_INVERSION_ENABLED = "accessibility_display_inversion_enabled"; field public static final java.lang.String ACCESSIBILITY_ENABLED = "accessibility_enabled"; field public static final java.lang.String ACCESSIBILITY_SPEAK_PASSWORD = "speak_password"; field public static final deprecated java.lang.String ADB_ENABLED = "adb_enabled"; diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index 1847b55..e1fd46e 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -3838,22 +3838,11 @@ public final class Settings { /** * Setting that specifies whether display color inversion is enabled. - * - * @hide */ public static final String ACCESSIBILITY_DISPLAY_INVERSION_ENABLED = "accessibility_display_inversion_enabled"; /** - * Integer property that specifies the type of color inversion to - * perform. Valid values are defined in AccessibilityManager. - * - * @hide - */ - public static final String ACCESSIBILITY_DISPLAY_INVERSION = - "accessibility_display_inversion"; - - /** * Setting that specifies whether the quick setting tile for display * color space adjustment is enabled. * @@ -3881,44 +3870,6 @@ public final class Settings { "accessibility_display_daltonizer"; /** - * Setting that specifies whether the quick setting tile for display - * contrast enhancement is enabled. - * - * @hide - */ - public static final String ACCESSIBILITY_DISPLAY_CONTRAST_QUICK_SETTING_ENABLED = - "accessibility_display_contrast_quick_setting_enabled"; - - /** - * Setting that specifies whether display contrast enhancement is - * enabled. - * - * @hide - */ - public static final String ACCESSIBILITY_DISPLAY_CONTRAST_ENABLED = - "accessibility_display_contrast_enabled"; - - /** - * Floating point property that specifies display contrast adjustment. - * Valid range is [0, ...] where 0 is gray, 1 is normal, and higher - * values indicate enhanced contrast. - * - * @hide - */ - public static final String ACCESSIBILITY_DISPLAY_CONTRAST = - "accessibility_display_contrast"; - - /** - * Floating point property that specifies display brightness adjustment. - * Valid range is [-1, 1] where -1 is black, 0 is default, and 1 is - * white. - * - * @hide - */ - public static final String ACCESSIBILITY_DISPLAY_BRIGHTNESS = - "accessibility_display_brightness"; - - /** * The timout for considering a press to be a long press in milliseconds. * @hide */ 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) { |