summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Hong <rurumihong@google.com>2022-03-14 14:58:06 +0800
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-03-15 08:00:41 +0000
commit7dd392a1970e9a4426dd5ae6d7f4ccd28f8768fa (patch)
tree10f2020288b5efcc9782dac293fe97cf9a3ab6e2
parent76d7c5af40fee6ef527467dff81d02cf8689a60c (diff)
downloadbase-7dd392a1970e9a4426dd5ae6d7f4ccd28f8768fa.tar.gz
Revert "Revert "[RESTRICT AUTOMERGE]DisplayManager: Make sure RampAnimator sets property in linear space.""
This reverts commit 26f62282acff2bce70b54404233fd0f2654ec3e2. Revert reason: Check if this causes AOC regression Bug: 223124178 Change-Id: I4861b3ed5e3bc234ee51c58e95e7a517ce5cbacc (cherry picked from commit c96d601823b85e07eb0016163e7c9d300db66a59) Merged-In: I4861b3ed5e3bc234ee51c58e95e7a517ce5cbacc
-rw-r--r--services/core/java/com/android/server/display/RampAnimator.java15
1 files changed, 11 insertions, 4 deletions
diff --git a/services/core/java/com/android/server/display/RampAnimator.java b/services/core/java/com/android/server/display/RampAnimator.java
index 1ebd1f5a535c..d8672fc07619 100644
--- a/services/core/java/com/android/server/display/RampAnimator.java
+++ b/services/core/java/com/android/server/display/RampAnimator.java
@@ -70,7 +70,7 @@ class RampAnimator<T> {
mRate = 0;
mTargetValue = target;
mCurrentValue = target;
- mProperty.setValue(mObject, target);
+ setPropertyValue(target);
if (mAnimating) {
mAnimating = false;
cancelAnimationCallback();
@@ -125,6 +125,15 @@ class RampAnimator<T> {
mListener = listener;
}
+ /**
+ * Sets the brightness property by converting the given value from HLG space
+ * into linear space.
+ */
+ private void setPropertyValue(float val) {
+ final float linearVal = BrightnessUtils.convertGammaToLinear(val);
+ mProperty.setValue(mObject, linearVal);
+ }
+
private void postAnimationCallback() {
mChoreographer.postCallback(Choreographer.CALLBACK_ANIMATION, mAnimationCallback, null);
}
@@ -160,9 +169,7 @@ class RampAnimator<T> {
final float oldCurrentValue = mCurrentValue;
mCurrentValue = mAnimatedValue;
if (oldCurrentValue != mCurrentValue) {
- // Convert value from HLG into linear space for the property.
- final float linearCurrentVal = BrightnessUtils.convertGammaToLinear(mCurrentValue);
- mProperty.setValue(mObject, linearCurrentVal);
+ setPropertyValue(mCurrentValue);
}
if (mTargetValue != mCurrentValue) {
postAnimationCallback();