Loading core/res/res/values/config.xml +7 −0 Original line number Original line Diff line number Diff line Loading @@ -801,6 +801,13 @@ that can be set by the user. --> that can be set by the user. --> <integer name="config_screenBrightnessDoze">1</integer> <integer name="config_screenBrightnessDoze">1</integer> <!-- Allow automatic adjusting of the screen brightness while dozing in low power state. --> <bool name="config_allowAutoBrightnessWhileDozing">false</bool> <!-- If we allow automatic adjustment of screen brightness while dozing, how many times we want to reduce it to preserve the battery. Value of 100% means no scaling. --> <fraction name="config_screenAutoBrightnessDozeScaleFactor">100%</fraction> <!-- Screen brightness used to dim the screen when the user activity <!-- Screen brightness used to dim the screen when the user activity timeout expires. May be less than the minimum allowed brightness setting timeout expires. May be less than the minimum allowed brightness setting that can be set by the user. --> that can be set by the user. --> Loading core/res/res/values/symbols.xml +2 −0 Original line number Original line Diff line number Diff line Loading @@ -1574,6 +1574,7 @@ <java-symbol type="bool" name="config_enableNetworkLocationOverlay" /> <java-symbol type="bool" name="config_enableNetworkLocationOverlay" /> <java-symbol type="bool" name="config_sf_limitedAlpha" /> <java-symbol type="bool" name="config_sf_limitedAlpha" /> <java-symbol type="bool" name="config_unplugTurnsOnScreen" /> <java-symbol type="bool" name="config_unplugTurnsOnScreen" /> <java-symbol type="bool" name="config_allowAutoBrightnessWhileDozing" /> <java-symbol type="bool" name="config_allowTheaterModeWakeFromUnplug" /> <java-symbol type="bool" name="config_allowTheaterModeWakeFromUnplug" /> <java-symbol type="bool" name="config_allowTheaterModeWakeFromGesture" /> <java-symbol type="bool" name="config_allowTheaterModeWakeFromGesture" /> <java-symbol type="bool" name="config_allowTheaterModeWakeFromCameraLens" /> <java-symbol type="bool" name="config_allowTheaterModeWakeFromCameraLens" /> Loading Loading @@ -1615,6 +1616,7 @@ <java-symbol type="id" name="replace_app_icon" /> <java-symbol type="id" name="replace_app_icon" /> <java-symbol type="id" name="replace_message" /> <java-symbol type="id" name="replace_message" /> <java-symbol type="fraction" name="config_dimBehindFadeDuration" /> <java-symbol type="fraction" name="config_dimBehindFadeDuration" /> <java-symbol type="fraction" name="config_screenAutoBrightnessDozeScaleFactor" /> <java-symbol type="integer" name="config_carDockKeepsScreenOn" /> <java-symbol type="integer" name="config_carDockKeepsScreenOn" /> <java-symbol type="integer" name="config_criticalBatteryWarningLevel" /> <java-symbol type="integer" name="config_criticalBatteryWarningLevel" /> <java-symbol type="integer" name="config_datause_notification_type" /> <java-symbol type="integer" name="config_datause_notification_type" /> Loading services/core/java/com/android/server/display/AutomaticBrightnessController.java +19 −5 Original line number Original line Diff line number Diff line Loading @@ -21,7 +21,6 @@ import com.android.server.twilight.TwilightListener; import com.android.server.twilight.TwilightManager; import com.android.server.twilight.TwilightManager; import com.android.server.twilight.TwilightState; import com.android.server.twilight.TwilightState; import android.content.res.Resources; import android.hardware.Sensor; import android.hardware.Sensor; import android.hardware.SensorEvent; import android.hardware.SensorEvent; import android.hardware.SensorEventListener; import android.hardware.SensorEventListener; Loading Loading @@ -120,6 +119,7 @@ class AutomaticBrightnessController { // The minimum and maximum screen brightnesses. // The minimum and maximum screen brightnesses. private final int mScreenBrightnessRangeMinimum; private final int mScreenBrightnessRangeMinimum; private final int mScreenBrightnessRangeMaximum; private final int mScreenBrightnessRangeMaximum; private final float mDozeScaleFactor; // Amount of time to delay auto-brightness after screen on while waiting for // Amount of time to delay auto-brightness after screen on while waiting for // the light sensor to warm-up in milliseconds. // the light sensor to warm-up in milliseconds. Loading Loading @@ -171,9 +171,12 @@ class AutomaticBrightnessController { // The last screen auto-brightness gamma. (For printing in dump() only.) // The last screen auto-brightness gamma. (For printing in dump() only.) private float mLastScreenAutoBrightnessGamma = 1.0f; private float mLastScreenAutoBrightnessGamma = 1.0f; // Are we going to adjust brightness while dozing. private boolean mDozing; public AutomaticBrightnessController(Callbacks callbacks, Looper looper, public AutomaticBrightnessController(Callbacks callbacks, Looper looper, SensorManager sensorManager, Spline autoBrightnessSpline, SensorManager sensorManager, Spline autoBrightnessSpline, int lightSensorWarmUpTime, int lightSensorWarmUpTime, int brightnessMin, int brightnessMax) { int brightnessMin, int brightnessMax, float dozeScaleFactor) { mCallbacks = callbacks; mCallbacks = callbacks; mTwilight = LocalServices.getService(TwilightManager.class); mTwilight = LocalServices.getService(TwilightManager.class); mSensorManager = sensorManager; mSensorManager = sensorManager; Loading @@ -181,6 +184,7 @@ class AutomaticBrightnessController { mScreenBrightnessRangeMinimum = brightnessMin; mScreenBrightnessRangeMinimum = brightnessMin; mScreenBrightnessRangeMaximum = brightnessMax; mScreenBrightnessRangeMaximum = brightnessMax; mLightSensorWarmUpTimeConfig = lightSensorWarmUpTime; mLightSensorWarmUpTimeConfig = lightSensorWarmUpTime; mDozeScaleFactor = dozeScaleFactor; mHandler = new AutomaticBrightnessHandler(looper); mHandler = new AutomaticBrightnessHandler(looper); mAmbientLightRingBuffer = new AmbientLightRingBuffer(); mAmbientLightRingBuffer = new AmbientLightRingBuffer(); Loading @@ -195,11 +199,20 @@ class AutomaticBrightnessController { } } public int getAutomaticScreenBrightness() { public int getAutomaticScreenBrightness() { if (mDozing) { return (int) (mScreenAutoBrightness * mDozeScaleFactor); } return mScreenAutoBrightness; return mScreenAutoBrightness; } } public void configure(boolean enable, float adjustment) { public void configure(boolean enable, float adjustment, boolean dozing) { boolean changed = setLightSensorEnabled(enable); // While dozing, the application processor may be suspended which will prevent us from // receiving new information from the light sensor. On some devices, we may be able to // switch to a wake-up light sensor instead but for now we will simply disable the sensor // and hold onto the last computed screen auto brightness. We save the dozing flag for // debugging purposes. mDozing = dozing; boolean changed = setLightSensorEnabled(enable && !dozing); changed |= setScreenAutoBrightnessAdjustment(adjustment); changed |= setScreenAutoBrightnessAdjustment(adjustment); if (changed) { if (changed) { updateAutoBrightness(false /*sendUpdate*/); updateAutoBrightness(false /*sendUpdate*/); Loading Loading @@ -230,6 +243,7 @@ class AutomaticBrightnessController { pw.println(" mScreenAutoBrightness=" + mScreenAutoBrightness); pw.println(" mScreenAutoBrightness=" + mScreenAutoBrightness); pw.println(" mScreenAutoBrightnessAdjustment=" + mScreenAutoBrightnessAdjustment); pw.println(" mScreenAutoBrightnessAdjustment=" + mScreenAutoBrightnessAdjustment); pw.println(" mLastScreenAutoBrightnessGamma=" + mLastScreenAutoBrightnessGamma); pw.println(" mLastScreenAutoBrightnessGamma=" + mLastScreenAutoBrightnessGamma); pw.println(" mDozing=" + mDozing); } } private boolean setLightSensorEnabled(boolean enable) { private boolean setLightSensorEnabled(boolean enable) { Loading services/core/java/com/android/server/display/DisplayPowerController.java +27 −10 Original line number Original line Diff line number Diff line Loading @@ -155,6 +155,9 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call // True if auto-brightness should be used. // True if auto-brightness should be used. private boolean mUseSoftwareAutoBrightnessConfig; private boolean mUseSoftwareAutoBrightnessConfig; // True if should use light sensor to automatically determine doze screen brightness. private final boolean mAllowAutoBrightnessWhileDozingConfig; // True if we should fade the screen while turning it off, false if we should play // True if we should fade the screen while turning it off, false if we should play // a stylish color fade animation instead. // a stylish color fade animation instead. private boolean mColorFadeFadesConfig; private boolean mColorFadeFadesConfig; Loading Loading @@ -295,6 +298,10 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call mUseSoftwareAutoBrightnessConfig = resources.getBoolean( mUseSoftwareAutoBrightnessConfig = resources.getBoolean( com.android.internal.R.bool.config_automatic_brightness_available); com.android.internal.R.bool.config_automatic_brightness_available); mAllowAutoBrightnessWhileDozingConfig = resources.getBoolean( com.android.internal.R.bool.config_allowAutoBrightnessWhileDozing); if (mUseSoftwareAutoBrightnessConfig) { if (mUseSoftwareAutoBrightnessConfig) { int[] lux = resources.getIntArray( int[] lux = resources.getIntArray( com.android.internal.R.array.config_autoBrightnessLevels); com.android.internal.R.array.config_autoBrightnessLevels); Loading @@ -302,6 +309,9 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call com.android.internal.R.array.config_autoBrightnessLcdBacklightValues); com.android.internal.R.array.config_autoBrightnessLcdBacklightValues); int lightSensorWarmUpTimeConfig = resources.getInteger( int lightSensorWarmUpTimeConfig = resources.getInteger( com.android.internal.R.integer.config_lightSensorWarmupTime); com.android.internal.R.integer.config_lightSensorWarmupTime); final float dozeScaleFactor = resources.getFraction( com.android.internal.R.fraction.config_screenAutoBrightnessDozeScaleFactor, 1, 1); Spline screenAutoBrightnessSpline = createAutoBrightnessSpline(lux, screenBrightness); Spline screenAutoBrightnessSpline = createAutoBrightnessSpline(lux, screenBrightness); if (screenAutoBrightnessSpline == null) { if (screenAutoBrightnessSpline == null) { Loading @@ -326,7 +336,7 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call mAutomaticBrightnessController = new AutomaticBrightnessController(this, mAutomaticBrightnessController = new AutomaticBrightnessController(this, handler.getLooper(), sensorManager, screenAutoBrightnessSpline, handler.getLooper(), sensorManager, screenAutoBrightnessSpline, lightSensorWarmUpTimeConfig, screenBrightnessRangeMinimum, lightSensorWarmUpTimeConfig, screenBrightnessRangeMinimum, mScreenBrightnessRangeMaximum); mScreenBrightnessRangeMaximum, dozeScaleFactor); } } } } Loading Loading @@ -523,7 +533,9 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call } else { } else { state = Display.STATE_DOZE; state = Display.STATE_DOZE; } } if (!mAllowAutoBrightnessWhileDozingConfig) { brightness = mPowerRequest.dozeScreenBrightness; brightness = mPowerRequest.dozeScreenBrightness; } break; break; case DisplayPowerRequest.POLICY_DIM: case DisplayPowerRequest.POLICY_DIM: case DisplayPowerRequest.POLICY_BRIGHT: case DisplayPowerRequest.POLICY_BRIGHT: Loading Loading @@ -577,19 +589,16 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call brightness = PowerManager.BRIGHTNESS_ON; brightness = PowerManager.BRIGHTNESS_ON; } } // Use default brightness when dozing unless overridden. if (brightness < 0 && (state == Display.STATE_DOZE || state == Display.STATE_DOZE_SUSPEND)) { brightness = mScreenBrightnessDozeConfig; } // Configure auto-brightness. // Configure auto-brightness. boolean autoBrightnessEnabled = false; boolean autoBrightnessEnabled = false; if (mAutomaticBrightnessController != null) { if (mAutomaticBrightnessController != null) { final boolean autoBrightnessEnabledInDoze = mAllowAutoBrightnessWhileDozingConfig && (state == Display.STATE_DOZE || state == Display.STATE_DOZE_SUSPEND); autoBrightnessEnabled = mPowerRequest.useAutoBrightness autoBrightnessEnabled = mPowerRequest.useAutoBrightness && state == Display.STATE_ON && brightness < 0; && (state == Display.STATE_ON || autoBrightnessEnabledInDoze) && brightness < 0; mAutomaticBrightnessController.configure(autoBrightnessEnabled, mAutomaticBrightnessController.configure(autoBrightnessEnabled, mPowerRequest.screenAutoBrightnessAdjustment); mPowerRequest.screenAutoBrightnessAdjustment, state != Display.STATE_ON); } } // Apply auto-brightness. // Apply auto-brightness. Loading @@ -612,6 +621,12 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call mAppliedAutoBrightness = false; mAppliedAutoBrightness = false; } } // Use default brightness when dozing unless overridden. if (brightness < 0 && (state == Display.STATE_DOZE || state == Display.STATE_DOZE_SUSPEND)) { brightness = mScreenBrightnessDozeConfig; } // Apply manual brightness. // Apply manual brightness. // Use the current brightness setting from the request, which is expected // Use the current brightness setting from the request, which is expected // provide a nominal default value for the case where auto-brightness // provide a nominal default value for the case where auto-brightness Loading Loading @@ -1024,6 +1039,8 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call pw.println(" mScreenBrightnessRangeMinimum=" + mScreenBrightnessRangeMinimum); pw.println(" mScreenBrightnessRangeMinimum=" + mScreenBrightnessRangeMinimum); pw.println(" mScreenBrightnessRangeMaximum=" + mScreenBrightnessRangeMaximum); pw.println(" mScreenBrightnessRangeMaximum=" + mScreenBrightnessRangeMaximum); pw.println(" mUseSoftwareAutoBrightnessConfig=" + mUseSoftwareAutoBrightnessConfig); pw.println(" mUseSoftwareAutoBrightnessConfig=" + mUseSoftwareAutoBrightnessConfig); pw.println(" mAllowAutoBrightnessWhileDozingConfig=" + mAllowAutoBrightnessWhileDozingConfig); pw.println(" mColorFadeFadesConfig=" + mColorFadeFadesConfig); pw.println(" mColorFadeFadesConfig=" + mColorFadeFadesConfig); mHandler.runWithScissors(new Runnable() { mHandler.runWithScissors(new Runnable() { Loading Loading
core/res/res/values/config.xml +7 −0 Original line number Original line Diff line number Diff line Loading @@ -801,6 +801,13 @@ that can be set by the user. --> that can be set by the user. --> <integer name="config_screenBrightnessDoze">1</integer> <integer name="config_screenBrightnessDoze">1</integer> <!-- Allow automatic adjusting of the screen brightness while dozing in low power state. --> <bool name="config_allowAutoBrightnessWhileDozing">false</bool> <!-- If we allow automatic adjustment of screen brightness while dozing, how many times we want to reduce it to preserve the battery. Value of 100% means no scaling. --> <fraction name="config_screenAutoBrightnessDozeScaleFactor">100%</fraction> <!-- Screen brightness used to dim the screen when the user activity <!-- Screen brightness used to dim the screen when the user activity timeout expires. May be less than the minimum allowed brightness setting timeout expires. May be less than the minimum allowed brightness setting that can be set by the user. --> that can be set by the user. --> Loading
core/res/res/values/symbols.xml +2 −0 Original line number Original line Diff line number Diff line Loading @@ -1574,6 +1574,7 @@ <java-symbol type="bool" name="config_enableNetworkLocationOverlay" /> <java-symbol type="bool" name="config_enableNetworkLocationOverlay" /> <java-symbol type="bool" name="config_sf_limitedAlpha" /> <java-symbol type="bool" name="config_sf_limitedAlpha" /> <java-symbol type="bool" name="config_unplugTurnsOnScreen" /> <java-symbol type="bool" name="config_unplugTurnsOnScreen" /> <java-symbol type="bool" name="config_allowAutoBrightnessWhileDozing" /> <java-symbol type="bool" name="config_allowTheaterModeWakeFromUnplug" /> <java-symbol type="bool" name="config_allowTheaterModeWakeFromUnplug" /> <java-symbol type="bool" name="config_allowTheaterModeWakeFromGesture" /> <java-symbol type="bool" name="config_allowTheaterModeWakeFromGesture" /> <java-symbol type="bool" name="config_allowTheaterModeWakeFromCameraLens" /> <java-symbol type="bool" name="config_allowTheaterModeWakeFromCameraLens" /> Loading Loading @@ -1615,6 +1616,7 @@ <java-symbol type="id" name="replace_app_icon" /> <java-symbol type="id" name="replace_app_icon" /> <java-symbol type="id" name="replace_message" /> <java-symbol type="id" name="replace_message" /> <java-symbol type="fraction" name="config_dimBehindFadeDuration" /> <java-symbol type="fraction" name="config_dimBehindFadeDuration" /> <java-symbol type="fraction" name="config_screenAutoBrightnessDozeScaleFactor" /> <java-symbol type="integer" name="config_carDockKeepsScreenOn" /> <java-symbol type="integer" name="config_carDockKeepsScreenOn" /> <java-symbol type="integer" name="config_criticalBatteryWarningLevel" /> <java-symbol type="integer" name="config_criticalBatteryWarningLevel" /> <java-symbol type="integer" name="config_datause_notification_type" /> <java-symbol type="integer" name="config_datause_notification_type" /> Loading
services/core/java/com/android/server/display/AutomaticBrightnessController.java +19 −5 Original line number Original line Diff line number Diff line Loading @@ -21,7 +21,6 @@ import com.android.server.twilight.TwilightListener; import com.android.server.twilight.TwilightManager; import com.android.server.twilight.TwilightManager; import com.android.server.twilight.TwilightState; import com.android.server.twilight.TwilightState; import android.content.res.Resources; import android.hardware.Sensor; import android.hardware.Sensor; import android.hardware.SensorEvent; import android.hardware.SensorEvent; import android.hardware.SensorEventListener; import android.hardware.SensorEventListener; Loading Loading @@ -120,6 +119,7 @@ class AutomaticBrightnessController { // The minimum and maximum screen brightnesses. // The minimum and maximum screen brightnesses. private final int mScreenBrightnessRangeMinimum; private final int mScreenBrightnessRangeMinimum; private final int mScreenBrightnessRangeMaximum; private final int mScreenBrightnessRangeMaximum; private final float mDozeScaleFactor; // Amount of time to delay auto-brightness after screen on while waiting for // Amount of time to delay auto-brightness after screen on while waiting for // the light sensor to warm-up in milliseconds. // the light sensor to warm-up in milliseconds. Loading Loading @@ -171,9 +171,12 @@ class AutomaticBrightnessController { // The last screen auto-brightness gamma. (For printing in dump() only.) // The last screen auto-brightness gamma. (For printing in dump() only.) private float mLastScreenAutoBrightnessGamma = 1.0f; private float mLastScreenAutoBrightnessGamma = 1.0f; // Are we going to adjust brightness while dozing. private boolean mDozing; public AutomaticBrightnessController(Callbacks callbacks, Looper looper, public AutomaticBrightnessController(Callbacks callbacks, Looper looper, SensorManager sensorManager, Spline autoBrightnessSpline, SensorManager sensorManager, Spline autoBrightnessSpline, int lightSensorWarmUpTime, int lightSensorWarmUpTime, int brightnessMin, int brightnessMax) { int brightnessMin, int brightnessMax, float dozeScaleFactor) { mCallbacks = callbacks; mCallbacks = callbacks; mTwilight = LocalServices.getService(TwilightManager.class); mTwilight = LocalServices.getService(TwilightManager.class); mSensorManager = sensorManager; mSensorManager = sensorManager; Loading @@ -181,6 +184,7 @@ class AutomaticBrightnessController { mScreenBrightnessRangeMinimum = brightnessMin; mScreenBrightnessRangeMinimum = brightnessMin; mScreenBrightnessRangeMaximum = brightnessMax; mScreenBrightnessRangeMaximum = brightnessMax; mLightSensorWarmUpTimeConfig = lightSensorWarmUpTime; mLightSensorWarmUpTimeConfig = lightSensorWarmUpTime; mDozeScaleFactor = dozeScaleFactor; mHandler = new AutomaticBrightnessHandler(looper); mHandler = new AutomaticBrightnessHandler(looper); mAmbientLightRingBuffer = new AmbientLightRingBuffer(); mAmbientLightRingBuffer = new AmbientLightRingBuffer(); Loading @@ -195,11 +199,20 @@ class AutomaticBrightnessController { } } public int getAutomaticScreenBrightness() { public int getAutomaticScreenBrightness() { if (mDozing) { return (int) (mScreenAutoBrightness * mDozeScaleFactor); } return mScreenAutoBrightness; return mScreenAutoBrightness; } } public void configure(boolean enable, float adjustment) { public void configure(boolean enable, float adjustment, boolean dozing) { boolean changed = setLightSensorEnabled(enable); // While dozing, the application processor may be suspended which will prevent us from // receiving new information from the light sensor. On some devices, we may be able to // switch to a wake-up light sensor instead but for now we will simply disable the sensor // and hold onto the last computed screen auto brightness. We save the dozing flag for // debugging purposes. mDozing = dozing; boolean changed = setLightSensorEnabled(enable && !dozing); changed |= setScreenAutoBrightnessAdjustment(adjustment); changed |= setScreenAutoBrightnessAdjustment(adjustment); if (changed) { if (changed) { updateAutoBrightness(false /*sendUpdate*/); updateAutoBrightness(false /*sendUpdate*/); Loading Loading @@ -230,6 +243,7 @@ class AutomaticBrightnessController { pw.println(" mScreenAutoBrightness=" + mScreenAutoBrightness); pw.println(" mScreenAutoBrightness=" + mScreenAutoBrightness); pw.println(" mScreenAutoBrightnessAdjustment=" + mScreenAutoBrightnessAdjustment); pw.println(" mScreenAutoBrightnessAdjustment=" + mScreenAutoBrightnessAdjustment); pw.println(" mLastScreenAutoBrightnessGamma=" + mLastScreenAutoBrightnessGamma); pw.println(" mLastScreenAutoBrightnessGamma=" + mLastScreenAutoBrightnessGamma); pw.println(" mDozing=" + mDozing); } } private boolean setLightSensorEnabled(boolean enable) { private boolean setLightSensorEnabled(boolean enable) { Loading
services/core/java/com/android/server/display/DisplayPowerController.java +27 −10 Original line number Original line Diff line number Diff line Loading @@ -155,6 +155,9 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call // True if auto-brightness should be used. // True if auto-brightness should be used. private boolean mUseSoftwareAutoBrightnessConfig; private boolean mUseSoftwareAutoBrightnessConfig; // True if should use light sensor to automatically determine doze screen brightness. private final boolean mAllowAutoBrightnessWhileDozingConfig; // True if we should fade the screen while turning it off, false if we should play // True if we should fade the screen while turning it off, false if we should play // a stylish color fade animation instead. // a stylish color fade animation instead. private boolean mColorFadeFadesConfig; private boolean mColorFadeFadesConfig; Loading Loading @@ -295,6 +298,10 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call mUseSoftwareAutoBrightnessConfig = resources.getBoolean( mUseSoftwareAutoBrightnessConfig = resources.getBoolean( com.android.internal.R.bool.config_automatic_brightness_available); com.android.internal.R.bool.config_automatic_brightness_available); mAllowAutoBrightnessWhileDozingConfig = resources.getBoolean( com.android.internal.R.bool.config_allowAutoBrightnessWhileDozing); if (mUseSoftwareAutoBrightnessConfig) { if (mUseSoftwareAutoBrightnessConfig) { int[] lux = resources.getIntArray( int[] lux = resources.getIntArray( com.android.internal.R.array.config_autoBrightnessLevels); com.android.internal.R.array.config_autoBrightnessLevels); Loading @@ -302,6 +309,9 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call com.android.internal.R.array.config_autoBrightnessLcdBacklightValues); com.android.internal.R.array.config_autoBrightnessLcdBacklightValues); int lightSensorWarmUpTimeConfig = resources.getInteger( int lightSensorWarmUpTimeConfig = resources.getInteger( com.android.internal.R.integer.config_lightSensorWarmupTime); com.android.internal.R.integer.config_lightSensorWarmupTime); final float dozeScaleFactor = resources.getFraction( com.android.internal.R.fraction.config_screenAutoBrightnessDozeScaleFactor, 1, 1); Spline screenAutoBrightnessSpline = createAutoBrightnessSpline(lux, screenBrightness); Spline screenAutoBrightnessSpline = createAutoBrightnessSpline(lux, screenBrightness); if (screenAutoBrightnessSpline == null) { if (screenAutoBrightnessSpline == null) { Loading @@ -326,7 +336,7 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call mAutomaticBrightnessController = new AutomaticBrightnessController(this, mAutomaticBrightnessController = new AutomaticBrightnessController(this, handler.getLooper(), sensorManager, screenAutoBrightnessSpline, handler.getLooper(), sensorManager, screenAutoBrightnessSpline, lightSensorWarmUpTimeConfig, screenBrightnessRangeMinimum, lightSensorWarmUpTimeConfig, screenBrightnessRangeMinimum, mScreenBrightnessRangeMaximum); mScreenBrightnessRangeMaximum, dozeScaleFactor); } } } } Loading Loading @@ -523,7 +533,9 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call } else { } else { state = Display.STATE_DOZE; state = Display.STATE_DOZE; } } if (!mAllowAutoBrightnessWhileDozingConfig) { brightness = mPowerRequest.dozeScreenBrightness; brightness = mPowerRequest.dozeScreenBrightness; } break; break; case DisplayPowerRequest.POLICY_DIM: case DisplayPowerRequest.POLICY_DIM: case DisplayPowerRequest.POLICY_BRIGHT: case DisplayPowerRequest.POLICY_BRIGHT: Loading Loading @@ -577,19 +589,16 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call brightness = PowerManager.BRIGHTNESS_ON; brightness = PowerManager.BRIGHTNESS_ON; } } // Use default brightness when dozing unless overridden. if (brightness < 0 && (state == Display.STATE_DOZE || state == Display.STATE_DOZE_SUSPEND)) { brightness = mScreenBrightnessDozeConfig; } // Configure auto-brightness. // Configure auto-brightness. boolean autoBrightnessEnabled = false; boolean autoBrightnessEnabled = false; if (mAutomaticBrightnessController != null) { if (mAutomaticBrightnessController != null) { final boolean autoBrightnessEnabledInDoze = mAllowAutoBrightnessWhileDozingConfig && (state == Display.STATE_DOZE || state == Display.STATE_DOZE_SUSPEND); autoBrightnessEnabled = mPowerRequest.useAutoBrightness autoBrightnessEnabled = mPowerRequest.useAutoBrightness && state == Display.STATE_ON && brightness < 0; && (state == Display.STATE_ON || autoBrightnessEnabledInDoze) && brightness < 0; mAutomaticBrightnessController.configure(autoBrightnessEnabled, mAutomaticBrightnessController.configure(autoBrightnessEnabled, mPowerRequest.screenAutoBrightnessAdjustment); mPowerRequest.screenAutoBrightnessAdjustment, state != Display.STATE_ON); } } // Apply auto-brightness. // Apply auto-brightness. Loading @@ -612,6 +621,12 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call mAppliedAutoBrightness = false; mAppliedAutoBrightness = false; } } // Use default brightness when dozing unless overridden. if (brightness < 0 && (state == Display.STATE_DOZE || state == Display.STATE_DOZE_SUSPEND)) { brightness = mScreenBrightnessDozeConfig; } // Apply manual brightness. // Apply manual brightness. // Use the current brightness setting from the request, which is expected // Use the current brightness setting from the request, which is expected // provide a nominal default value for the case where auto-brightness // provide a nominal default value for the case where auto-brightness Loading Loading @@ -1024,6 +1039,8 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call pw.println(" mScreenBrightnessRangeMinimum=" + mScreenBrightnessRangeMinimum); pw.println(" mScreenBrightnessRangeMinimum=" + mScreenBrightnessRangeMinimum); pw.println(" mScreenBrightnessRangeMaximum=" + mScreenBrightnessRangeMaximum); pw.println(" mScreenBrightnessRangeMaximum=" + mScreenBrightnessRangeMaximum); pw.println(" mUseSoftwareAutoBrightnessConfig=" + mUseSoftwareAutoBrightnessConfig); pw.println(" mUseSoftwareAutoBrightnessConfig=" + mUseSoftwareAutoBrightnessConfig); pw.println(" mAllowAutoBrightnessWhileDozingConfig=" + mAllowAutoBrightnessWhileDozingConfig); pw.println(" mColorFadeFadesConfig=" + mColorFadeFadesConfig); pw.println(" mColorFadeFadesConfig=" + mColorFadeFadesConfig); mHandler.runWithScissors(new Runnable() { mHandler.runWithScissors(new Runnable() { Loading