Merge "Save transition trace in bugreports" into udc-dev

This commit is contained in:
Pablo Gamito
2023-04-03 10:07:42 +00:00
committed by Android (Google) Code Review
3 changed files with 23 additions and 0 deletions

View File

@@ -108,8 +108,10 @@ public class BugreportManagerTest {
Paths.get("/data/misc/wmtrace/ime_trace_managerservice.winscope"),
Paths.get("/data/misc/wmtrace/ime_trace_service.winscope"),
Paths.get("/data/misc/wmtrace/wm_trace.winscope"),
Paths.get("/data/misc/wmtrace/wm_log.winscope"),
Paths.get("/data/misc/wmtrace/layers_trace.winscope"),
Paths.get("/data/misc/wmtrace/transactions_trace.winscope"),
Paths.get("/data/misc/wmtrace/transition_trace.winscope"),
};
private static final Path[] UI_TRACES_GENERATED_DURING_BUGREPORT = {
Paths.get("/data/misc/wmtrace/layers_trace_from_transactions.winscope"),

View File

@@ -365,6 +365,24 @@ public class TransitionTracer {
Trace.endSection();
}
/**
* Being called while taking a bugreport so that tracing files can be included in the bugreport.
*
* @param pw Print writer
*/
public void saveForBugreport(@Nullable PrintWriter pw) {
if (IS_USER) {
LogAndPrintln.e(pw, "Tracing is not supported on user builds.");
return;
}
Trace.beginSection("TransitionTracer#saveForBugreport");
synchronized (mEnabledLock) {
final File outputFile = new File(TRACE_FILE);
writeTraceToFileLocked(pw, outputFile);
}
Trace.endSection();
}
boolean isActiveTracingEnabled() {
return mActiveTracingEnabled;
}

View File

@@ -1301,6 +1301,9 @@ public class WindowManagerShellCommand extends ShellCommand {
case "stop":
mInternal.mTransitionTracer.stopTrace(pw);
break;
case "save-for-bugreport":
mInternal.mTransitionTracer.saveForBugreport(pw);
break;
default:
getErrPrintWriter()
.println("Error: expected 'start' or 'stop', but got '" + arg + "'");