Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fc5f20ff authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "brightness: add config for whether allowing normal birhgntess for doze" into main

parents fc5a4bd1 121c209b
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -7237,4 +7237,10 @@

    <!-- The name of the system package that will hold the dependency installer role. -->
    <string name="config_systemDependencyInstaller" translatable="false" />

    <!-- Whether allow normal brightness when doze policy can be requested. When this is false,
        brightness follows the display state i.e. ON means bright, DOZE means dim. If true,
        POLICY_DOZE can also dim the screen unless parameter useNormalBrightnessForDoze of
        DreamService#setDozeScreenState requests an exception. -->
    <bool name="config_allowNormalBrightnessForDozePolicy">false</bool>
</resources>
+2 −0
Original line number Diff line number Diff line
@@ -5799,4 +5799,6 @@

  <!-- Style for Wear Material3 Button. Will only be used for sdk 36 or above. -->
  <java-symbol type="style" name="Widget.DeviceDefault.Button.WearMaterial3" />

  <java-symbol type="bool" name="config_allowNormalBrightnessForDozePolicy" />
</resources>
+1 −1
Original line number Diff line number Diff line
@@ -1280,7 +1280,7 @@ public class AutomaticBrightnessController {

    private boolean shouldApplyDozeScaleFactor() {
        // We don't apply the doze scale factor if we have a designated brightness curve for doze.
        return (mDisplayManagerFlags.isNormalBrightnessForDozeParameterEnabled()
        return (mDisplayManagerFlags.isNormalBrightnessForDozeParameterEnabled(mContext)
                ? (!mUseNormalBrightnessForDoze && mDisplayPolicy == POLICY_DOZE)
                        || Display.isDozeState(mDisplayState) : Display.isDozeState(mDisplayState))
                && getMode() != AUTO_BRIGHTNESS_MODE_DOZE;
+1 −1
Original line number Diff line number Diff line
@@ -1399,7 +1399,7 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
        // Use doze brightness if one of following is true:
        // 1. The target `state` isDozeState.
        // 2. Doze power request(POLICY_DOZE) if there's no exception(useNormalBrightnessForDoze).
        final boolean useDozeBrightness = mFlags.isNormalBrightnessForDozeParameterEnabled()
        final boolean useDozeBrightness = mFlags.isNormalBrightnessForDozeParameterEnabled(mContext)
                ? (!mPowerRequest.useNormalBrightnessForDoze && mPowerRequest.policy == POLICY_DOZE)
                        || Display.isDozeState(state) : Display.isDozeState(state);
        DisplayBrightnessState displayBrightnessState =
+4 −1
Original line number Diff line number Diff line
@@ -109,6 +109,8 @@ public class DisplayBrightnessStrategySelector {

    private final int mDisplayId;

    private final Context mContext;

    /**
     * The constructor of DozeBrightnessStrategy.
     */
@@ -117,6 +119,7 @@ public class DisplayBrightnessStrategySelector {
        if (injector == null) {
            injector = new Injector();
        }
        mContext = context;
        mDisplayManagerFlags = flags;
        mDisplayId = displayId;
        mDozeBrightnessStrategy = injector.getDozeBrightnessStrategy();
@@ -348,7 +351,7 @@ public class DisplayBrightnessStrategySelector {
        // a user can define a different display state(displayPowerRequest.dozeScreenState) too
        // in the request with the Doze policy and user might request an override to force certain
        // brightness.
        return (!mDisplayManagerFlags.isNormalBrightnessForDozeParameterEnabled()
        return (!mDisplayManagerFlags.isNormalBrightnessForDozeParameterEnabled(mContext)
                || !displayPowerRequest.useNormalBrightnessForDoze)
                && displayPowerRequest.policy == DisplayPowerRequest.POLICY_DOZE
                && !mAllowAutoBrightnessWhileDozing
Loading