diff options
Diffstat (limited to 'services/core/java/com/android/server/display/DisplayPowerController.java')
-rw-r--r-- | services/core/java/com/android/server/display/DisplayPowerController.java | 47 |
1 files changed, 29 insertions, 18 deletions
diff --git a/services/core/java/com/android/server/display/DisplayPowerController.java b/services/core/java/com/android/server/display/DisplayPowerController.java index 99412c56b274..c75761ff6ece 100644 --- a/services/core/java/com/android/server/display/DisplayPowerController.java +++ b/services/core/java/com/android/server/display/DisplayPowerController.java @@ -16,16 +16,11 @@ package com.android.server.display; -import android.app.ActivityManager; -import com.android.internal.app.IBatteryStats; -import com.android.server.LocalServices; -import com.android.server.am.BatteryStatsService; -import com.android.server.policy.WindowManagerPolicy; - import android.animation.Animator; import android.animation.ObjectAnimator; import android.annotation.Nullable; import android.annotation.UserIdInt; +import android.app.ActivityManager; import android.content.Context; import android.content.pm.ParceledListSlice; import android.content.res.Resources; @@ -54,6 +49,11 @@ import android.util.Slog; import android.util.TimeUtils; import android.view.Display; +import com.android.internal.app.IBatteryStats; +import com.android.server.LocalServices; +import com.android.server.am.BatteryStatsService; +import com.android.server.policy.WindowManagerPolicy; + import java.io.PrintWriter; /** @@ -422,14 +422,25 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call com.android.internal.R.fraction.config_screenAutoBrightnessDozeScaleFactor, 1, 1); - int[] brightLevels = resources.getIntArray( - com.android.internal.R.array.config_dynamicHysteresisBrightLevels); - int[] darkLevels = resources.getIntArray( - com.android.internal.R.array.config_dynamicHysteresisDarkLevels); - int[] luxHysteresisLevels = resources.getIntArray( - com.android.internal.R.array.config_dynamicHysteresisLuxLevels); - HysteresisLevels hysteresisLevels = new HysteresisLevels( - brightLevels, darkLevels, luxHysteresisLevels); + int[] ambientBrighteningThresholds = resources.getIntArray( + com.android.internal.R.array.config_ambientBrighteningThresholds); + int[] ambientDarkeningThresholds = resources.getIntArray( + com.android.internal.R.array.config_ambientDarkeningThresholds); + int[] ambientThresholdLevels = resources.getIntArray( + com.android.internal.R.array.config_ambientThresholdLevels); + HysteresisLevels ambientBrightnessThresholds = new HysteresisLevels( + ambientBrighteningThresholds, ambientDarkeningThresholds, + ambientThresholdLevels); + + int[] screenBrighteningThresholds = resources.getIntArray( + com.android.internal.R.array.config_screenBrighteningThresholds); + int[] screenDarkeningThresholds = resources.getIntArray( + com.android.internal.R.array.config_screenDarkeningThresholds); + int[] screenThresholdLevels = resources.getIntArray( + com.android.internal.R.array.config_screenThresholdLevels); + HysteresisLevels screenBrightnessThresholds = new HysteresisLevels( + screenBrighteningThresholds, screenDarkeningThresholds, screenThresholdLevels); + long brighteningLightDebounce = resources.getInteger( com.android.internal.R.integer.config_autoBrightnessBrighteningLightDebounce); @@ -459,7 +470,8 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call lightSensorWarmUpTimeConfig, mScreenBrightnessRangeMinimum, mScreenBrightnessRangeMaximum, dozeScaleFactor, lightSensorRate, initialLightSensorRate, brighteningLightDebounce, darkeningLightDebounce, - autoBrightnessResetAmbientLuxAfterWarmUp, hysteresisLevels); + autoBrightnessResetAmbientLuxAfterWarmUp, ambientBrightnessThresholds, + screenBrightnessThresholds); } else { mUseSoftwareAutoBrightnessConfig = false; } @@ -791,9 +803,6 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call && mAutomaticBrightnessController != null; final boolean userSetBrightnessChanged = updateUserSetScreenBrightness(); - if (userSetBrightnessChanged) { - mTemporaryScreenBrightness = -1; - } // Use the temporary screen brightness if there isn't an override, either from // WindowManager or based on the display state. @@ -1514,11 +1523,13 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call } if (mCurrentScreenBrightnessSetting == mPendingScreenBrightnessSetting) { mPendingScreenBrightnessSetting = -1; + mTemporaryScreenBrightness = -1; return false; } mCurrentScreenBrightnessSetting = mPendingScreenBrightnessSetting; mLastUserSetScreenBrightness = mPendingScreenBrightnessSetting; mPendingScreenBrightnessSetting = -1; + mTemporaryScreenBrightness = -1; return true; } |