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

Commit dedce719 authored by Riddle Hsu's avatar Riddle Hsu
Browse files

Correct argument order of wm density

Previous change mistakenly thought the arguments are:
 density [-d DISPLAY_ID] [-u UNIQUE_ID] [reset|DENSITY]
But the hint in help info is:
 density [reset|DENSITY] [-d DISPLAY_ID] [-u UNIQUE_ID]

Bug: 186124236
Bug: 355647098
Flag: EXEMPT bugfix
Test: Create a virtual display.
      Change the density of the display:
        adb shell wm density 300 -d 2
        adb shell wm density 300 -u "virtual:a.test,1000,VD,2"
      Print the density of the display
        adb shell wm density -d 2
        adb shell wm density -u "virtual:a.test,1000,VD,2"
Change-Id: Iaa3d0dc45958981d27f2bcdb7c095836ce2fcbe2
parent 62253d6f
Loading
Loading
Loading
Loading
+9 −5
Original line number Diff line number Diff line
@@ -283,24 +283,28 @@ public class WindowManagerShellCommand extends ShellCommand {
    }

    private int runDisplayDensity(PrintWriter pw) throws RemoteException {
        String densityStr = getNextArg();
        String densityStr = null;
        String arg = getNextArg();
        int density;
        int displayId = Display.DEFAULT_DISPLAY;
        if ("-d".equals(densityStr) && arg != null) {
        if (!"-d".equals(arg) && !"-u".equals(arg)) {
            densityStr = arg;
            arg = getNextArg();
        }
        if ("-d".equals(arg)) {
            arg = getNextArg();
            try {
                displayId = Integer.parseInt(arg);
            } catch (NumberFormatException e) {
                getErrPrintWriter().println("Error: bad number " + e);
            }
            densityStr = getNextArg();
        } else if ("-u".equals(densityStr) && arg != null) {
        } else if ("-u".equals(arg)) {
            arg = getNextArg();
            displayId = mInterface.getDisplayIdByUniqueId(arg);
            if (displayId == Display.INVALID_DISPLAY) {
                getErrPrintWriter().println("Error: the uniqueId is invalid ");
                return -1;
            }
            densityStr = getNextArg();
        }

        if (densityStr == null) {