"accessibility_display_daltonizer";
/**
+ * Float list that specifies the color matrix to apply to
+ * the display. Valid values are defined in AccessibilityManager.
+ *
+ * @hide
+ */
+ public static final String ACCESSIBILITY_DISPLAY_COLOR_MATRIX =
+ "accessibility_display_color_matrix";
+
+ /**
* Setting that specifies whether automatic click when the mouse pointer stops moving is
* enabled.
*
private final Uri mDisplayDaltonizerUri = Settings.Secure.getUriFor(
Settings.Secure.ACCESSIBILITY_DISPLAY_DALTONIZER);
+ private final Uri mDisplayColorMatrixUri = Settings.Secure.getUriFor(
+ Settings.Secure.ACCESSIBILITY_DISPLAY_COLOR_MATRIX);
+
private final Uri mHighTextContrastUri = Settings.Secure.getUriFor(
Settings.Secure.ACCESSIBILITY_HIGH_TEXT_CONTRAST_ENABLED);
contentResolver.registerContentObserver(
mDisplayDaltonizerUri, false, this, UserHandle.USER_ALL);
contentResolver.registerContentObserver(
+ mDisplayColorMatrixUri, false, this, UserHandle.USER_ALL);
+ contentResolver.registerContentObserver(
mHighTextContrastUri, false, this, UserHandle.USER_ALL);
}
if (readDisplayColorAdjustmentSettingsLocked(userState)) {
updateDisplayColorAdjustmentSettingsLocked(userState);
}
+ } else if (mDisplayColorMatrixUri.equals(uri)) {
+ updateDisplayColorAdjustmentSettingsLocked(userState);
} else if (mHighTextContrastUri.equals(uri)) {
if (readHighTextContrastEnabledSettingLocked(userState)) {
onUserStateChangedLocked(userState);
setDaltonizerMode(AccessibilityManager.DALTONIZER_DISABLED);
}
+ String matrix = Settings.Secure.getStringForUser(cr,
+ Settings.Secure.ACCESSIBILITY_DISPLAY_COLOR_MATRIX, userId);
+ if (matrix != null) {
+ colorMatrix = multiply(colorMatrix, getMatrix(matrix));
+ }
+
setColorTransform(colorMatrix);
}
+ private static float[] getMatrix(String matrix) {
+ String[] strValues = matrix.split(",");
+ float[] values = new float[strValues.length];
+ for (int i = 0; i < values.length; i++) {
+ values[i] = Float.parseFloat(strValues[i]);
+ }
+ return values;
+ }
+
private static float[] multiply(float[] matrix, float[] other) {
if (matrix == null) {
return other;