Loading core/java/android/hardware/display/DisplayManagerInternal.java +1 −7 Original line number Diff line number Diff line Loading @@ -66,12 +66,6 @@ public abstract class DisplayManagerInternal { */ public abstract boolean isProximitySensorAvailable(); /** * Returns the id of the {@link com.android.server.display.DisplayGroup} to which the provided * display belongs. */ public abstract int getDisplayGroupId(int displayId); /** * Registers a display group listener which will be informed of the addition, removal, or change * of display groups. Loading Loading @@ -469,7 +463,7 @@ public abstract class DisplayManagerInternal { void onStateChanged(); void onProximityPositive(); void onProximityNegative(); void onDisplayStateChange(int state); // one of the Display state constants void onDisplayStateChange(boolean allInactive, boolean allOff); void acquireSuspendBlocker(); void releaseSuspendBlocker(); Loading services/core/java/com/android/server/display/AutomaticBrightnessController.java +4 −0 Original line number Diff line number Diff line Loading @@ -354,6 +354,10 @@ class AutomaticBrightnessController { } } public void stop() { setLightSensorEnabled(false); } public boolean hasUserDataPoints() { return mBrightnessMapper.hasUserDataPoints(); } Loading services/core/java/com/android/server/display/BrightnessTracker.java +0 −1 Original line number Diff line number Diff line Loading @@ -243,7 +243,6 @@ public class BrightnessTracker { } /** Stop listening for events */ @VisibleForTesting void stop() { if (DEBUG) { Slog.d(TAG, "Stop"); Loading services/core/java/com/android/server/display/ColorFade.java +6 −0 Original line number Diff line number Diff line Loading @@ -817,6 +817,12 @@ final class ColorFade { } DisplayInfo displayInfo = mDisplayManagerInternal.getDisplayInfo(mDisplayId); if (displayInfo == null) { // displayInfo can be null if the associated display has been removed. There // is a delay between the display being removed and ColorFade being dismissed. return; } switch (displayInfo.rotation) { case Surface.ROTATION_0: t.setPosition(mSurfaceControl, 0, 0); Loading services/core/java/com/android/server/display/DisplayManagerService.java +49 −24 Original line number Diff line number Diff line Loading @@ -249,30 +249,48 @@ public final class DisplayManagerService extends SystemService { /** {@link DisplayBlanker} used by all {@link DisplayPowerController}s. */ private final DisplayBlanker mDisplayBlanker = new DisplayBlanker() { // Synchronized to avoid race conditions when updating multiple display states. @Override public void requestDisplayState(int displayId, int state, float brightness) { // TODO (b/168210494): Stop applying default display state to all displays. if (displayId != Display.DEFAULT_DISPLAY) { return; } final int[] displayIds; public synchronized void requestDisplayState(int displayId, int state, float brightness) { boolean allInactive = true; boolean allOff = true; final boolean stateChanged; synchronized (mSyncRoot) { displayIds = mLogicalDisplayMapper.getDisplayIdsLocked(); final int index = mDisplayStates.indexOfKey(displayId); if (index > -1) { final int currentState = mDisplayStates.valueAt(index); stateChanged = state != currentState; if (stateChanged) { final int size = mDisplayStates.size(); for (int i = 0; i < size; i++) { final int displayState = i == index ? state : mDisplayStates.valueAt(i); if (displayState != Display.STATE_OFF) { allOff = false; } if (Display.isActiveState(displayState)) { allInactive = false; } if (!allOff && !allInactive) { break; } } } } else { stateChanged = false; } } // The order of operations is important for legacy reasons. if (state == Display.STATE_OFF) { for (int id : displayIds) { requestDisplayStateInternal(id, state, brightness); } requestDisplayStateInternal(displayId, state, brightness); } mDisplayPowerCallbacks.onDisplayStateChange(state); if (stateChanged) { mDisplayPowerCallbacks.onDisplayStateChange(allInactive, allOff); } if (state != Display.STATE_OFF) { for (int id : displayIds) { requestDisplayStateInternal(id, state, brightness); } requestDisplayStateInternal(displayId, state, brightness); } } }; Loading Loading @@ -1160,7 +1178,7 @@ public final class DisplayManagerService extends SystemService { private void handleLogicalDisplayRemovedLocked(@NonNull LogicalDisplay display) { final int displayId = display.getDisplayIdLocked(); mDisplayPowerControllers.delete(displayId); mDisplayPowerControllers.removeReturnOld(displayId).stop(); mDisplayStates.delete(displayId); mDisplayBrightnesses.delete(displayId); DisplayManagerGlobal.invalidateLocalDisplayInfoCaches(); Loading Loading @@ -2758,23 +2776,30 @@ public final class DisplayManagerService extends SystemService { public boolean requestPowerState(int groupId, DisplayPowerRequest request, boolean waitForNegativeProximity) { synchronized (mSyncRoot) { return mDisplayPowerControllers.get(Display.DEFAULT_DISPLAY) .requestPowerState(request, waitForNegativeProximity); final DisplayGroup displayGroup = mLogicalDisplayMapper.getDisplayGroupLocked( groupId); if (displayGroup == null) { return true; } final int size = displayGroup.getSizeLocked(); boolean ready = true; for (int i = 0; i < size; i++) { final DisplayPowerController displayPowerController = mDisplayPowerControllers.get(displayGroup.getIdLocked(i)); ready &= displayPowerController.requestPowerState(request, waitForNegativeProximity); } @Override public boolean isProximitySensorAvailable() { synchronized (mSyncRoot) { return mDisplayPowerControllers.get(Display.DEFAULT_DISPLAY) .isProximitySensorAvailable(); return ready; } } @Override public int getDisplayGroupId(int displayId) { public boolean isProximitySensorAvailable() { synchronized (mSyncRoot) { return mLogicalDisplayMapper.getDisplayGroupIdLocked(displayId); return mDisplayPowerControllers.get(Display.DEFAULT_DISPLAY) .isProximitySensorAvailable(); } } Loading Loading
core/java/android/hardware/display/DisplayManagerInternal.java +1 −7 Original line number Diff line number Diff line Loading @@ -66,12 +66,6 @@ public abstract class DisplayManagerInternal { */ public abstract boolean isProximitySensorAvailable(); /** * Returns the id of the {@link com.android.server.display.DisplayGroup} to which the provided * display belongs. */ public abstract int getDisplayGroupId(int displayId); /** * Registers a display group listener which will be informed of the addition, removal, or change * of display groups. Loading Loading @@ -469,7 +463,7 @@ public abstract class DisplayManagerInternal { void onStateChanged(); void onProximityPositive(); void onProximityNegative(); void onDisplayStateChange(int state); // one of the Display state constants void onDisplayStateChange(boolean allInactive, boolean allOff); void acquireSuspendBlocker(); void releaseSuspendBlocker(); Loading
services/core/java/com/android/server/display/AutomaticBrightnessController.java +4 −0 Original line number Diff line number Diff line Loading @@ -354,6 +354,10 @@ class AutomaticBrightnessController { } } public void stop() { setLightSensorEnabled(false); } public boolean hasUserDataPoints() { return mBrightnessMapper.hasUserDataPoints(); } Loading
services/core/java/com/android/server/display/BrightnessTracker.java +0 −1 Original line number Diff line number Diff line Loading @@ -243,7 +243,6 @@ public class BrightnessTracker { } /** Stop listening for events */ @VisibleForTesting void stop() { if (DEBUG) { Slog.d(TAG, "Stop"); Loading
services/core/java/com/android/server/display/ColorFade.java +6 −0 Original line number Diff line number Diff line Loading @@ -817,6 +817,12 @@ final class ColorFade { } DisplayInfo displayInfo = mDisplayManagerInternal.getDisplayInfo(mDisplayId); if (displayInfo == null) { // displayInfo can be null if the associated display has been removed. There // is a delay between the display being removed and ColorFade being dismissed. return; } switch (displayInfo.rotation) { case Surface.ROTATION_0: t.setPosition(mSurfaceControl, 0, 0); Loading
services/core/java/com/android/server/display/DisplayManagerService.java +49 −24 Original line number Diff line number Diff line Loading @@ -249,30 +249,48 @@ public final class DisplayManagerService extends SystemService { /** {@link DisplayBlanker} used by all {@link DisplayPowerController}s. */ private final DisplayBlanker mDisplayBlanker = new DisplayBlanker() { // Synchronized to avoid race conditions when updating multiple display states. @Override public void requestDisplayState(int displayId, int state, float brightness) { // TODO (b/168210494): Stop applying default display state to all displays. if (displayId != Display.DEFAULT_DISPLAY) { return; } final int[] displayIds; public synchronized void requestDisplayState(int displayId, int state, float brightness) { boolean allInactive = true; boolean allOff = true; final boolean stateChanged; synchronized (mSyncRoot) { displayIds = mLogicalDisplayMapper.getDisplayIdsLocked(); final int index = mDisplayStates.indexOfKey(displayId); if (index > -1) { final int currentState = mDisplayStates.valueAt(index); stateChanged = state != currentState; if (stateChanged) { final int size = mDisplayStates.size(); for (int i = 0; i < size; i++) { final int displayState = i == index ? state : mDisplayStates.valueAt(i); if (displayState != Display.STATE_OFF) { allOff = false; } if (Display.isActiveState(displayState)) { allInactive = false; } if (!allOff && !allInactive) { break; } } } } else { stateChanged = false; } } // The order of operations is important for legacy reasons. if (state == Display.STATE_OFF) { for (int id : displayIds) { requestDisplayStateInternal(id, state, brightness); } requestDisplayStateInternal(displayId, state, brightness); } mDisplayPowerCallbacks.onDisplayStateChange(state); if (stateChanged) { mDisplayPowerCallbacks.onDisplayStateChange(allInactive, allOff); } if (state != Display.STATE_OFF) { for (int id : displayIds) { requestDisplayStateInternal(id, state, brightness); } requestDisplayStateInternal(displayId, state, brightness); } } }; Loading Loading @@ -1160,7 +1178,7 @@ public final class DisplayManagerService extends SystemService { private void handleLogicalDisplayRemovedLocked(@NonNull LogicalDisplay display) { final int displayId = display.getDisplayIdLocked(); mDisplayPowerControllers.delete(displayId); mDisplayPowerControllers.removeReturnOld(displayId).stop(); mDisplayStates.delete(displayId); mDisplayBrightnesses.delete(displayId); DisplayManagerGlobal.invalidateLocalDisplayInfoCaches(); Loading Loading @@ -2758,23 +2776,30 @@ public final class DisplayManagerService extends SystemService { public boolean requestPowerState(int groupId, DisplayPowerRequest request, boolean waitForNegativeProximity) { synchronized (mSyncRoot) { return mDisplayPowerControllers.get(Display.DEFAULT_DISPLAY) .requestPowerState(request, waitForNegativeProximity); final DisplayGroup displayGroup = mLogicalDisplayMapper.getDisplayGroupLocked( groupId); if (displayGroup == null) { return true; } final int size = displayGroup.getSizeLocked(); boolean ready = true; for (int i = 0; i < size; i++) { final DisplayPowerController displayPowerController = mDisplayPowerControllers.get(displayGroup.getIdLocked(i)); ready &= displayPowerController.requestPowerState(request, waitForNegativeProximity); } @Override public boolean isProximitySensorAvailable() { synchronized (mSyncRoot) { return mDisplayPowerControllers.get(Display.DEFAULT_DISPLAY) .isProximitySensorAvailable(); return ready; } } @Override public int getDisplayGroupId(int displayId) { public boolean isProximitySensorAvailable() { synchronized (mSyncRoot) { return mLogicalDisplayMapper.getDisplayGroupIdLocked(displayId); return mDisplayPowerControllers.get(Display.DEFAULT_DISPLAY) .isProximitySensorAvailable(); } } Loading