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

Commit 2b3e8568 authored by Ruchi Kandoi's avatar Ruchi Kandoi Committed by Android (Google) Code Review
Browse files

Merge "Display: Brightness: Low power mode scales the brightness to 50 percent."

parents 1d0861dd f974cc87
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -156,6 +156,9 @@ public abstract class DisplayManagerInternal {
        // If true, enables automatic brightness control.
        public boolean useAutoBrightness;

        //If true, scales the brightness to half of desired.
        public boolean lowPowerMode;

        // If true, prevents the screen from completely turning on if it is currently off.
        // The display does not enter a "ready" state if this flag is true and screen on is
        // blocked.  The window manager policy blocks screen on while it prepares the keyguard to
@@ -203,6 +206,7 @@ public abstract class DisplayManagerInternal {
            screenAutoBrightnessAdjustment = other.screenAutoBrightnessAdjustment;
            useAutoBrightness = other.useAutoBrightness;
            blockScreenOn = other.blockScreenOn;
            lowPowerMode = other.lowPowerMode;
        }

        @Override
@@ -218,7 +222,8 @@ public abstract class DisplayManagerInternal {
                    && screenBrightness == other.screenBrightness
                    && screenAutoBrightnessAdjustment == other.screenAutoBrightnessAdjustment
                    && useAutoBrightness == other.useAutoBrightness
                    && blockScreenOn == other.blockScreenOn;
                    && blockScreenOn == other.blockScreenOn
                    && lowPowerMode == other.lowPowerMode;
        }

        @Override
@@ -233,7 +238,8 @@ public abstract class DisplayManagerInternal {
                    + ", screenBrightness=" + screenBrightness
                    + ", screenAutoBrightnessAdjustment=" + screenAutoBrightnessAdjustment
                    + ", useAutoBrightness=" + useAutoBrightness
                    + ", blockScreenOn=" + blockScreenOn;
                    + ", blockScreenOn=" + blockScreenOn
                    + ", lowPowerMode=" + lowPowerMode;
        }
    }

+5 −0
Original line number Diff line number Diff line
@@ -518,6 +518,11 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
                // Brighten quickly.
                slow = false;
            }
            // If low power mode is enabled, brightness level
            // would be scaled down to half
            if (mPowerRequest.lowPowerMode) {
                target = target/2;
            }
            animateScreenBrightness(clampScreenBrightness(target),
                    slow ? BRIGHTNESS_RAMP_RATE_SLOW : BRIGHTNESS_RAMP_RATE_FAST);
        } else {
+2 −0
Original line number Diff line number Diff line
@@ -1634,6 +1634,8 @@ public final class PowerManagerService extends com.android.server.SystemService

            mDisplayPowerRequest.blockScreenOn = mScreenOnBlocker.isHeld();

            mDisplayPowerRequest.lowPowerMode = mLowPowerModeEnabled;

            mDisplayReady = mDisplayManagerInternal.requestPowerState(mDisplayPowerRequest,
                    mRequestWaitForNegativeProximity);
            mRequestWaitForNegativeProximity = false;