Merge "Update night display intensity coefficients" into oc-mr1-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
0bb97d9e0b
@@ -882,6 +882,18 @@
|
||||
<!-- Maximum color temperature, in Kelvin, supported by Night display. -->
|
||||
<integer name="config_nightDisplayColorTemperatureMax">4082</integer>
|
||||
|
||||
<string-array name="config_nightDisplayColorTemperatureCoefficients">
|
||||
<!-- R a-coefficient --> <item>0.0</item>
|
||||
<!-- R b-coefficient --> <item>0.0</item>
|
||||
<!-- R y-intercept --> <item>1.0</item>
|
||||
<!-- G a-coefficient --> <item>-0.00000000962353339</item>
|
||||
<!-- G b-coefficient --> <item>0.000153045476</item>
|
||||
<!-- G y-intercept --> <item>0.390782778</item>
|
||||
<!-- B a-coefficient --> <item>-0.0000000189359041</item>
|
||||
<!-- B b-coefficient --> <item>0.000302412211</item>
|
||||
<!-- B y-intercept --> <item>-0.198650895</item>
|
||||
</string-array>
|
||||
|
||||
<!-- 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.
|
||||
|
||||
@@ -2813,6 +2813,7 @@
|
||||
<java-symbol type="integer" name="config_nightDisplayColorTemperatureDefault" />
|
||||
<java-symbol type="integer" name="config_nightDisplayColorTemperatureMin" />
|
||||
<java-symbol type="integer" name="config_nightDisplayColorTemperatureMax" />
|
||||
<java-symbol type="array" name="config_nightDisplayColorTemperatureCoefficients" />
|
||||
|
||||
<!-- Default first user restrictions -->
|
||||
<java-symbol type="array" name="config_defaultFirstUserRestrictions" />
|
||||
|
||||
@@ -52,6 +52,8 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.Calendar;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import com.android.internal.R;
|
||||
|
||||
import static com.android.server.display.DisplayTransformManager.LEVEL_COLOR_MATRIX_NIGHT_DISPLAY;
|
||||
|
||||
/**
|
||||
@@ -110,19 +112,7 @@ public final class NightDisplayService extends SystemService
|
||||
|
||||
private float[] mMatrixNight = new float[16];
|
||||
|
||||
/**
|
||||
* The 3x3 color transformation matrix is formatted like so:
|
||||
* <table>
|
||||
* <tr><td>R: a coefficient</td><td>G: a coefficient</td><td>B: a coefficient</td></tr>
|
||||
* <tr><td>R: b coefficient</td><td>G: b coefficient</td><td>B: b coefficient</td></tr>
|
||||
* <tr><td>R: y-intercept</td><td>G: y-intercept</td><td>B: y-intercept</td></tr>
|
||||
* </table>
|
||||
*/
|
||||
private static final float[] mColorTempCoefficients = new float[] {
|
||||
0.0f, -0.000000014365268757f, -0.000000000910931179f,
|
||||
0.0f, 0.000255092801250106f, 0.000207598323269139f,
|
||||
1.0f, -0.064156942434907716f, -0.349361641294833436f
|
||||
};
|
||||
private final float[] mColorTempCoefficients = new float[9];
|
||||
|
||||
private int mCurrentUser = UserHandle.USER_NULL;
|
||||
private ContentObserver mUserSetupObserver;
|
||||
@@ -136,6 +126,12 @@ public final class NightDisplayService extends SystemService
|
||||
public NightDisplayService(Context context) {
|
||||
super(context);
|
||||
mHandler = new Handler(Looper.getMainLooper());
|
||||
|
||||
final String[] coefficients = context.getResources().getStringArray(
|
||||
R.array.config_nightDisplayColorTemperatureCoefficients);
|
||||
for (int i = 0; i < 9 && i < coefficients.length; i++) {
|
||||
mColorTempCoefficients[i] = Float.parseFloat(coefficients[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -410,11 +406,11 @@ public final class NightDisplayService extends SystemService
|
||||
|
||||
final float squareTemperature = colorTemperature * colorTemperature;
|
||||
final float red = squareTemperature * mColorTempCoefficients[0]
|
||||
+ colorTemperature * mColorTempCoefficients[3] + mColorTempCoefficients[6];
|
||||
final float green = squareTemperature * mColorTempCoefficients[1]
|
||||
+ colorTemperature * mColorTempCoefficients[4] + mColorTempCoefficients[7];
|
||||
final float blue = squareTemperature * mColorTempCoefficients[2]
|
||||
+ colorTemperature * mColorTempCoefficients[5] + mColorTempCoefficients[8];
|
||||
+ colorTemperature * mColorTempCoefficients[1] + mColorTempCoefficients[2];
|
||||
final float green = squareTemperature * mColorTempCoefficients[3]
|
||||
+ colorTemperature * mColorTempCoefficients[4] + mColorTempCoefficients[5];
|
||||
final float blue = squareTemperature * mColorTempCoefficients[6]
|
||||
+ colorTemperature * mColorTempCoefficients[7] + mColorTempCoefficients[8];
|
||||
outTemp[0] = red;
|
||||
outTemp[5] = green;
|
||||
outTemp[10] = blue;
|
||||
|
||||
Reference in New Issue
Block a user