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

Commit 24325ced authored by Nataniel Borges's avatar Nataniel Borges
Browse files

Add window trace status to the bug report

Add the window trace status when dumping the WM service for the
bugreport.

The status include:
- Enabled or not
- Log level (0 - all, 1 - trim or 2 - critical)
- Buffer size
- User buffer space
- Number of elements in the buffer

Test: Run `dumpsys window trace`
Change-Id: Iec43922523b5aab6f14c03f4b5999dcce8ea5dce
parent d6ea41c2
Loading
Loading
Loading
Loading
+21 −9
Original line number Diff line number Diff line
@@ -5736,6 +5736,11 @@ public class WindowManagerService extends IWindowManager.Stub
        mRoot.dumpTokens(pw, dumpAll);
    }

    private void dumpTraceStatus(PrintWriter pw) {
        pw.println("WINDOW MANAGER TRACE (dumpsys window trace)");
        pw.print(mWindowTracing.getStatus() + "\n");
    }

    private void dumpSessionsLocked(PrintWriter pw, boolean dumpAll) {
        pw.println("WINDOW MANAGER SESSIONS (dumpsys window sessions)");
        for (int i=0; i<mSessions.size(); i++) {
@@ -6053,7 +6058,7 @@ public class WindowManagerService extends IWindowManager.Stub
                pw.println("    d[isplays]: active display contents");
                pw.println("    t[okens]: token list");
                pw.println("    w[indows]: window list");
                pw.println("    trace: write Winscope trace to file");
                pw.println("    trace: print trace status and write Winscope trace to file");
                pw.println("  cmd may also be a NAME to dump windows.  NAME may");
                pw.println("    be a partial substring in a window name, a");
                pw.println("    Window hex object identifier, or");
@@ -6128,6 +6133,7 @@ public class WindowManagerService extends IWindowManager.Stub
                }
                return;
            } else if ("trace".equals(cmd)) {
                dumpTraceStatus(pw);
                synchronized (mGlobalLock) {
                    mWindowTracing.writeTraceToFile();
                }
@@ -6144,43 +6150,49 @@ public class WindowManagerService extends IWindowManager.Stub

        synchronized (mGlobalLock) {
            pw.println();
            final String separator = "---------------------------------------------------------"
                    + "----------------------";
            if (dumpAll) {
                pw.println("-------------------------------------------------------------------------------");
                pw.println(separator);
            }
            dumpLastANRLocked(pw);
            pw.println();
            if (dumpAll) {
                pw.println("-------------------------------------------------------------------------------");
                pw.println(separator);
            }
            dumpPolicyLocked(pw, args, dumpAll);
            pw.println();
            if (dumpAll) {
                pw.println("-------------------------------------------------------------------------------");
                pw.println(separator);
            }
            dumpAnimatorLocked(pw, args, dumpAll);
            pw.println();
            if (dumpAll) {
                pw.println("-------------------------------------------------------------------------------");
                pw.println(separator);
            }
            dumpSessionsLocked(pw, dumpAll);
            pw.println();
            if (dumpAll) {
                pw.println("-------------------------------------------------------------------------------");
                pw.println(separator);
            }
            if (dumpAll) {
                pw.println("-------------------------------------------------------------------------------");
                pw.println(separator);
            }
            mRoot.dumpDisplayContents(pw);
            pw.println();
            if (dumpAll) {
                pw.println("-------------------------------------------------------------------------------");
                pw.println(separator);
            }
            dumpTokensLocked(pw, dumpAll);
            pw.println();
            if (dumpAll) {
                pw.println("-------------------------------------------------------------------------------");
                pw.println(separator);
            }
            dumpWindowsLocked(pw, dumpAll, null);
            if (dumpAll) {
                pw.println(separator);
            }
            dumpTraceStatus(pw);
        }
    }

+1 −1
Original line number Diff line number Diff line
@@ -217,7 +217,7 @@ class WindowTracing {
        }
    }

    private String getStatus() {
    String getStatus() {
        return "Status: "
                + ((isEnabled()) ? "Enabled" : "Disabled")
                + "\n"