From 386e618c5c0fc05f359fd7284c50a99619c07396 Mon Sep 17 00:00:00 2001 From: Nataniel Borges Date: Wed, 29 Sep 2021 16:00:54 +0200 Subject: [PATCH] Fix parsing of WM trace in critical mode When tracing WM in critical mode, the children object is not always assigned and this previously crashed the WM trace parsing in winscope. Fix the WM trace parsing by assuming all null children as empty arrays Test: run winscope, collect critical trace, open critical trace in winscope Change-Id: I108c0725f3e9a27f45fda790d411614e0ab988bf --- services/core/java/com/android/server/wm/DisplayArea.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/services/core/java/com/android/server/wm/DisplayArea.java b/services/core/java/com/android/server/wm/DisplayArea.java index 98757f095a85b..7485a1e7d3ddf 100644 --- a/services/core/java/com/android/server/wm/DisplayArea.java +++ b/services/core/java/com/android/server/wm/DisplayArea.java @@ -272,6 +272,10 @@ public class DisplayArea extends WindowContainer { @Override public void dumpDebug(ProtoOutputStream proto, long fieldId, int logLevel) { + if (logLevel == WindowTraceLogLevel.CRITICAL && !isVisible()) { + return; + } + final long token = proto.start(fieldId); super.dumpDebug(proto, WINDOW_CONTAINER, logLevel); proto.write(NAME, mName);