Add config value for a11y color mode

Accessibility transforms require a specific color mode that is not
always available for the user to select.

Bug: 130376719
Test: atest com.google.android.config.pts
Change-Id: If331e663ec50e5507c1e5602e827999ccb6f4dbc
This commit is contained in:
Christine Franks
2019-05-08 15:08:21 -07:00
parent a8a18f6d32
commit b8d03a5427
3 changed files with 10 additions and 4 deletions

View File

@@ -1094,6 +1094,11 @@
-->
</integer-array>
<!-- Color mode to use when accessibility transforms are enabled. This color mode must be
supported by the device, but not necessarily appear in config_availableColorModes. The
regularly selected color mode will be used if this value is negative. -->
<integer name="config_accessibilityColorMode">-1</integer>
<!-- Indicate whether to allow the device to suspend when the screen is off
due to the proximity sensor. This resource should only be set to true
if the sensor HAL correctly handles the proximity sensor as a wake-up source.

View File

@@ -3185,6 +3185,7 @@
<java-symbol type="array" name="config_nightDisplayColorTemperatureCoefficients" />
<java-symbol type="array" name="config_nightDisplayColorTemperatureCoefficientsNative" />
<java-symbol type="array" name="config_availableColorModes" />
<java-symbol type="integer" name="config_accessibilityColorMode" />
<java-symbol type="bool" name="config_displayWhiteBalanceAvailable" />
<java-symbol type="bool" name="config_displayWhiteBalanceEnabledDefault" />
<java-symbol type="integer" name="config_displayWhiteBalanceColorTemperatureMin" />

View File

@@ -775,10 +775,10 @@ public final class ColorDisplayService extends SystemService {
final ContentResolver cr = getContext().getContentResolver();
if (isAccessibilityEnabled()) {
// There are restrictions on the available color modes combined with a11y transforms.
if (isColorModeAvailable(COLOR_MODE_SATURATED)) {
return COLOR_MODE_SATURATED;
} else if (isColorModeAvailable(COLOR_MODE_AUTOMATIC)) {
return COLOR_MODE_AUTOMATIC;
final int a11yColorMode = getContext().getResources().getInteger(
R.integer.config_accessibilityColorMode);
if (a11yColorMode >= 0) {
return a11yColorMode;
}
}