Loading core/java/android/hardware/display/DisplayManager.java +13 −1 Original line number Diff line number Diff line Loading @@ -108,6 +108,17 @@ public final class DisplayManager { public static final String DISPLAY_CATEGORY_PRESENTATION = "android.hardware.display.category.PRESENTATION"; /** * Display category: All displays, including disabled displays. * <p> * This returns all displays, including currently disabled and inaccessible displays. * * @see #getDisplays(String) * @hide */ public static final String DISPLAY_CATEGORY_ALL_INCLUDING_DISABLED = "android.hardware.display.category.ALL_INCLUDING_DISABLED"; /** @hide **/ @IntDef(prefix = "VIRTUAL_DISPLAY_FLAG_", flag = true, value = { VIRTUAL_DISPLAY_FLAG_PUBLIC, Loading Loading @@ -552,7 +563,8 @@ public final class DisplayManager { final int[] displayIds = mGlobal.getDisplayIds(); synchronized (mLock) { try { if (category == null) { if (category == null || DISPLAY_CATEGORY_ALL_INCLUDING_DISABLED.equals(category)) { addAllDisplaysLocked(mTempDisplays, displayIds); } else if (category.equals(DISPLAY_CATEGORY_PRESENTATION)) { addPresentationDisplaysLocked(mTempDisplays, displayIds, Display.TYPE_WIFI); Loading services/core/java/com/android/server/display/DisplayManagerShellCommand.java +17 −0 Original line number Diff line number Diff line Loading @@ -76,6 +76,8 @@ class DisplayManagerShellCommand extends ShellCommand { return setUserDisabledHdrTypes(); case "get-user-disabled-hdr-types": return getUserDisabledHdrTypes(); case "get-displays": return getDisplays(); case "dock": return setDockedAndIdle(); case "undock": Loading Loading @@ -133,6 +135,9 @@ class DisplayManagerShellCommand extends ShellCommand { pw.println(" Sets the user disabled HDR types as TYPES"); pw.println(" get-user-disabled-hdr-types"); pw.println(" Returns the user disabled HDR types"); pw.println(" get-displays [CATEGORY]"); pw.println(" Returns the current displays. Can specify string category among"); pw.println(" DisplayManager.DISPLAY_CATEGORY_*; must use the actual string value."); pw.println(" dock"); pw.println(" Sets brightness to docked + idle screen brightness mode"); pw.println(" undock"); Loading @@ -141,6 +146,18 @@ class DisplayManagerShellCommand extends ShellCommand { Intent.printIntentArgsHelp(pw , ""); } private int getDisplays() { String category = getNextArg(); DisplayManager dm = mService.getContext().getSystemService(DisplayManager.class); Display[] displays = dm.getDisplays(category); PrintWriter out = getOutPrintWriter(); out.println("Displays:"); for (int i = 0; i < displays.length; i++) { out.println(" " + displays[i]); } return 0; } private int setBrightness() { String brightnessText = getNextArg(); if (brightnessText == null) { Loading Loading
core/java/android/hardware/display/DisplayManager.java +13 −1 Original line number Diff line number Diff line Loading @@ -108,6 +108,17 @@ public final class DisplayManager { public static final String DISPLAY_CATEGORY_PRESENTATION = "android.hardware.display.category.PRESENTATION"; /** * Display category: All displays, including disabled displays. * <p> * This returns all displays, including currently disabled and inaccessible displays. * * @see #getDisplays(String) * @hide */ public static final String DISPLAY_CATEGORY_ALL_INCLUDING_DISABLED = "android.hardware.display.category.ALL_INCLUDING_DISABLED"; /** @hide **/ @IntDef(prefix = "VIRTUAL_DISPLAY_FLAG_", flag = true, value = { VIRTUAL_DISPLAY_FLAG_PUBLIC, Loading Loading @@ -552,7 +563,8 @@ public final class DisplayManager { final int[] displayIds = mGlobal.getDisplayIds(); synchronized (mLock) { try { if (category == null) { if (category == null || DISPLAY_CATEGORY_ALL_INCLUDING_DISABLED.equals(category)) { addAllDisplaysLocked(mTempDisplays, displayIds); } else if (category.equals(DISPLAY_CATEGORY_PRESENTATION)) { addPresentationDisplaysLocked(mTempDisplays, displayIds, Display.TYPE_WIFI); Loading
services/core/java/com/android/server/display/DisplayManagerShellCommand.java +17 −0 Original line number Diff line number Diff line Loading @@ -76,6 +76,8 @@ class DisplayManagerShellCommand extends ShellCommand { return setUserDisabledHdrTypes(); case "get-user-disabled-hdr-types": return getUserDisabledHdrTypes(); case "get-displays": return getDisplays(); case "dock": return setDockedAndIdle(); case "undock": Loading Loading @@ -133,6 +135,9 @@ class DisplayManagerShellCommand extends ShellCommand { pw.println(" Sets the user disabled HDR types as TYPES"); pw.println(" get-user-disabled-hdr-types"); pw.println(" Returns the user disabled HDR types"); pw.println(" get-displays [CATEGORY]"); pw.println(" Returns the current displays. Can specify string category among"); pw.println(" DisplayManager.DISPLAY_CATEGORY_*; must use the actual string value."); pw.println(" dock"); pw.println(" Sets brightness to docked + idle screen brightness mode"); pw.println(" undock"); Loading @@ -141,6 +146,18 @@ class DisplayManagerShellCommand extends ShellCommand { Intent.printIntentArgsHelp(pw , ""); } private int getDisplays() { String category = getNextArg(); DisplayManager dm = mService.getContext().getSystemService(DisplayManager.class); Display[] displays = dm.getDisplays(category); PrintWriter out = getOutPrintWriter(); out.println("Displays:"); for (int i = 0; i < displays.length; i++) { out.println(" " + displays[i]); } return 0; } private int setBrightness() { String brightnessText = getNextArg(); if (brightnessText == null) { Loading