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

Commit 95518a71 authored by Dianne Hackborn's avatar Dianne Hackborn Committed by The Android Open Source Project
Browse files

Automated import from //branches/master/...@142765,142765

parent fea44a0c
Loading
Loading
Loading
Loading
+30 −19
Original line number Diff line number Diff line
@@ -1373,8 +1373,9 @@ class PowerManagerService extends IPowerManager.Stub implements LocalPowerManage
    }

    private void updateLightsLocked(int newState, int forceState) {
        int oldState = mPowerState;
        int difference = (newState ^ oldState) | forceState;
        final int oldState = mPowerState;
        final int realDifference = (newState ^ oldState);
        final int difference = realDifference | forceState;
        if (difference == 0) {
            return;
        }
@@ -1430,7 +1431,13 @@ class PowerManagerService extends IPowerManager.Stub implements LocalPowerManage

        if ((difference & (SCREEN_ON_BIT | SCREEN_BRIGHT_BIT)) != 0) {
            if (ANIMATE_SCREEN_LIGHTS) {
                int nominalCurrentValue;
                int nominalCurrentValue = -1;
                // If there was an actual difference in the light state, then
                // figure out the "ideal" current value based on the previous
                // state.  Otherwise, this is a change due to the brightness
                // override, so we want to animate from whatever the current
                // value is.
                if ((realDifference & (SCREEN_ON_BIT | SCREEN_BRIGHT_BIT)) != 0) {
                    switch (oldState & (SCREEN_BRIGHT_BIT|SCREEN_ON_BIT)) {
                        case SCREEN_BRIGHT_BIT | SCREEN_ON_BIT:
                            nominalCurrentValue = preferredBrightness;
@@ -1447,6 +1454,7 @@ class PowerManagerService extends IPowerManager.Stub implements LocalPowerManage
                            nominalCurrentValue = (int)mScreenBrightness.curValue;
                            break;
                    }
                }
                if ((newState & SCREEN_BRIGHT_BIT) == 0) {
                    // dim or turn off backlight, depending on if the screen is on
                    // the scale is because the brightness ramp isn't linear and this biases
@@ -1575,7 +1583,9 @@ class PowerManagerService extends IPowerManager.Stub implements LocalPowerManage
                curValue = (float)initialValue;
            }
            targetValue = target;
            delta = (targetValue-nominalCurrentValue) / stepsToTarget;
            delta = (targetValue -
                    (nominalCurrentValue >= 0 ? nominalCurrentValue : curValue))
                    / stepsToTarget;
            if (mSpew) {
                String noticeMe = nominalCurrentValue == curValue ? "" : "  ******************";
                Log.i(TAG, "Setting target " + mask + ": cur=" + curValue
@@ -1596,6 +1606,7 @@ class PowerManagerService extends IPowerManager.Stub implements LocalPowerManage
            int curIntValue = (int)curValue;
            boolean more = true;
            if (delta == 0) {
                curValue = curIntValue = targetValue;
                more = false;
            } else if (delta > 0) {
                if (curIntValue >= targetValue) {
+8 −1
Original line number Diff line number Diff line
@@ -7799,6 +7799,7 @@ public class WindowManagerService extends IWindowManager.Stub implements Watchdo
            boolean blurring = false;
            boolean dimming = false;
            boolean covered = false;
            boolean syswin = false;

            for (i=N-1; i>=0; i--) {
                WindowState w = (WindowState)mWindows.get(i);
@@ -8058,9 +8059,15 @@ public class WindowManagerService extends IWindowManager.Stub implements Watchdo
                        if ((attrFlags&FLAG_KEEP_SCREEN_ON) != 0) {
                            holdScreen = w.mSession;
                        }
                        if (w.mAttrs.screenBrightness >= 0 && screenBrightness < 0) {
                        if (!syswin && w.mAttrs.screenBrightness >= 0
                                && screenBrightness < 0) {
                            screenBrightness = w.mAttrs.screenBrightness;
                        }
                        if (attrs.type == WindowManager.LayoutParams.TYPE_SYSTEM_DIALOG
                                || attrs.type == WindowManager.LayoutParams.TYPE_KEYGUARD
                                || attrs.type == WindowManager.LayoutParams.TYPE_SYSTEM_ERROR) {
                            syswin = true;
                        }
                    }
                    if (w.isFullscreenOpaque(dw, dh)) {
                        // This window completely covers everything behind it,