From dd4f6314cc35547f510066a9eb0a0b8430407a1f Mon Sep 17 00:00:00 2001 From: Jeffrey Huang Date: Tue, 4 May 2021 16:32:39 -0700 Subject: [PATCH] Fix InvalidProtoWireException The NPE here would catch in the outer try-catch causing the end object token to not be written by ProtoOutputStream Bug: 187098431 Test: atest IncidentdTest#testIncidentReportDumpLocal Change-Id: I65fb92c077e246aaf2ae902b545fea38dd667e25 --- .../java/com/android/server/notification/ZenModeHelper.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/notification/ZenModeHelper.java b/services/core/java/com/android/server/notification/ZenModeHelper.java index fcee63c62ae80..4cb6c3ba20d8c 100644 --- a/services/core/java/com/android/server/notification/ZenModeHelper.java +++ b/services/core/java/com/android/server/notification/ZenModeHelper.java @@ -659,7 +659,8 @@ public class ZenModeHelper { mConfig.manualRule.dumpDebug(proto, ZenModeProto.ENABLED_ACTIVE_CONDITIONS); } for (ZenRule rule : mConfig.automaticRules.values()) { - if (rule.enabled && rule.condition.state == Condition.STATE_TRUE + if (rule.enabled && rule.condition != null + && rule.condition.state == Condition.STATE_TRUE && !rule.snoozing) { rule.dumpDebug(proto, ZenModeProto.ENABLED_ACTIVE_CONDITIONS); }