Merge "Move LogicalDisplay.isEnabled calculation to DPC." into sc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
a455e38605
@@ -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,16 +1204,15 @@ 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);
|
||||
}
|
||||
final float brightness = mDisplayBrightnesses.get(displayId);
|
||||
return device.requestDisplayStateLocked(state, brightness);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -982,7 +982,8 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
|
||||
mWaitingForNegativeProximity = false;
|
||||
mIgnoreProximityUntilChanged = false;
|
||||
}
|
||||
if (mScreenOffBecauseOfProximity) {
|
||||
|
||||
if (!mLogicalDisplay.isEnabled() || mScreenOffBecauseOfProximity) {
|
||||
state = Display.STATE_OFF;
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user