Loading services/core/java/com/android/server/display/DisplayPowerController.java +37 −32 Original line number Diff line number Diff line Loading @@ -1406,9 +1406,11 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call } setBrightnessFromOffload(PowerManager.BRIGHTNESS_INVALID_FLOAT); } if (!mFlags.isRefactorDisplayPowerControllerEnabled()) { // AutomaticBrightnessStrategy has higher priority than OffloadBrightnessStrategy if (!mFlags.isRefactorDisplayPowerControllerEnabled() && (Float.isNaN(brightnessState) || mBrightnessReasonTemp.getReason() == BrightnessReason.REASON_OFFLOAD)) { if (Float.isNaN(brightnessState) || mBrightnessReasonTemp.getReason() == BrightnessReason.REASON_OFFLOAD) { if (mAutomaticBrightnessStrategy.isAutoBrightnessEnabled()) { brightnessState = mAutomaticBrightnessStrategy.getAutomaticScreenBrightness( mTempBrightnessEvent); Loading @@ -1416,13 +1418,15 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call || brightnessState == PowerManager.BRIGHTNESS_OFF_FLOAT) { rawBrightnessState = mAutomaticBrightnessController .getRawAutomaticScreenBrightness(); brightnessState = clampScreenBrightness(brightnessState); // slowly adapt to auto-brightness // TODO(b/253226419): slowChange should be decided by strategy.updateBrightness // TODO(b/253226419): slowChange should be decided by // strategy.updateBrightness slowChange = mAutomaticBrightnessStrategy.hasAppliedAutoBrightness() && !mAutomaticBrightnessStrategy.getAutoBrightnessAdjustmentChanged(); && !mAutomaticBrightnessStrategy .getAutoBrightnessAdjustmentChanged(); brightnessAdjustmentFlags = mAutomaticBrightnessStrategy.getAutoBrightnessAdjustmentReasonsFlags(); mAutomaticBrightnessStrategy .getAutoBrightnessAdjustmentReasonsFlags(); updateScreenBrightnessSetting = currentBrightnessSetting != brightnessState; mAutomaticBrightnessStrategy.setAutoBrightnessApplied(true); mBrightnessReasonTemp.setReason(BrightnessReason.REASON_AUTOMATIC); Loading @@ -1437,12 +1441,13 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call } } } else { // Any non-auto-brightness values such as override or temporary should still be subject // to clamping so that they don't go beyond the current max as specified by Brightness // Range Controller. brightnessState = clampScreenBrightness(brightnessState); mAutomaticBrightnessStrategy.setAutoBrightnessApplied(false); } } if (!Float.isNaN(brightnessState)) { brightnessState = clampScreenBrightness(brightnessState); } // If there's an offload session, we need to set the initial doze brightness before // the offload session starts controlling the brightness. Loading Loading
services/core/java/com/android/server/display/DisplayPowerController.java +37 −32 Original line number Diff line number Diff line Loading @@ -1406,9 +1406,11 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call } setBrightnessFromOffload(PowerManager.BRIGHTNESS_INVALID_FLOAT); } if (!mFlags.isRefactorDisplayPowerControllerEnabled()) { // AutomaticBrightnessStrategy has higher priority than OffloadBrightnessStrategy if (!mFlags.isRefactorDisplayPowerControllerEnabled() && (Float.isNaN(brightnessState) || mBrightnessReasonTemp.getReason() == BrightnessReason.REASON_OFFLOAD)) { if (Float.isNaN(brightnessState) || mBrightnessReasonTemp.getReason() == BrightnessReason.REASON_OFFLOAD) { if (mAutomaticBrightnessStrategy.isAutoBrightnessEnabled()) { brightnessState = mAutomaticBrightnessStrategy.getAutomaticScreenBrightness( mTempBrightnessEvent); Loading @@ -1416,13 +1418,15 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call || brightnessState == PowerManager.BRIGHTNESS_OFF_FLOAT) { rawBrightnessState = mAutomaticBrightnessController .getRawAutomaticScreenBrightness(); brightnessState = clampScreenBrightness(brightnessState); // slowly adapt to auto-brightness // TODO(b/253226419): slowChange should be decided by strategy.updateBrightness // TODO(b/253226419): slowChange should be decided by // strategy.updateBrightness slowChange = mAutomaticBrightnessStrategy.hasAppliedAutoBrightness() && !mAutomaticBrightnessStrategy.getAutoBrightnessAdjustmentChanged(); && !mAutomaticBrightnessStrategy .getAutoBrightnessAdjustmentChanged(); brightnessAdjustmentFlags = mAutomaticBrightnessStrategy.getAutoBrightnessAdjustmentReasonsFlags(); mAutomaticBrightnessStrategy .getAutoBrightnessAdjustmentReasonsFlags(); updateScreenBrightnessSetting = currentBrightnessSetting != brightnessState; mAutomaticBrightnessStrategy.setAutoBrightnessApplied(true); mBrightnessReasonTemp.setReason(BrightnessReason.REASON_AUTOMATIC); Loading @@ -1437,12 +1441,13 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call } } } else { // Any non-auto-brightness values such as override or temporary should still be subject // to clamping so that they don't go beyond the current max as specified by Brightness // Range Controller. brightnessState = clampScreenBrightness(brightnessState); mAutomaticBrightnessStrategy.setAutoBrightnessApplied(false); } } if (!Float.isNaN(brightnessState)) { brightnessState = clampScreenBrightness(brightnessState); } // If there's an offload session, we need to set the initial doze brightness before // the offload session starts controlling the brightness. Loading