Save transition trace in bugreports
Bug: 275331993 Test: adb bugreport Change-Id: If65b355c419a3f303eb8dcc3859f486710bf04cf
This commit is contained in:
@@ -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"),
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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 + "'");
|
||||
|
||||
Reference in New Issue
Block a user