Merge "Pass ambient lux to the HBM controllers of the follower DPCs"
This commit is contained in:
committed by
Android (Google) Code Review
commit
7603e4fe40
@@ -402,7 +402,6 @@ class AutomaticBrightnessController {
|
||||
boolean userChangedAutoBrightnessAdjustment, int displayPolicy,
|
||||
boolean shouldResetShortTermModel) {
|
||||
mState = state;
|
||||
mHbmController.setAutoBrightnessEnabled(mState);
|
||||
// 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
|
||||
@@ -466,7 +465,6 @@ class AutomaticBrightnessController {
|
||||
mHandler.sendEmptyMessage(MSG_RUN_UPDATE);
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
float getAmbientLux() {
|
||||
return mAmbientLux;
|
||||
}
|
||||
|
||||
@@ -719,7 +719,8 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBrightnessToFollow(float leadDisplayBrightness, float nits) {
|
||||
public void setBrightnessToFollow(float leadDisplayBrightness, float nits, float ambientLux) {
|
||||
mHbmController.onAmbientLuxChange(ambientLux);
|
||||
if (mAutomaticBrightnessController == null || nits < 0) {
|
||||
mBrightnessToFollow = leadDisplayBrightness;
|
||||
} else {
|
||||
@@ -751,7 +752,8 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
|
||||
}
|
||||
for (int i = 0; i < followers.size(); i++) {
|
||||
DisplayPowerControllerInterface follower = followers.valueAt(i);
|
||||
follower.setBrightnessToFollow(PowerManager.BRIGHTNESS_INVALID_FLOAT, /* nits= */ -1);
|
||||
follower.setBrightnessToFollow(PowerManager.BRIGHTNESS_INVALID_FLOAT, /* nits= */ -1,
|
||||
/* ambientLux= */ 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1523,6 +1525,9 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
|
||||
mShouldResetShortTermModel);
|
||||
mShouldResetShortTermModel = false;
|
||||
}
|
||||
mHbmController.setAutoBrightnessEnabled(mUseAutoBrightness
|
||||
? AutomaticBrightnessController.AUTO_BRIGHTNESS_ENABLED
|
||||
: AutomaticBrightnessController.AUTO_BRIGHTNESS_DISABLED);
|
||||
|
||||
if (mBrightnessTracker != null) {
|
||||
mBrightnessTracker.setBrightnessConfiguration(mBrightnessConfiguration);
|
||||
@@ -1634,9 +1639,12 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
|
||||
mAppliedThrottling = false;
|
||||
}
|
||||
|
||||
float ambientLux = mAutomaticBrightnessController == null ? 0
|
||||
: mAutomaticBrightnessController.getAmbientLux();
|
||||
for (int i = 0; i < displayBrightnessFollowers.size(); i++) {
|
||||
DisplayPowerControllerInterface follower = displayBrightnessFollowers.valueAt(i);
|
||||
follower.setBrightnessToFollow(rawBrightnessState, convertToNits(rawBrightnessState));
|
||||
follower.setBrightnessToFollow(rawBrightnessState, convertToNits(rawBrightnessState),
|
||||
ambientLux);
|
||||
}
|
||||
|
||||
if (updateScreenBrightnessSetting) {
|
||||
|
||||
@@ -1236,6 +1236,9 @@ final class DisplayPowerController2 implements AutomaticBrightnessController.Cal
|
||||
mShouldResetShortTermModel);
|
||||
mShouldResetShortTermModel = false;
|
||||
}
|
||||
mHbmController.setAutoBrightnessEnabled(mUseAutoBrightness
|
||||
? AutomaticBrightnessController.AUTO_BRIGHTNESS_ENABLED
|
||||
: AutomaticBrightnessController.AUTO_BRIGHTNESS_DISABLED);
|
||||
|
||||
if (mBrightnessTracker != null) {
|
||||
mBrightnessTracker.setBrightnessConfiguration(mBrightnessConfiguration);
|
||||
@@ -1347,9 +1350,12 @@ final class DisplayPowerController2 implements AutomaticBrightnessController.Cal
|
||||
mAppliedThrottling = false;
|
||||
}
|
||||
|
||||
float ambientLux = mAutomaticBrightnessController == null ? 0
|
||||
: mAutomaticBrightnessController.getAmbientLux();
|
||||
for (int i = 0; i < displayBrightnessFollowers.size(); i++) {
|
||||
DisplayPowerControllerInterface follower = displayBrightnessFollowers.valueAt(i);
|
||||
follower.setBrightnessToFollow(rawBrightnessState, convertToNits(rawBrightnessState));
|
||||
follower.setBrightnessToFollow(rawBrightnessState, convertToNits(rawBrightnessState),
|
||||
ambientLux);
|
||||
}
|
||||
|
||||
if (updateScreenBrightnessSetting) {
|
||||
@@ -2138,7 +2144,8 @@ final class DisplayPowerController2 implements AutomaticBrightnessController.Cal
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBrightnessToFollow(float leadDisplayBrightness, float nits) {
|
||||
public void setBrightnessToFollow(float leadDisplayBrightness, float nits, float ambientLux) {
|
||||
mHbmController.onAmbientLuxChange(ambientLux);
|
||||
if (mAutomaticBrightnessController == null || nits < 0) {
|
||||
mDisplayBrightnessController.setBrightnessToFollow(leadDisplayBrightness);
|
||||
} else {
|
||||
@@ -2219,7 +2226,8 @@ final class DisplayPowerController2 implements AutomaticBrightnessController.Cal
|
||||
}
|
||||
for (int i = 0; i < followers.size(); i++) {
|
||||
DisplayPowerControllerInterface follower = followers.valueAt(i);
|
||||
follower.setBrightnessToFollow(PowerManager.BRIGHTNESS_INVALID_FLOAT, /* nits= */ -1);
|
||||
follower.setBrightnessToFollow(PowerManager.BRIGHTNESS_INVALID_FLOAT, /* nits= */ -1,
|
||||
/* ambientLux= */ 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -173,9 +173,11 @@ public interface DisplayPowerControllerInterface {
|
||||
* displays.
|
||||
* @param leadDisplayBrightness The brightness of the lead display in the set of concurrent
|
||||
* displays
|
||||
* @param nits The brightness value in nits if the device supports nits
|
||||
* @param nits The brightness value in nits if the device supports nits. Set to a negative
|
||||
* number otherwise.
|
||||
* @param ambientLux The lux value that will be passed to {@link HighBrightnessModeController}
|
||||
*/
|
||||
void setBrightnessToFollow(float leadDisplayBrightness, float nits);
|
||||
void setBrightnessToFollow(float leadDisplayBrightness, float nits, float ambientLux);
|
||||
|
||||
/**
|
||||
* Add an additional display that will copy the brightness value from this display. This is used
|
||||
|
||||
Reference in New Issue
Block a user