@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
* 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);
}
/**
cct = mTemperatureMax;
}
- Slog.d(ColorDisplayService.TAG, "setDisplayWhiteBalanceTemperatureMatrix: cct = " + cct);
-
synchronized (mLock) {
mCurrentColorTemperature = cct;
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
}
}
- /**
- * 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",
import android.animation.ValueAnimator;
import android.content.Context;
+import android.util.Slog;
import java.io.PrintWriter;
* 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();
+ }
+
}
// 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.
public void updateAmbientColorTemperature() {
final long time = System.currentTimeMillis();
float ambientColorTemperature = mColorTemperatureFilter.getEstimate(time);
+ mLatestAmbientColorTemperature = ambientColorTemperature;
if (mAmbientToDisplayColorTemperatureSpline != null && ambientColorTemperature != -1.0f) {
ambientColorTemperature =
}
float ambientBrightness = mBrightnessFilter.getEstimate(time);
+ mLatestAmbientBrightness = ambientBrightness;
if (ambientColorTemperature != -1.0f &&
mLowLightAmbientBrightnessToBiasSpline != null) {
ambientColorTemperature =
bias * ambientColorTemperature + (1.0f - bias)
* mLowLightAmbientColorTemperature;
+ mLatestLowLightBias = bias;
}
if (ambientColorTemperature != -1.0f &&
mHighLightAmbientBrightnessToBiasSpline != null) {
ambientColorTemperature =
(1.0f - bias) * ambientColorTemperature + bias
* mHighLightAmbientColorTemperature;
+ mLatestHighLightBias = bias;
}
if (mAmbientColorTemperatureOverride != -1.0f) {
}
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;