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

Commit a455e386 authored by Santos Cordon's avatar Santos Cordon Committed by Android (Google) Code Review
Browse files

Merge "Move LogicalDisplay.isEnabled calculation to DPC." into sc-dev

parents d419a26c 33b90a36
Loading
Loading
Loading
Loading
+7 −8
Original line number Diff line number Diff line
@@ -1128,7 +1128,7 @@ public final class DisplayManagerService extends SystemService {
            recordTopInsetLocked(display);
        }
        addDisplayPowerControllerLocked(display);
        mDisplayStates.append(displayId, Display.STATE_OFF);
        mDisplayStates.append(displayId, Display.STATE_UNKNOWN);
        mDisplayBrightnesses.append(displayId, display.getDisplayInfoLocked().brightnessDefault);

        DisplayManagerGlobal.invalidateLocalDisplayInfoCaches();
@@ -1204,17 +1204,16 @@ public final class DisplayManagerService extends SystemService {
        DisplayDeviceInfo info = device.getDisplayDeviceInfoLocked();
        if ((info.flags & DisplayDeviceInfo.FLAG_NEVER_BLANK) == 0) {
            final LogicalDisplay display = mLogicalDisplayMapper.getDisplayLocked(device);
            final int state;
            final int displayId = display.getDisplayIdLocked();
            final int state = mDisplayStates.get(displayId);

            if (display.isEnabled()) {
                state = mDisplayStates.get(displayId);
            } else {
                state = Display.STATE_OFF;
            }
            // Only send a request for display state if the display state has already been
            // initialized by DisplayPowercontroller.
            if (state != Display.STATE_UNKNOWN) {
                final float brightness = mDisplayBrightnesses.get(displayId);
                return device.requestDisplayStateLocked(state, brightness);
            }
        }
        return null;
    }

+2 −1
Original line number Diff line number Diff line
@@ -982,7 +982,8 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
            mWaitingForNegativeProximity = false;
            mIgnoreProximityUntilChanged = false;
        }
        if (mScreenOffBecauseOfProximity) {

        if (!mLogicalDisplay.isEnabled() || mScreenOffBecauseOfProximity) {
            state = Display.STATE_OFF;
        }

+4 −1
Original line number Diff line number Diff line
@@ -682,7 +682,10 @@ final class LocalDisplayAdapter extends DisplayAdapter {
                                    || oldState == Display.STATE_ON_SUSPEND) {
                                setDisplayState(Display.STATE_ON);
                                currentState = Display.STATE_ON;
                            } else {

                            // If UNKNOWN, we still want to set the initial display state,
                            // otherwise, return early.
                            } else if (oldState != Display.STATE_UNKNOWN) {
                                return; // old state and new state is off
                            }
                        }