Loading services/core/java/com/android/server/wm/WindowManagerService.java +9 −3 Original line number Diff line number Diff line Loading @@ -232,6 +232,7 @@ import android.view.WindowManagerPolicyConstants.PointerEventListener; import com.android.internal.R; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.os.BackgroundThread; import com.android.internal.os.IResultReceiver; import com.android.internal.policy.IKeyguardDismissCallback; import com.android.internal.policy.IShortcutService; Loading Loading @@ -414,6 +415,14 @@ public class WindowManagerService extends IWindowManager.Stub @Override public void dumpCritical(FileDescriptor fd, PrintWriter pw, String[] args, boolean asProto) { // Bugreport dumps the trace 2x, 1x as proto and 1x as text. Save file to disk only 1x. if (asProto && mWindowTracing.isEnabled()) { mWindowTracing.stopTrace(null, false /* writeToFile */); BackgroundThread.getHandler().post(() -> { mWindowTracing.writeTraceToFile(); mWindowTracing.startTrace(null); }); } doDump(fd, pw, new String[] {"-a"}, asProto); } Loading Loading @@ -6182,9 +6191,6 @@ public class WindowManagerService extends IWindowManager.Stub return; } else if ("trace".equals(cmd)) { dumpTraceStatus(pw); synchronized (mGlobalLock) { mWindowTracing.writeTraceToFile(); } return; } else { // Dumping a single name? Loading services/core/java/com/android/server/wm/WindowTracing.java +17 −2 Original line number Diff line number Diff line Loading @@ -100,7 +100,20 @@ class WindowTracing { } } /** * Stops the trace and write the current buffer to disk * @param pw Print writer */ void stopTrace(@Nullable PrintWriter pw) { stopTrace(pw, true /* writeToFile */); } /** * Stops the trace * @param pw Print writer * @param writeToFile If the current buffer should be written to disk or not */ void stopTrace(@Nullable PrintWriter pw, boolean writeToFile) { if (IS_USER) { logAndPrintln(pw, "Error: Tracing is not supported on user builds."); return; Loading @@ -113,10 +126,12 @@ class WindowTracing { logAndPrintln(pw, "ERROR: tracing was re-enabled while waiting for flush."); throw new IllegalStateException("tracing enabled while waiting for flush."); } if (writeToFile) { writeTraceToFileLocked(); logAndPrintln(pw, "Trace written to " + mTraceFile + "."); } } } private void setLogLevel(@WindowTraceLogLevel int logLevel, PrintWriter pw) { logAndPrintln(pw, "Setting window tracing log level to " + logLevel); Loading Loading
services/core/java/com/android/server/wm/WindowManagerService.java +9 −3 Original line number Diff line number Diff line Loading @@ -232,6 +232,7 @@ import android.view.WindowManagerPolicyConstants.PointerEventListener; import com.android.internal.R; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.os.BackgroundThread; import com.android.internal.os.IResultReceiver; import com.android.internal.policy.IKeyguardDismissCallback; import com.android.internal.policy.IShortcutService; Loading Loading @@ -414,6 +415,14 @@ public class WindowManagerService extends IWindowManager.Stub @Override public void dumpCritical(FileDescriptor fd, PrintWriter pw, String[] args, boolean asProto) { // Bugreport dumps the trace 2x, 1x as proto and 1x as text. Save file to disk only 1x. if (asProto && mWindowTracing.isEnabled()) { mWindowTracing.stopTrace(null, false /* writeToFile */); BackgroundThread.getHandler().post(() -> { mWindowTracing.writeTraceToFile(); mWindowTracing.startTrace(null); }); } doDump(fd, pw, new String[] {"-a"}, asProto); } Loading Loading @@ -6182,9 +6191,6 @@ public class WindowManagerService extends IWindowManager.Stub return; } else if ("trace".equals(cmd)) { dumpTraceStatus(pw); synchronized (mGlobalLock) { mWindowTracing.writeTraceToFile(); } return; } else { // Dumping a single name? Loading
services/core/java/com/android/server/wm/WindowTracing.java +17 −2 Original line number Diff line number Diff line Loading @@ -100,7 +100,20 @@ class WindowTracing { } } /** * Stops the trace and write the current buffer to disk * @param pw Print writer */ void stopTrace(@Nullable PrintWriter pw) { stopTrace(pw, true /* writeToFile */); } /** * Stops the trace * @param pw Print writer * @param writeToFile If the current buffer should be written to disk or not */ void stopTrace(@Nullable PrintWriter pw, boolean writeToFile) { if (IS_USER) { logAndPrintln(pw, "Error: Tracing is not supported on user builds."); return; Loading @@ -113,10 +126,12 @@ class WindowTracing { logAndPrintln(pw, "ERROR: tracing was re-enabled while waiting for flush."); throw new IllegalStateException("tracing enabled while waiting for flush."); } if (writeToFile) { writeTraceToFileLocked(); logAndPrintln(pw, "Trace written to " + mTraceFile + "."); } } } private void setLogLevel(@WindowTraceLogLevel int logLevel, PrintWriter pw) { logAndPrintln(pw, "Setting window tracing log level to " + logLevel); Loading