diff options
3 files changed, 25 insertions, 5 deletions
diff --git a/services/core/java/com/android/server/display/DisplayPowerController.java b/services/core/java/com/android/server/display/DisplayPowerController.java index 945365dcf8fe..01812b10783d 100644 --- a/services/core/java/com/android/server/display/DisplayPowerController.java +++ b/services/core/java/com/android/server/display/DisplayPowerController.java @@ -1641,6 +1641,7 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call (mBrightnessReasonTemp.getReason() == BrightnessReason.REASON_TEMPORARY) || mAutomaticBrightnessStrategy .isTemporaryAutoBrightnessAdjustmentApplied(); + float rampSpeed = 0; if (!mPendingScreenOff) { if (mSkipScreenOnBrightnessRamp) { if (state == Display.STATE_ON) { @@ -1742,7 +1743,6 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call customAnimationRate, /* ignoreAnimationLimits = */true); } else { boolean isIncreasing = animateValue > currentBrightness; - final float rampSpeed; final boolean idle = mAutomaticBrightnessController != null && mAutomaticBrightnessController.isInIdleMode(); if (isIncreasing && slowChange) { @@ -1827,6 +1827,8 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call .getDisplayBrightnessStrategyName()); mTempBrightnessEvent.setAutomaticBrightnessEnabled( displayBrightnessState.getShouldUseAutoBrightness()); + mTempBrightnessEvent.setSlowChange(slowChange); + mTempBrightnessEvent.setRampSpeed(rampSpeed); // Temporary is what we use during slider interactions. We avoid logging those so that // we don't spam logcat when the slider is being used. boolean tempToTempTransition = diff --git a/services/core/java/com/android/server/display/brightness/BrightnessEvent.java b/services/core/java/com/android/server/display/brightness/BrightnessEvent.java index 9e9b899ffa7d..159c30ddf77f 100644 --- a/services/core/java/com/android/server/display/brightness/BrightnessEvent.java +++ b/services/core/java/com/android/server/display/brightness/BrightnessEvent.java @@ -78,6 +78,8 @@ public final class BrightnessEvent { private String mDisplayBrightnessStrategyName; @AutomaticBrightnessController.AutomaticBrightnessMode private int mAutoBrightnessMode; + private boolean mSlowChange; + private float mRampSpeed; public BrightnessEvent(BrightnessEvent that) { copyFrom(that); @@ -126,6 +128,8 @@ public final class BrightnessEvent { mAutomaticBrightnessEnabled = that.isAutomaticBrightnessEnabled(); mDisplayBrightnessStrategyName = that.getDisplayBrightnessStrategyName(); mAutoBrightnessMode = that.mAutoBrightnessMode; + mSlowChange = that.mSlowChange; + mRampSpeed = that.mRampSpeed; } /** @@ -163,6 +167,8 @@ public final class BrightnessEvent { mAutomaticBrightnessEnabled = true; mDisplayBrightnessStrategyName = ""; mAutoBrightnessMode = AUTO_BRIGHTNESS_MODE_DEFAULT; + mSlowChange = false; + mRampSpeed = 0; } /** @@ -248,7 +254,9 @@ public final class BrightnessEvent { + ", powerFactor=" + mPowerFactor // Meta + ", physDisp=" + mPhysicalDisplayName + "(" + mPhysicalDisplayId + ")" - + ", logicalId=" + mDisplayId; + + ", logicalId=" + mDisplayId + + ", slowChange=" + mSlowChange + + ", rampSpeed=" + mRampSpeed; } @Override @@ -469,8 +477,8 @@ public final class BrightnessEvent { return mDisplayBrightnessStrategyName; } - public void setAutomaticBrightnessEnabled(boolean mAutomaticBrightnessEnabled) { - this.mAutomaticBrightnessEnabled = mAutomaticBrightnessEnabled; + public void setAutomaticBrightnessEnabled(boolean automaticBrightnessEnabled) { + mAutomaticBrightnessEnabled = automaticBrightnessEnabled; } @AutomaticBrightnessController.AutomaticBrightnessMode @@ -483,6 +491,14 @@ public final class BrightnessEvent { mAutoBrightnessMode = mode; } + public void setSlowChange(boolean slowChange) { + mSlowChange = slowChange; + } + + public void setRampSpeed(float rampSpeed) { + mRampSpeed = rampSpeed; + } + /** * A utility to stringify flags from a BrightnessEvent * @return Stringified flags from BrightnessEvent diff --git a/services/tests/displayservicetests/src/com/android/server/display/brightness/BrightnessEventTest.java b/services/tests/displayservicetests/src/com/android/server/display/brightness/BrightnessEventTest.java index df09b046ddd2..6d1e56d1f479 100644 --- a/services/tests/displayservicetests/src/com/android/server/display/brightness/BrightnessEventTest.java +++ b/services/tests/displayservicetests/src/com/android/server/display/brightness/BrightnessEventTest.java @@ -68,6 +68,8 @@ public final class BrightnessEventTest { mBrightnessEvent.setAutomaticBrightnessEnabled(true); mBrightnessEvent.setDisplayBrightnessStrategyName(DISPLAY_BRIGHTNESS_STRATEGY_NAME); mBrightnessEvent.setAutoBrightnessMode(AUTO_BRIGHTNESS_MODE_IDLE); + mBrightnessEvent.setSlowChange(true); + mBrightnessEvent.setRampSpeed(0.3f); } @Test @@ -88,7 +90,7 @@ public final class BrightnessEventTest { + "preLux=150.0, wasShortTermModelActive=true, autoBrightness=true (idle), " + "unclampedBrt=0.65, hbmMax=0.62, hbmMode=off, thrmMax=0.65, " + "rbcStrength=-1, powerFactor=0.2, physDisp=display_name(987654321), " - + "logicalId=1"; + + "logicalId=1, slowChange=true, rampSpeed=0.3"; assertEquals(expectedString, actualString); } |