Merge "Set min, max, and default RBC strength values" into sc-dev

This commit is contained in:
Sally Yuen
2021-03-30 18:22:16 +00:00
committed by Android (Google) Code Review
2 changed files with 9 additions and 5 deletions

View File

@@ -830,13 +830,13 @@
</string-array>
<!-- Default strength, in percentage, of bright color reduction when activated. -->
<integer name="config_reduceBrightColorsStrengthDefault">0</integer>
<integer name="config_reduceBrightColorsStrengthDefault">50</integer>
<!-- Minimum strength, in percentage, supported by bright color reduction. -->
<integer name="config_reduceBrightColorsStrengthMin">0</integer>
<integer name="config_reduceBrightColorsStrengthMin">25</integer>
<!-- Maximum strength, in percentage, supported by bright color reduction. -->
<integer name="config_reduceBrightColorsStrengthMax">100</integer>
<integer name="config_reduceBrightColorsStrengthMax">90</integer>
<!-- Boolean indicating whether display white balance is supported. -->
<bool name="config_displayWhiteBalanceAvailable">false</bool>

View File

@@ -630,8 +630,12 @@ public final class ColorDisplayService extends SystemService {
if (mCurrentUser == UserHandle.USER_NULL) {
return;
}
final int strength = Secure.getIntForUser(getContext().getContentResolver(),
Secure.REDUCE_BRIGHT_COLORS_LEVEL, 0, mCurrentUser);
int strength = Secure.getIntForUser(getContext().getContentResolver(),
Secure.REDUCE_BRIGHT_COLORS_LEVEL, NOT_SET, mCurrentUser);
if (strength == NOT_SET) {
strength = getContext().getResources().getInteger(
R.integer.config_reduceBrightColorsStrengthDefault);
}
mReduceBrightColorsTintController.setMatrix(strength);
if (mReduceBrightColorsListener != null) {
mReduceBrightColorsListener.onReduceBrightColorsStrengthChanged(strength);