Merge "Log display white balance intermediate data" into qt-qpr1-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
c854ee68d0
@@ -609,6 +609,9 @@ public final class ColorDisplayService extends SystemService {
|
||||
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animator) {
|
||||
Slog.d(TAG, tintController.getClass().getSimpleName()
|
||||
+ " Animation cancelled: " + mIsCancelled
|
||||
+ " to matrix: " + TintController.matrixToString(to, 16));
|
||||
if (!mIsCancelled) {
|
||||
// Ensure final color matrix is set at the end of the animation. If the
|
||||
// animation is cancelled then don't set the final color matrix so the new
|
||||
@@ -1314,8 +1317,10 @@ public final class ColorDisplayService extends SystemService {
|
||||
* Reset the CCT value for the display white balance transform to its default value.
|
||||
*/
|
||||
public boolean resetDisplayWhiteBalanceColorTemperature() {
|
||||
return setDisplayWhiteBalanceColorTemperature(getContext().getResources()
|
||||
.getInteger(R.integer.config_displayWhiteBalanceColorTemperatureDefault));
|
||||
int temperatureDefault = getContext().getResources()
|
||||
.getInteger(R.integer.config_displayWhiteBalanceColorTemperatureDefault);
|
||||
Slog.d(TAG, "resetDisplayWhiteBalanceColorTemperature: " + temperatureDefault);
|
||||
return setDisplayWhiteBalanceColorTemperature(temperatureDefault);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -149,8 +149,6 @@ final class DisplayWhiteBalanceTintController extends TintController {
|
||||
cct = mTemperatureMax;
|
||||
}
|
||||
|
||||
Slog.d(ColorDisplayService.TAG, "setDisplayWhiteBalanceTemperatureMatrix: cct = " + cct);
|
||||
|
||||
synchronized (mLock) {
|
||||
mCurrentColorTemperature = cct;
|
||||
|
||||
@@ -185,6 +183,9 @@ final class DisplayWhiteBalanceTintController extends TintController {
|
||||
java.lang.System.arraycopy(result, 3, mMatrixDisplayWhiteBalance, 4, 3);
|
||||
java.lang.System.arraycopy(result, 6, mMatrixDisplayWhiteBalance, 8, 3);
|
||||
}
|
||||
|
||||
Slog.d(ColorDisplayService.TAG, "setDisplayWhiteBalanceTemperatureMatrix: cct = " + cct
|
||||
+ " matrix = " + matrixToString(mMatrixDisplayWhiteBalance, 16));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -225,28 +226,6 @@ final class DisplayWhiteBalanceTintController extends TintController {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Format a given matrix into a string.
|
||||
*
|
||||
* @param matrix the matrix to format
|
||||
* @param columns number of columns in the matrix
|
||||
*/
|
||||
private String matrixToString(float[] matrix, int columns) {
|
||||
if (matrix == null || columns <= 0) {
|
||||
Slog.e(ColorDisplayService.TAG, "Invalid arguments when formatting matrix to string");
|
||||
return "";
|
||||
}
|
||||
|
||||
final StringBuilder sb = new StringBuilder("");
|
||||
for (int i = 0; i < matrix.length; i++) {
|
||||
if (i % columns == 0) {
|
||||
sb.append("\n ");
|
||||
}
|
||||
sb.append(String.format("%9.6f", matrix[i]));
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private ColorSpace.Rgb makeRgbColorSpaceFromXYZ(float[] redGreenBlueXYZ, float[] whiteXYZ) {
|
||||
return new ColorSpace.Rgb(
|
||||
"Display Color Space",
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.android.server.display.color;
|
||||
|
||||
import android.animation.ValueAnimator;
|
||||
import android.content.Context;
|
||||
import android.util.Slog;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
|
||||
@@ -95,4 +96,29 @@ abstract class TintController {
|
||||
* Returns whether or not this transform type is available on this device.
|
||||
*/
|
||||
public abstract boolean isAvailable(Context context);
|
||||
|
||||
/**
|
||||
* Format a given matrix into a string.
|
||||
*
|
||||
* @param matrix the matrix to format
|
||||
* @param columns number of columns in the matrix
|
||||
*/
|
||||
static String matrixToString(float[] matrix, int columns) {
|
||||
if (matrix == null || columns <= 0) {
|
||||
Slog.e(ColorDisplayService.TAG, "Invalid arguments when formatting matrix to string,"
|
||||
+ " matrix is null: " + (matrix == null)
|
||||
+ " columns: " + columns);
|
||||
return "";
|
||||
}
|
||||
|
||||
final StringBuilder sb = new StringBuilder("");
|
||||
for (int i = 0; i < matrix.length; i++) {
|
||||
if (i % columns == 0) {
|
||||
sb.append("\n ");
|
||||
}
|
||||
sb.append(String.format("%9.6f", matrix[i]));
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -95,6 +95,11 @@ public class DisplayWhiteBalanceController implements
|
||||
// A piecewise linear relationship between high light brightness and high light bias.
|
||||
private Spline.LinearSpline mHighLightAmbientBrightnessToBiasSpline;
|
||||
|
||||
private float mLatestAmbientColorTemperature;
|
||||
private float mLatestAmbientBrightness;
|
||||
private float mLatestLowLightBias;
|
||||
private float mLatestHighLightBias;
|
||||
|
||||
/**
|
||||
* @param brightnessSensor
|
||||
* The sensor used to detect changes in the ambient brightness.
|
||||
@@ -348,6 +353,7 @@ public class DisplayWhiteBalanceController implements
|
||||
public void updateAmbientColorTemperature() {
|
||||
final long time = System.currentTimeMillis();
|
||||
float ambientColorTemperature = mColorTemperatureFilter.getEstimate(time);
|
||||
mLatestAmbientColorTemperature = ambientColorTemperature;
|
||||
|
||||
if (mAmbientToDisplayColorTemperatureSpline != null && ambientColorTemperature != -1.0f) {
|
||||
ambientColorTemperature =
|
||||
@@ -355,6 +361,7 @@ public class DisplayWhiteBalanceController implements
|
||||
}
|
||||
|
||||
float ambientBrightness = mBrightnessFilter.getEstimate(time);
|
||||
mLatestAmbientBrightness = ambientBrightness;
|
||||
|
||||
if (ambientColorTemperature != -1.0f &&
|
||||
mLowLightAmbientBrightnessToBiasSpline != null) {
|
||||
@@ -362,6 +369,7 @@ public class DisplayWhiteBalanceController implements
|
||||
ambientColorTemperature =
|
||||
bias * ambientColorTemperature + (1.0f - bias)
|
||||
* mLowLightAmbientColorTemperature;
|
||||
mLatestLowLightBias = bias;
|
||||
}
|
||||
if (ambientColorTemperature != -1.0f &&
|
||||
mHighLightAmbientBrightnessToBiasSpline != null) {
|
||||
@@ -369,6 +377,7 @@ public class DisplayWhiteBalanceController implements
|
||||
ambientColorTemperature =
|
||||
(1.0f - bias) * ambientColorTemperature + bias
|
||||
* mHighLightAmbientColorTemperature;
|
||||
mLatestHighLightBias = bias;
|
||||
}
|
||||
|
||||
if (mAmbientColorTemperatureOverride != -1.0f) {
|
||||
@@ -426,6 +435,11 @@ public class DisplayWhiteBalanceController implements
|
||||
}
|
||||
mPendingAmbientColorTemperature = -1.0f;
|
||||
mAmbientColorTemperatureHistory.add(mAmbientColorTemperature);
|
||||
Slog.d(TAG, "Display cct: " + mAmbientColorTemperature
|
||||
+ " Latest ambient cct: " + mLatestAmbientColorTemperature
|
||||
+ " Latest ambient lux: " + mLatestAmbientBrightness
|
||||
+ " Latest low light bias: " + mLatestLowLightBias
|
||||
+ " Latest high light bias: " + mLatestHighLightBias);
|
||||
mColorDisplayServiceInternal.setDisplayWhiteBalanceColorTemperature(
|
||||
(int) mAmbientColorTemperature);
|
||||
mLastAmbientColorTemperature = mAmbientColorTemperature;
|
||||
|
||||
Reference in New Issue
Block a user