From 4d9d0fd7c04dda3c0f111a4efe7908cfed88c3c1 Mon Sep 17 00:00:00 2001 From: Pablo Gamito Date: Thu, 27 Apr 2023 15:07:09 +0000 Subject: [PATCH] Make sure no handlers have id = 0 Otherwise the proto parser complains that a required field is missing since 0 or missing is equivalent when dump to proto Test: load these traces in Winscope where the proto parser complains about this Bug: 277181336 Change-Id: I39dc1ca5506a18dd4f6931510808d7ba89927a93 --- .../Shell/src/com/android/wm/shell/transition/Tracer.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/transition/Tracer.java b/libs/WindowManager/Shell/src/com/android/wm/shell/transition/Tracer.java index 9d7c39f1c90e3..ba364f8a6e598 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/transition/Tracer.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/transition/Tracer.java @@ -73,7 +73,8 @@ public class Tracer implements ShellCommandHandler.ShellCommandActionHandler { if (mHandlerIds.containsKey(handler)) { handlerId = mHandlerIds.get(handler); } else { - handlerId = mHandlerIds.size(); + // + 1 to avoid 0 ids which can be confused with missing value when dumped to proto + handlerId = mHandlerIds.size() + 1; mHandlerIds.put(handler, handlerId); }