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

Commit 65672c90 authored by Riddle Hsu's avatar Riddle Hsu Committed by Android (Google) Code Review
Browse files

Merge "Fix command format of wm density" into main

parents 168a6933 fc31ea6d
Loading
Loading
Loading
Loading
+4 −6
Original line number Diff line number Diff line
@@ -284,30 +284,28 @@ public class WindowManagerShellCommand extends ShellCommand {

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

        if (densityStr == null) {
            printInitialDisplayDensity(pw, displayId);
            return 0;
        } else if ("-d".equals(densityStr)) {
            printInitialDisplayDensity(pw, displayId);
            return 0;
        } else if ("reset".equals(densityStr)) {
            density = -1;
        } else {