Add API for writing WM trace to file

Currently the API supports only starting or stopping the trace, and writes to file when the trace is stopped. However, in some scenarios we would like to maintain the trace active, and just dump the trace.

Bug: 205138504
Test: all API, check if files are created under /data/misc/wmtrace
Change-Id: Ia1d38ebcfd5a9d45e25bc7a29146aca54d4bdaf3
This commit is contained in:
Nataniel Borges
2022-01-21 12:05:27 +01:00
parent 86608e36b0
commit d9edbe7a50
2 changed files with 10 additions and 0 deletions

View File

@@ -550,6 +550,11 @@ interface IWindowManager
*/
void stopWindowTrace();
/**
* If window tracing is active, saves the window trace to file, otherwise does nothing
*/
void saveWindowTraceToFile();
/**
* Returns true if window trace is enabled.
*/

View File

@@ -5680,6 +5680,11 @@ public class WindowManagerService extends IWindowManager.Stub
mWindowTracing.stopTrace(null /* printwriter */);
}
@Override
public void saveWindowTraceToFile() {
mWindowTracing.saveForBugreport(null /* printwriter */);
}
@Override
public boolean isWindowTraceEnabled() {
return mWindowTracing.isEnabled();