Search in sources :

Example 6 with DisplayTransformManager

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);
}
Also used : DisplayTransformManager(com.android.server.display.DisplayTransformManager) ContentResolver(android.content.ContentResolver)

Example 7 with DisplayTransformManager

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);
}
Also used : DisplayTransformManager(com.android.server.display.DisplayTransformManager) ContentResolver(android.content.ContentResolver)

Example 8 with DisplayTransformManager

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);
}
Also used : DisplayTransformManager(com.android.server.display.DisplayTransformManager) ContentResolver(android.content.ContentResolver)

Example 9 with DisplayTransformManager

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);
}
Also used : DisplayTransformManager(com.android.server.display.DisplayTransformManager) ContentResolver(android.content.ContentResolver)

Example 10 with DisplayTransformManager

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);
}
Also used : DisplayTransformManager(com.android.server.display.DisplayTransformManager) ContentResolver(android.content.ContentResolver)

Aggregations

ContentResolver (android.content.ContentResolver)10 DisplayTransformManager (com.android.server.display.DisplayTransformManager)10