diff options
4 files changed, 29 insertions, 53 deletions
diff --git a/services/core/java/com/android/server/display/DisplayPowerController.java b/services/core/java/com/android/server/display/DisplayPowerController.java index 838bb53f0b86..d6f0fd070f94 100644 --- a/services/core/java/com/android/server/display/DisplayPowerController.java +++ b/services/core/java/com/android/server/display/DisplayPowerController.java @@ -1703,6 +1703,7 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call mTempBrightnessEvent.setRbcStrength(mCdsi != null ? mCdsi.getReduceBrightColorsStrength() : -1); mTempBrightnessEvent.setPowerFactor(mPowerRequest.screenLowPowerBrightnessFactor); + mTempBrightnessEvent.setWasShortTermModelActive(hadUserBrightnessPoint); // 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 = @@ -1713,12 +1714,6 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call || brightnessAdjustmentFlags != 0) { float lastBrightness = mLastBrightnessEvent.getBrightness(); mTempBrightnessEvent.setInitialBrightness(lastBrightness); - mTempBrightnessEvent.setFastAmbientLux( - mAutomaticBrightnessController == null - ? -1f : mAutomaticBrightnessController.getFastAmbientLux()); - mTempBrightnessEvent.setSlowAmbientLux( - mAutomaticBrightnessController == null - ? -1f : mAutomaticBrightnessController.getSlowAmbientLux()); mTempBrightnessEvent.setAutomaticBrightnessEnabled(mPowerRequest.useAutoBrightness); mLastBrightnessEvent.copyFrom(mTempBrightnessEvent); BrightnessEvent newEvent = new BrightnessEvent(mTempBrightnessEvent); @@ -2846,9 +2841,9 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call FrameworkStatsLog.write(FrameworkStatsLog.DISPLAY_BRIGHTNESS_CHANGED, convertToNits(event.getInitialBrightness()), convertToNits(event.getBrightness()), - event.getSlowAmbientLux(), + event.getLux(), event.getPhysicalDisplayId(), - event.isShortTermModelActive(), + event.wasShortTermModelActive(), appliedLowPowerMode, appliedRbcStrength, appliedHbmMaxNits, diff --git a/services/core/java/com/android/server/display/DisplayPowerController2.java b/services/core/java/com/android/server/display/DisplayPowerController2.java index a57d8026d612..300b5895ca98 100644 --- a/services/core/java/com/android/server/display/DisplayPowerController2.java +++ b/services/core/java/com/android/server/display/DisplayPowerController2.java @@ -1568,6 +1568,7 @@ final class DisplayPowerController2 implements AutomaticBrightnessController.Cal mTempBrightnessEvent.setRbcStrength(mCdsi != null ? mCdsi.getReduceBrightColorsStrength() : -1); mTempBrightnessEvent.setPowerFactor(mPowerRequest.screenLowPowerBrightnessFactor); + mTempBrightnessEvent.setWasShortTermModelActive(hadUserBrightnessPoint); // 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 = @@ -1578,12 +1579,6 @@ final class DisplayPowerController2 implements AutomaticBrightnessController.Cal || brightnessAdjustmentFlags != 0) { float lastBrightness = mLastBrightnessEvent.getBrightness(); mTempBrightnessEvent.setInitialBrightness(lastBrightness); - mTempBrightnessEvent.setFastAmbientLux( - mAutomaticBrightnessController == null - ? -1f : mAutomaticBrightnessController.getFastAmbientLux()); - mTempBrightnessEvent.setSlowAmbientLux( - mAutomaticBrightnessController == null - ? -1f : mAutomaticBrightnessController.getSlowAmbientLux()); mTempBrightnessEvent.setAutomaticBrightnessEnabled(mPowerRequest.useAutoBrightness); mLastBrightnessEvent.copyFrom(mTempBrightnessEvent); BrightnessEvent newEvent = new BrightnessEvent(mTempBrightnessEvent); @@ -2517,9 +2512,9 @@ final class DisplayPowerController2 implements AutomaticBrightnessController.Cal FrameworkStatsLog.write(FrameworkStatsLog.DISPLAY_BRIGHTNESS_CHANGED, convertToNits(event.getInitialBrightness()), convertToNits(event.getBrightness()), - event.getSlowAmbientLux(), + event.getLux(), event.getPhysicalDisplayId(), - event.isShortTermModelActive(), + event.wasShortTermModelActive(), appliedLowPowerMode, appliedRbcStrength, appliedHbmMaxNits, 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 e3fa6220edf4..f19852b3eff5 100644 --- a/services/core/java/com/android/server/display/brightness/BrightnessEvent.java +++ b/services/core/java/com/android/server/display/brightness/BrightnessEvent.java @@ -39,8 +39,6 @@ public final class BrightnessEvent { private String mPhysicalDisplayId; private long mTime; private float mLux; - private float mFastAmbientLux; - private float mSlowAmbientLux; private float mPreThresholdLux; private float mInitialBrightness; private float mBrightness; @@ -51,6 +49,7 @@ public final class BrightnessEvent { private int mRbcStrength; private float mThermalMax; private float mPowerFactor; + private boolean mWasShortTermModelActive; private int mFlags; private int mAdjustmentFlags; private boolean mAutomaticBrightnessEnabled; @@ -76,8 +75,6 @@ public final class BrightnessEvent { mTime = that.getTime(); // Lux values mLux = that.getLux(); - mFastAmbientLux = that.getFastAmbientLux(); - mSlowAmbientLux = that.getSlowAmbientLux(); mPreThresholdLux = that.getPreThresholdLux(); // Brightness values mInitialBrightness = that.getInitialBrightness(); @@ -90,6 +87,7 @@ public final class BrightnessEvent { mRbcStrength = that.getRbcStrength(); mThermalMax = that.getThermalMax(); mPowerFactor = that.getPowerFactor(); + mWasShortTermModelActive = that.wasShortTermModelActive(); mFlags = that.getFlags(); mAdjustmentFlags = that.getAdjustmentFlags(); // Auto-brightness setting @@ -105,8 +103,6 @@ public final class BrightnessEvent { mPhysicalDisplayId = ""; // Lux values mLux = 0; - mFastAmbientLux = 0; - mSlowAmbientLux = 0; mPreThresholdLux = 0; // Brightness values mInitialBrightness = PowerManager.BRIGHTNESS_INVALID_FLOAT; @@ -119,6 +115,7 @@ public final class BrightnessEvent { mRbcStrength = 0; mThermalMax = PowerManager.BRIGHTNESS_MAX; mPowerFactor = 1f; + mWasShortTermModelActive = false; mFlags = 0; mAdjustmentFlags = 0; // Auto-brightness setting @@ -140,10 +137,6 @@ public final class BrightnessEvent { && mDisplayId == that.mDisplayId && mPhysicalDisplayId.equals(that.mPhysicalDisplayId) && Float.floatToRawIntBits(mLux) == Float.floatToRawIntBits(that.mLux) - && Float.floatToRawIntBits(mFastAmbientLux) - == Float.floatToRawIntBits(that.mFastAmbientLux) - && Float.floatToRawIntBits(mSlowAmbientLux) - == Float.floatToRawIntBits(that.mSlowAmbientLux) && Float.floatToRawIntBits(mPreThresholdLux) == Float.floatToRawIntBits(that.mPreThresholdLux) && Float.floatToRawIntBits(mInitialBrightness) @@ -161,6 +154,7 @@ public final class BrightnessEvent { == Float.floatToRawIntBits(that.mThermalMax) && Float.floatToRawIntBits(mPowerFactor) == Float.floatToRawIntBits(that.mPowerFactor) + && mWasShortTermModelActive == that.mWasShortTermModelActive && mFlags == that.mFlags && mAdjustmentFlags == that.mAdjustmentFlags && mAutomaticBrightnessEnabled == that.mAutomaticBrightnessEnabled; @@ -182,14 +176,13 @@ public final class BrightnessEvent { + ", rcmdBrt=" + mRecommendedBrightness + ", preBrt=" + mPreThresholdBrightness + ", lux=" + mLux - + ", fastLux=" + mFastAmbientLux - + ", slowLux=" + mSlowAmbientLux + ", preLux=" + mPreThresholdLux + ", hbmMax=" + mHbmMax + ", hbmMode=" + BrightnessInfo.hbmToString(mHbmMode) + ", rbcStrength=" + mRbcStrength + ", thrmMax=" + mThermalMax + ", powerFactor=" + mPowerFactor + + ", wasShortTermModelActive=" + mWasShortTermModelActive + ", flags=" + flagsToString() + ", reason=" + mReason.toString(mAdjustmentFlags) + ", autoBrightness=" + mAutomaticBrightnessEnabled; @@ -240,22 +233,6 @@ public final class BrightnessEvent { this.mLux = lux; } - public float getFastAmbientLux() { - return mFastAmbientLux; - } - - public void setFastAmbientLux(float mFastAmbientLux) { - this.mFastAmbientLux = mFastAmbientLux; - } - - public float getSlowAmbientLux() { - return mSlowAmbientLux; - } - - public void setSlowAmbientLux(float mSlowAmbientLux) { - this.mSlowAmbientLux = mSlowAmbientLux; - } - public float getPreThresholdLux() { return mPreThresholdLux; } @@ -344,6 +321,20 @@ public final class BrightnessEvent { return (mFlags & FLAG_LOW_POWER_MODE) != 0; } + /** + * Set whether the short term model was active before the brightness event. + */ + public boolean setWasShortTermModelActive(boolean wasShortTermModelActive) { + return this.mWasShortTermModelActive = wasShortTermModelActive; + } + + /** + * Returns whether the short term model was active before the brightness event. + */ + public boolean wasShortTermModelActive() { + return this.mWasShortTermModelActive; + } + public int getFlags() { return mFlags; } @@ -352,10 +343,6 @@ public final class BrightnessEvent { this.mFlags = flags; } - public boolean isShortTermModelActive() { - return (mFlags & FLAG_USER_SET) != 0; - } - public int getAdjustmentFlags() { return mAdjustmentFlags; } diff --git a/services/tests/servicestests/src/com/android/server/display/brightness/BrightnessEventTest.java b/services/tests/servicestests/src/com/android/server/display/brightness/BrightnessEventTest.java index fabf535b729a..d332b3081fdf 100644 --- a/services/tests/servicestests/src/com/android/server/display/brightness/BrightnessEventTest.java +++ b/services/tests/servicestests/src/com/android/server/display/brightness/BrightnessEventTest.java @@ -39,8 +39,6 @@ public final class BrightnessEventTest { getReason(BrightnessReason.REASON_DOZE, BrightnessReason.MODIFIER_LOW_POWER)); mBrightnessEvent.setPhysicalDisplayId("test"); mBrightnessEvent.setLux(100.0f); - mBrightnessEvent.setFastAmbientLux(90.0f); - mBrightnessEvent.setSlowAmbientLux(85.0f); mBrightnessEvent.setPreThresholdLux(150.0f); mBrightnessEvent.setTime(System.currentTimeMillis()); mBrightnessEvent.setInitialBrightness(25.0f); @@ -50,6 +48,7 @@ public final class BrightnessEventTest { mBrightnessEvent.setRbcStrength(-1); mBrightnessEvent.setThermalMax(0.65f); mBrightnessEvent.setPowerFactor(0.2f); + mBrightnessEvent.setWasShortTermModelActive(true); mBrightnessEvent.setHbmMode(BrightnessInfo.HIGH_BRIGHTNESS_MODE_OFF); mBrightnessEvent.setFlags(0); mBrightnessEvent.setAdjustmentFlags(0); @@ -69,9 +68,9 @@ public final class BrightnessEventTest { String actualString = mBrightnessEvent.toString(false); String expectedString = "BrightnessEvent: disp=1, physDisp=test, brt=0.6, initBrt=25.0, rcmdBrt=0.6," - + " preBrt=NaN, lux=100.0, fastLux=90.0, slowLux=85.0, preLux=150.0, hbmMax=0.62," - + " hbmMode=off, rbcStrength=-1, thrmMax=0.65, powerFactor=0.2, flags=, reason=doze" - + " [ low_pwr ], autoBrightness=true"; + + " preBrt=NaN, lux=100.0, preLux=150.0, hbmMax=0.62, hbmMode=off, rbcStrength=-1," + + " thrmMax=0.65, powerFactor=0.2, wasShortTermModelActive=true, flags=," + + " reason=doze [ low_pwr ], autoBrightness=true"; assertEquals(expectedString, actualString); } |