Loading core/java/android/hardware/display/DisplayManager.java +7 −5 Original line number Diff line number Diff line Loading @@ -559,18 +559,20 @@ public final class DisplayManager { * @see #DISPLAY_CATEGORY_PRESENTATION */ public Display[] getDisplays(String category) { final int[] displayIds = mGlobal.getDisplayIds(); boolean includeDisabled = (category != null && category.equals(DISPLAY_CATEGORY_ALL_INCLUDING_DISABLED)); final int[] displayIds = mGlobal.getDisplayIds(includeDisabled); synchronized (mLock) { try { if (category == null || DISPLAY_CATEGORY_ALL_INCLUDING_DISABLED.equals(category)) { addAllDisplaysLocked(mTempDisplays, displayIds); } else if (category.equals(DISPLAY_CATEGORY_PRESENTATION)) { if (DISPLAY_CATEGORY_PRESENTATION.equals(category)) { addPresentationDisplaysLocked(mTempDisplays, displayIds, Display.TYPE_WIFI); addPresentationDisplaysLocked(mTempDisplays, displayIds, Display.TYPE_EXTERNAL); addPresentationDisplaysLocked(mTempDisplays, displayIds, Display.TYPE_OVERLAY); addPresentationDisplaysLocked(mTempDisplays, displayIds, Display.TYPE_VIRTUAL); addPresentationDisplaysLocked(mTempDisplays, displayIds, Display.TYPE_INTERNAL); } else if (category == null || DISPLAY_CATEGORY_ALL_INCLUDING_DISABLED.equals(category)) { addAllDisplaysLocked(mTempDisplays, displayIds); } return mTempDisplays.toArray(new Display[mTempDisplays.size()]); } finally { Loading core/java/android/hardware/display/DisplayManagerGlobal.java +11 −1 Original line number Diff line number Diff line Loading @@ -206,6 +206,16 @@ public final class DisplayManagerGlobal { */ @UnsupportedAppUsage public int[] getDisplayIds() { return getDisplayIds(/* includeDisabled= */ false); } /** * Gets all currently valid logical display ids. * * @param includeDisabled True if the returned list of displays includes disabled displays. * @return An array containing all display ids. */ public int[] getDisplayIds(boolean includeDisabled) { try { synchronized (mLock) { if (USE_CACHE) { Loading @@ -214,7 +224,7 @@ public final class DisplayManagerGlobal { } } int[] displayIds = mDm.getDisplayIds(); int[] displayIds = mDm.getDisplayIds(includeDisabled); if (USE_CACHE) { mDisplayIdCache = displayIds; } Loading core/java/android/hardware/display/IDisplayManager.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -36,7 +36,7 @@ import android.view.Surface; interface IDisplayManager { @UnsupportedAppUsage DisplayInfo getDisplayInfo(int displayId); int[] getDisplayIds(); int[] getDisplayIds(boolean includeDisabled); boolean isUidPresentOnDisplay(int uid, int displayId); Loading services/core/java/com/android/server/display/DisplayManagerService.java +21 −24 Original line number Diff line number Diff line Loading @@ -1545,7 +1545,7 @@ public final class DisplayManagerService extends SystemService { mSyncRoot.notifyAll(); } sendDisplayEventLocked(displayId, DisplayManagerGlobal.EVENT_DISPLAY_ADDED); sendDisplayEventLocked(display, DisplayManagerGlobal.EVENT_DISPLAY_ADDED); Runnable work = updateDisplayStateLocked(device); if (work != null) { Loading @@ -1564,7 +1564,7 @@ public final class DisplayManagerService extends SystemService { // We don't bother invalidating the display info caches here because any changes to the // display info will trigger a cache invalidation inside of LogicalDisplay before we hit // this point. sendDisplayEventLocked(displayId, DisplayManagerGlobal.EVENT_DISPLAY_CHANGED); sendDisplayEventLocked(display, DisplayManagerGlobal.EVENT_DISPLAY_CHANGED); scheduleTraversalLocked(false); mPersistentDataStore.saveIfNeeded(); Loading Loading @@ -1593,7 +1593,7 @@ public final class DisplayManagerService extends SystemService { mDisplayStates.delete(displayId); mDisplayBrightnesses.delete(displayId); DisplayManagerGlobal.invalidateLocalDisplayInfoCaches(); sendDisplayEventLocked(displayId, DisplayManagerGlobal.EVENT_DISPLAY_REMOVED); sendDisplayEventLocked(display, DisplayManagerGlobal.EVENT_DISPLAY_REMOVED); scheduleTraversalLocked(false); if (mDisplayWindowPolicyControllers.contains(displayId)) { Loading @@ -1609,24 +1609,13 @@ public final class DisplayManagerService extends SystemService { } private void handleLogicalDisplaySwappedLocked(@NonNull LogicalDisplay display) { final DisplayDevice device = display.getPrimaryDisplayDeviceLocked(); final Runnable work = updateDisplayStateLocked(device); if (work != null) { mHandler.post(work); } final int displayId = display.getDisplayIdLocked(); handleLogicalDisplayChangedLocked(display); final int displayId = display.getDisplayIdLocked(); if (displayId == Display.DEFAULT_DISPLAY) { notifyDefaultDisplayDeviceUpdated(display); } DisplayPowerController dpc = mDisplayPowerControllers.get(displayId); if (dpc != null) { dpc.onDisplayChanged(); } mPersistentDataStore.saveIfNeeded(); mHandler.sendEmptyMessage(MSG_LOAD_BRIGHTNESS_CONFIGURATIONS); handleLogicalDisplayChangedLocked(display); } private void notifyDefaultDisplayDeviceUpdated(LogicalDisplay display) { Loading @@ -1638,7 +1627,7 @@ public final class DisplayManagerService extends SystemService { final int displayId = display.getDisplayIdLocked(); final DisplayPowerController dpc = mDisplayPowerControllers.get(displayId); if (dpc != null) { dpc.onDeviceStateTransition(); dpc.onDisplayChanged(); } } Loading Loading @@ -2348,10 +2337,14 @@ public final class DisplayManagerService extends SystemService { } } private void sendDisplayEventLocked(int displayId, @DisplayEvent int event) { private void sendDisplayEventLocked(@NonNull LogicalDisplay display, @DisplayEvent int event) { // Only send updates outside of DisplayManagerService for enabled displays if (display.isEnabledLocked()) { int displayId = display.getDisplayIdLocked(); Message msg = mHandler.obtainMessage(MSG_DELIVER_DISPLAY_EVENT, displayId, event); mHandler.sendMessage(msg); } } private void sendDisplayGroupEvent(int groupId, int event) { Message msg = mHandler.obtainMessage(MSG_DELIVER_DISPLAY_GROUP_EVENT, groupId, event); Loading Loading @@ -2636,8 +2629,7 @@ public final class DisplayManagerService extends SystemService { } private void handleBrightnessChange(LogicalDisplay display) { sendDisplayEventLocked(display.getDisplayIdLocked(), DisplayManagerGlobal.EVENT_DISPLAY_BRIGHTNESS_CHANGED); sendDisplayEventLocked(display, DisplayManagerGlobal.EVENT_DISPLAY_BRIGHTNESS_CHANGED); } private DisplayDevice getDeviceForDisplayLocked(int displayId) { Loading Loading @@ -2854,12 +2846,12 @@ public final class DisplayManagerService extends SystemService { * Returns the list of all display ids. */ @Override // Binder call public int[] getDisplayIds() { public int[] getDisplayIds(boolean includeDisabled) { final int callingUid = Binder.getCallingUid(); final long token = Binder.clearCallingIdentity(); try { synchronized (mSyncRoot) { return mLogicalDisplayMapper.getDisplayIdsLocked(callingUid); return mLogicalDisplayMapper.getDisplayIdsLocked(callingUid, includeDisabled); } } finally { Binder.restoreCallingIdentity(token); Loading Loading @@ -3337,6 +3329,11 @@ public final class DisplayManagerService extends SystemService { final long token = Binder.clearCallingIdentity(); try { synchronized (mSyncRoot) { LogicalDisplay display = mLogicalDisplayMapper.getDisplayLocked( displayId, /* includeDisabled= */ false); if (display == null || !display.isEnabledLocked()) { return null; } DisplayPowerController dpc = mDisplayPowerControllers.get(displayId); if (dpc != null) { return dpc.getBrightnessInfo(); Loading services/core/java/com/android/server/display/DisplayModeDirector.java +6 −3 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.server.display; import static android.hardware.display.DisplayManager.DISPLAY_CATEGORY_ALL_INCLUDING_DISABLED; import static android.hardware.display.DisplayManagerInternal.REFRESH_RATE_LIMIT_HIGH_BRIGHTNESS_MODE; import static android.os.PowerManager.BRIGHTNESS_INVALID; Loading Loading @@ -1457,7 +1458,7 @@ public class DisplayModeDirector { SparseArray<Display.Mode[]> modes = new SparseArray<>(); SparseArray<Display.Mode> defaultModes = new SparseArray<>(); DisplayInfo info = new DisplayInfo(); Display[] displays = dm.getDisplays(); Display[] displays = dm.getDisplays(DISPLAY_CATEGORY_ALL_INCLUDING_DISABLED); for (Display d : displays) { final int displayId = d.getDisplayId(); d.getDisplayInfo(info); Loading Loading @@ -2332,7 +2333,8 @@ public class DisplayModeDirector { sensorManager.addProximityActiveListener(BackgroundThread.getExecutor(), this); synchronized (mSensorObserverLock) { for (Display d : mDisplayManager.getDisplays()) { for (Display d : mDisplayManager.getDisplays( DISPLAY_CATEGORY_ALL_INCLUDING_DISABLED)) { mDozeStateByDisplay.put(d.getDisplayId(), mInjector.isDozeState(d)); } } Loading @@ -2343,7 +2345,8 @@ public class DisplayModeDirector { } private void recalculateVotesLocked() { final Display[] displays = mDisplayManager.getDisplays(); final Display[] displays = mDisplayManager.getDisplays( DISPLAY_CATEGORY_ALL_INCLUDING_DISABLED); for (Display d : displays) { int displayId = d.getDisplayId(); Vote vote = null; Loading Loading
core/java/android/hardware/display/DisplayManager.java +7 −5 Original line number Diff line number Diff line Loading @@ -559,18 +559,20 @@ public final class DisplayManager { * @see #DISPLAY_CATEGORY_PRESENTATION */ public Display[] getDisplays(String category) { final int[] displayIds = mGlobal.getDisplayIds(); boolean includeDisabled = (category != null && category.equals(DISPLAY_CATEGORY_ALL_INCLUDING_DISABLED)); final int[] displayIds = mGlobal.getDisplayIds(includeDisabled); synchronized (mLock) { try { if (category == null || DISPLAY_CATEGORY_ALL_INCLUDING_DISABLED.equals(category)) { addAllDisplaysLocked(mTempDisplays, displayIds); } else if (category.equals(DISPLAY_CATEGORY_PRESENTATION)) { if (DISPLAY_CATEGORY_PRESENTATION.equals(category)) { addPresentationDisplaysLocked(mTempDisplays, displayIds, Display.TYPE_WIFI); addPresentationDisplaysLocked(mTempDisplays, displayIds, Display.TYPE_EXTERNAL); addPresentationDisplaysLocked(mTempDisplays, displayIds, Display.TYPE_OVERLAY); addPresentationDisplaysLocked(mTempDisplays, displayIds, Display.TYPE_VIRTUAL); addPresentationDisplaysLocked(mTempDisplays, displayIds, Display.TYPE_INTERNAL); } else if (category == null || DISPLAY_CATEGORY_ALL_INCLUDING_DISABLED.equals(category)) { addAllDisplaysLocked(mTempDisplays, displayIds); } return mTempDisplays.toArray(new Display[mTempDisplays.size()]); } finally { Loading
core/java/android/hardware/display/DisplayManagerGlobal.java +11 −1 Original line number Diff line number Diff line Loading @@ -206,6 +206,16 @@ public final class DisplayManagerGlobal { */ @UnsupportedAppUsage public int[] getDisplayIds() { return getDisplayIds(/* includeDisabled= */ false); } /** * Gets all currently valid logical display ids. * * @param includeDisabled True if the returned list of displays includes disabled displays. * @return An array containing all display ids. */ public int[] getDisplayIds(boolean includeDisabled) { try { synchronized (mLock) { if (USE_CACHE) { Loading @@ -214,7 +224,7 @@ public final class DisplayManagerGlobal { } } int[] displayIds = mDm.getDisplayIds(); int[] displayIds = mDm.getDisplayIds(includeDisabled); if (USE_CACHE) { mDisplayIdCache = displayIds; } Loading
core/java/android/hardware/display/IDisplayManager.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -36,7 +36,7 @@ import android.view.Surface; interface IDisplayManager { @UnsupportedAppUsage DisplayInfo getDisplayInfo(int displayId); int[] getDisplayIds(); int[] getDisplayIds(boolean includeDisabled); boolean isUidPresentOnDisplay(int uid, int displayId); Loading
services/core/java/com/android/server/display/DisplayManagerService.java +21 −24 Original line number Diff line number Diff line Loading @@ -1545,7 +1545,7 @@ public final class DisplayManagerService extends SystemService { mSyncRoot.notifyAll(); } sendDisplayEventLocked(displayId, DisplayManagerGlobal.EVENT_DISPLAY_ADDED); sendDisplayEventLocked(display, DisplayManagerGlobal.EVENT_DISPLAY_ADDED); Runnable work = updateDisplayStateLocked(device); if (work != null) { Loading @@ -1564,7 +1564,7 @@ public final class DisplayManagerService extends SystemService { // We don't bother invalidating the display info caches here because any changes to the // display info will trigger a cache invalidation inside of LogicalDisplay before we hit // this point. sendDisplayEventLocked(displayId, DisplayManagerGlobal.EVENT_DISPLAY_CHANGED); sendDisplayEventLocked(display, DisplayManagerGlobal.EVENT_DISPLAY_CHANGED); scheduleTraversalLocked(false); mPersistentDataStore.saveIfNeeded(); Loading Loading @@ -1593,7 +1593,7 @@ public final class DisplayManagerService extends SystemService { mDisplayStates.delete(displayId); mDisplayBrightnesses.delete(displayId); DisplayManagerGlobal.invalidateLocalDisplayInfoCaches(); sendDisplayEventLocked(displayId, DisplayManagerGlobal.EVENT_DISPLAY_REMOVED); sendDisplayEventLocked(display, DisplayManagerGlobal.EVENT_DISPLAY_REMOVED); scheduleTraversalLocked(false); if (mDisplayWindowPolicyControllers.contains(displayId)) { Loading @@ -1609,24 +1609,13 @@ public final class DisplayManagerService extends SystemService { } private void handleLogicalDisplaySwappedLocked(@NonNull LogicalDisplay display) { final DisplayDevice device = display.getPrimaryDisplayDeviceLocked(); final Runnable work = updateDisplayStateLocked(device); if (work != null) { mHandler.post(work); } final int displayId = display.getDisplayIdLocked(); handleLogicalDisplayChangedLocked(display); final int displayId = display.getDisplayIdLocked(); if (displayId == Display.DEFAULT_DISPLAY) { notifyDefaultDisplayDeviceUpdated(display); } DisplayPowerController dpc = mDisplayPowerControllers.get(displayId); if (dpc != null) { dpc.onDisplayChanged(); } mPersistentDataStore.saveIfNeeded(); mHandler.sendEmptyMessage(MSG_LOAD_BRIGHTNESS_CONFIGURATIONS); handleLogicalDisplayChangedLocked(display); } private void notifyDefaultDisplayDeviceUpdated(LogicalDisplay display) { Loading @@ -1638,7 +1627,7 @@ public final class DisplayManagerService extends SystemService { final int displayId = display.getDisplayIdLocked(); final DisplayPowerController dpc = mDisplayPowerControllers.get(displayId); if (dpc != null) { dpc.onDeviceStateTransition(); dpc.onDisplayChanged(); } } Loading Loading @@ -2348,10 +2337,14 @@ public final class DisplayManagerService extends SystemService { } } private void sendDisplayEventLocked(int displayId, @DisplayEvent int event) { private void sendDisplayEventLocked(@NonNull LogicalDisplay display, @DisplayEvent int event) { // Only send updates outside of DisplayManagerService for enabled displays if (display.isEnabledLocked()) { int displayId = display.getDisplayIdLocked(); Message msg = mHandler.obtainMessage(MSG_DELIVER_DISPLAY_EVENT, displayId, event); mHandler.sendMessage(msg); } } private void sendDisplayGroupEvent(int groupId, int event) { Message msg = mHandler.obtainMessage(MSG_DELIVER_DISPLAY_GROUP_EVENT, groupId, event); Loading Loading @@ -2636,8 +2629,7 @@ public final class DisplayManagerService extends SystemService { } private void handleBrightnessChange(LogicalDisplay display) { sendDisplayEventLocked(display.getDisplayIdLocked(), DisplayManagerGlobal.EVENT_DISPLAY_BRIGHTNESS_CHANGED); sendDisplayEventLocked(display, DisplayManagerGlobal.EVENT_DISPLAY_BRIGHTNESS_CHANGED); } private DisplayDevice getDeviceForDisplayLocked(int displayId) { Loading Loading @@ -2854,12 +2846,12 @@ public final class DisplayManagerService extends SystemService { * Returns the list of all display ids. */ @Override // Binder call public int[] getDisplayIds() { public int[] getDisplayIds(boolean includeDisabled) { final int callingUid = Binder.getCallingUid(); final long token = Binder.clearCallingIdentity(); try { synchronized (mSyncRoot) { return mLogicalDisplayMapper.getDisplayIdsLocked(callingUid); return mLogicalDisplayMapper.getDisplayIdsLocked(callingUid, includeDisabled); } } finally { Binder.restoreCallingIdentity(token); Loading Loading @@ -3337,6 +3329,11 @@ public final class DisplayManagerService extends SystemService { final long token = Binder.clearCallingIdentity(); try { synchronized (mSyncRoot) { LogicalDisplay display = mLogicalDisplayMapper.getDisplayLocked( displayId, /* includeDisabled= */ false); if (display == null || !display.isEnabledLocked()) { return null; } DisplayPowerController dpc = mDisplayPowerControllers.get(displayId); if (dpc != null) { return dpc.getBrightnessInfo(); Loading
services/core/java/com/android/server/display/DisplayModeDirector.java +6 −3 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.server.display; import static android.hardware.display.DisplayManager.DISPLAY_CATEGORY_ALL_INCLUDING_DISABLED; import static android.hardware.display.DisplayManagerInternal.REFRESH_RATE_LIMIT_HIGH_BRIGHTNESS_MODE; import static android.os.PowerManager.BRIGHTNESS_INVALID; Loading Loading @@ -1457,7 +1458,7 @@ public class DisplayModeDirector { SparseArray<Display.Mode[]> modes = new SparseArray<>(); SparseArray<Display.Mode> defaultModes = new SparseArray<>(); DisplayInfo info = new DisplayInfo(); Display[] displays = dm.getDisplays(); Display[] displays = dm.getDisplays(DISPLAY_CATEGORY_ALL_INCLUDING_DISABLED); for (Display d : displays) { final int displayId = d.getDisplayId(); d.getDisplayInfo(info); Loading Loading @@ -2332,7 +2333,8 @@ public class DisplayModeDirector { sensorManager.addProximityActiveListener(BackgroundThread.getExecutor(), this); synchronized (mSensorObserverLock) { for (Display d : mDisplayManager.getDisplays()) { for (Display d : mDisplayManager.getDisplays( DISPLAY_CATEGORY_ALL_INCLUDING_DISABLED)) { mDozeStateByDisplay.put(d.getDisplayId(), mInjector.isDozeState(d)); } } Loading @@ -2343,7 +2345,8 @@ public class DisplayModeDirector { } private void recalculateVotesLocked() { final Display[] displays = mDisplayManager.getDisplays(); final Display[] displays = mDisplayManager.getDisplays( DISPLAY_CATEGORY_ALL_INCLUDING_DISABLED); for (Display d : displays) { int displayId = d.getDisplayId(); Vote vote = null; Loading