Loading core/java/com/android/internal/protolog/BaseProtoLogImpl.java +0 −12 Original line number Diff line number Diff line Loading @@ -359,18 +359,6 @@ public class BaseProtoLogImpl { + "\nLogging definitions loaded: " + mViewerConfig.knownViewerStringsNumber(); } /** * Writes the log buffer to a new file for the bugreport. * * This method is synchronized with {@code #startProtoLog(PrintWriter)} and * {@link #stopProtoLog(PrintWriter, boolean)}. */ public void writeProtoLogToFile() { synchronized (mProtoLogEnabledLock) { writeProtoLogToFileLocked(); } } private void writeProtoLogToFileLocked() { try { long offset = Loading services/core/java/com/android/server/wm/WindowManagerService.java +0 −9 Original line number Diff line number Diff line Loading @@ -273,7 +273,6 @@ import android.window.TaskSnapshot; 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 @@ -529,14 +528,6 @@ 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 services/core/java/com/android/server/wm/WindowTracing.java +31 −26 Original line number Diff line number Diff line Loading @@ -114,15 +114,6 @@ class WindowTracing { * @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 @@ -135,12 +126,35 @@ 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 + "."); } ProtoLogImpl.getSingleInstance().stopProtoLog(pw, true); } /** * Stops the trace and write the current buffer to disk then restart, if it's already running. * @param pw Print writer */ void saveForBugreport(@Nullable PrintWriter pw) { if (IS_USER) { logAndPrintln(pw, "Error: Tracing is not supported on user builds."); return; } synchronized (mEnabledLock) { if (!mEnabled) { return; } mEnabled = mEnabledLockFree = false; logAndPrintln(pw, "Stop tracing to " + mTraceFile + ". Waiting for traces to flush."); writeTraceToFileLocked(); logAndPrintln(pw, "Trace written to " + mTraceFile + "."); ProtoLogImpl.getSingleInstance().stopProtoLog(pw, true); logAndPrintln(pw, "Start tracing to " + mTraceFile + "."); mBuffer.resetBuffer(); mEnabled = mEnabledLockFree = true; ProtoLogImpl.getSingleInstance().startProtoLog(pw); } ProtoLogImpl.getSingleInstance().stopProtoLog(pw, writeToFile); } private void setLogLevel(@WindowTraceLogLevel int logLevel, PrintWriter pw) { Loading Loading @@ -188,6 +202,9 @@ class WindowTracing { case "stop": stopTrace(pw); return 0; case "save-for-bugreport": saveForBugreport(pw); return 0; case "status": logAndPrintln(pw, getStatus()); return 0; Loading Loading @@ -230,6 +247,7 @@ class WindowTracing { pw.println("Window manager trace options:"); pw.println(" start: Start logging"); pw.println(" stop: Stop logging"); pw.println(" save-for-bugreport: Save logging data to file if it's running."); pw.println(" frame: Log trace once per frame"); pw.println(" transaction: Log each transaction"); pw.println(" size: Set the maximum log size (in KB)"); Loading Loading @@ -316,19 +334,6 @@ class WindowTracing { } } /** * Writes the trace buffer to new file for the bugreport. * * This method is synchronized with {@code #startTrace(PrintWriter)} and * {@link #stopTrace(PrintWriter)}. */ void writeTraceToFile() { synchronized (mEnabledLock) { writeTraceToFileLocked(); } ProtoLogImpl.getSingleInstance().writeProtoLogToFile(); } private void logAndPrintln(@Nullable PrintWriter pw, String msg) { Log.i(TAG, msg); if (pw != null) { Loading Loading
core/java/com/android/internal/protolog/BaseProtoLogImpl.java +0 −12 Original line number Diff line number Diff line Loading @@ -359,18 +359,6 @@ public class BaseProtoLogImpl { + "\nLogging definitions loaded: " + mViewerConfig.knownViewerStringsNumber(); } /** * Writes the log buffer to a new file for the bugreport. * * This method is synchronized with {@code #startProtoLog(PrintWriter)} and * {@link #stopProtoLog(PrintWriter, boolean)}. */ public void writeProtoLogToFile() { synchronized (mProtoLogEnabledLock) { writeProtoLogToFileLocked(); } } private void writeProtoLogToFileLocked() { try { long offset = Loading
services/core/java/com/android/server/wm/WindowManagerService.java +0 −9 Original line number Diff line number Diff line Loading @@ -273,7 +273,6 @@ import android.window.TaskSnapshot; 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 @@ -529,14 +528,6 @@ 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
services/core/java/com/android/server/wm/WindowTracing.java +31 −26 Original line number Diff line number Diff line Loading @@ -114,15 +114,6 @@ class WindowTracing { * @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 @@ -135,12 +126,35 @@ 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 + "."); } ProtoLogImpl.getSingleInstance().stopProtoLog(pw, true); } /** * Stops the trace and write the current buffer to disk then restart, if it's already running. * @param pw Print writer */ void saveForBugreport(@Nullable PrintWriter pw) { if (IS_USER) { logAndPrintln(pw, "Error: Tracing is not supported on user builds."); return; } synchronized (mEnabledLock) { if (!mEnabled) { return; } mEnabled = mEnabledLockFree = false; logAndPrintln(pw, "Stop tracing to " + mTraceFile + ". Waiting for traces to flush."); writeTraceToFileLocked(); logAndPrintln(pw, "Trace written to " + mTraceFile + "."); ProtoLogImpl.getSingleInstance().stopProtoLog(pw, true); logAndPrintln(pw, "Start tracing to " + mTraceFile + "."); mBuffer.resetBuffer(); mEnabled = mEnabledLockFree = true; ProtoLogImpl.getSingleInstance().startProtoLog(pw); } ProtoLogImpl.getSingleInstance().stopProtoLog(pw, writeToFile); } private void setLogLevel(@WindowTraceLogLevel int logLevel, PrintWriter pw) { Loading Loading @@ -188,6 +202,9 @@ class WindowTracing { case "stop": stopTrace(pw); return 0; case "save-for-bugreport": saveForBugreport(pw); return 0; case "status": logAndPrintln(pw, getStatus()); return 0; Loading Loading @@ -230,6 +247,7 @@ class WindowTracing { pw.println("Window manager trace options:"); pw.println(" start: Start logging"); pw.println(" stop: Stop logging"); pw.println(" save-for-bugreport: Save logging data to file if it's running."); pw.println(" frame: Log trace once per frame"); pw.println(" transaction: Log each transaction"); pw.println(" size: Set the maximum log size (in KB)"); Loading Loading @@ -316,19 +334,6 @@ class WindowTracing { } } /** * Writes the trace buffer to new file for the bugreport. * * This method is synchronized with {@code #startTrace(PrintWriter)} and * {@link #stopTrace(PrintWriter)}. */ void writeTraceToFile() { synchronized (mEnabledLock) { writeTraceToFileLocked(); } ProtoLogImpl.getSingleInstance().writeProtoLogToFile(); } private void logAndPrintln(@Nullable PrintWriter pw, String msg) { Log.i(TAG, msg); if (pw != null) { Loading