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

Commit 88c59ce9 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Add ALL_INCLUDING_DISPLAYS category for getDisplays()" into tm-dev am:...

Merge "Add ALL_INCLUDING_DISPLAYS category for getDisplays()" into tm-dev am: d5b0c3f1 am: c8571df9

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18488313



Change-Id: If4a2e2bd428ee33ac66721ef3a622d54606c712e
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents bd0fa64c c8571df9
Loading
Loading
Loading
Loading
+13 −1
Original line number Diff line number Diff line
@@ -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,
@@ -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);
+17 −0
Original line number Diff line number Diff line
@@ -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":
@@ -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");
@@ -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) {