use of com.android.server.display.DisplayTransformManager in project android_frameworks_base by crdroidandroid.
the class DisplayAdjustmentUtils method applyInversionSetting.
/**
* Applies the specified user's display color adjustments.
*/
public static void applyInversionSetting(Context context, int userId) {
final ContentResolver cr = context.getContentResolver();
final DisplayTransformManager dtm = LocalServices.getService(DisplayTransformManager.class);
final boolean invertColors = Secure.getIntForUser(cr, Secure.ACCESSIBILITY_DISPLAY_INVERSION_ENABLED, 0, userId) != 0;
dtm.setColorMatrix(DisplayTransformManager.LEVEL_COLOR_MATRIX_INVERT_COLOR, invertColors ? MATRIX_INVERT_COLOR : null);
}
use of com.android.server.display.DisplayTransformManager in project android_frameworks_base by DirtyUnicorns.
the class DisplayAdjustmentUtils method applyDaltonizerSetting.
public static void applyDaltonizerSetting(Context context, int userId) {
final ContentResolver cr = context.getContentResolver();
final DisplayTransformManager dtm = LocalServices.getService(DisplayTransformManager.class);
int daltonizerMode = AccessibilityManager.DALTONIZER_DISABLED;
if (Secure.getIntForUser(cr, Secure.ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED, 0, userId) != 0) {
daltonizerMode = Secure.getIntForUser(cr, Secure.ACCESSIBILITY_DISPLAY_DALTONIZER, DEFAULT_DISPLAY_DALTONIZER, userId);
}
float[] grayscaleMatrix = null;
if (daltonizerMode == AccessibilityManager.DALTONIZER_SIMULATE_MONOCHROMACY) {
// Monochromacy isn't supported by the native Daltonizer.
grayscaleMatrix = MATRIX_GRAYSCALE;
daltonizerMode = AccessibilityManager.DALTONIZER_DISABLED;
}
dtm.setColorMatrix(DisplayTransformManager.LEVEL_COLOR_MATRIX_GRAYSCALE, grayscaleMatrix);
dtm.setDaltonizerMode(daltonizerMode);
}
use of com.android.server.display.DisplayTransformManager in project android_frameworks_base by AOSPA.
the class DisplayAdjustmentUtils method applyInversionSetting.
/**
* Applies the specified user's display color adjustments.
*/
public static void applyInversionSetting(Context context, int userId) {
final ContentResolver cr = context.getContentResolver();
final DisplayTransformManager dtm = LocalServices.getService(DisplayTransformManager.class);
final boolean invertColors = Secure.getIntForUser(cr, Secure.ACCESSIBILITY_DISPLAY_INVERSION_ENABLED, 0, userId) != 0;
dtm.setColorMatrix(DisplayTransformManager.LEVEL_COLOR_MATRIX_INVERT_COLOR, invertColors ? MATRIX_INVERT_COLOR : null);
}
use of com.android.server.display.DisplayTransformManager in project android_frameworks_base by AOSPA.
the class DisplayAdjustmentUtils method applyDaltonizerSetting.
public static void applyDaltonizerSetting(Context context, int userId) {
final ContentResolver cr = context.getContentResolver();
final DisplayTransformManager dtm = LocalServices.getService(DisplayTransformManager.class);
int daltonizerMode = AccessibilityManager.DALTONIZER_DISABLED;
if (Secure.getIntForUser(cr, Secure.ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED, 0, userId) != 0) {
daltonizerMode = Secure.getIntForUser(cr, Secure.ACCESSIBILITY_DISPLAY_DALTONIZER, DEFAULT_DISPLAY_DALTONIZER, userId);
}
float[] grayscaleMatrix = null;
if (daltonizerMode == AccessibilityManager.DALTONIZER_SIMULATE_MONOCHROMACY) {
// Monochromacy isn't supported by the native Daltonizer.
grayscaleMatrix = MATRIX_GRAYSCALE;
daltonizerMode = AccessibilityManager.DALTONIZER_DISABLED;
}
dtm.setColorMatrix(DisplayTransformManager.LEVEL_COLOR_MATRIX_GRAYSCALE, grayscaleMatrix);
dtm.setDaltonizerMode(daltonizerMode);
}
use of com.android.server.display.DisplayTransformManager in project android_frameworks_base by ResurrectionRemix.
the class DisplayAdjustmentUtils method applyDaltonizerSetting.
public static void applyDaltonizerSetting(Context context, int userId) {
final ContentResolver cr = context.getContentResolver();
final DisplayTransformManager dtm = LocalServices.getService(DisplayTransformManager.class);
int daltonizerMode = AccessibilityManager.DALTONIZER_DISABLED;
if (Secure.getIntForUser(cr, Secure.ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED, 0, userId) != 0) {
daltonizerMode = Secure.getIntForUser(cr, Secure.ACCESSIBILITY_DISPLAY_DALTONIZER, DEFAULT_DISPLAY_DALTONIZER, userId);
}
float[] grayscaleMatrix = null;
if (daltonizerMode == AccessibilityManager.DALTONIZER_SIMULATE_MONOCHROMACY) {
// Monochromacy isn't supported by the native Daltonizer.
grayscaleMatrix = MATRIX_GRAYSCALE;
daltonizerMode = AccessibilityManager.DALTONIZER_DISABLED;
}
dtm.setColorMatrix(DisplayTransformManager.LEVEL_COLOR_MATRIX_GRAYSCALE, grayscaleMatrix);
dtm.setDaltonizerMode(daltonizerMode);
}
Aggregations