summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Riddle Hsu <riddlehsu@google.com> 2021-05-31 12:40:07 +0800
committer Riddle Hsu <riddlehsu@google.com> 2021-05-31 12:40:07 +0800
commit7fe18ea17d1e0759424dd7eaa2586b4219504aea (patch)
treeb779f84cb83008f12b904e01478ae5e8ac677c0c
parent0a40c03eb1a0583c7cac687d679d281683fae293 (diff)
Prevent potential NPE of checking task drawn for logger
The place is only called from: 1. notifyActivityLaunched (more likely) The activity must be launched successfully so ideally its task shouldn't be null. 2. notifyVisibilityChanged The only caller (setVisibility) has checked non-null parent (task). Still add a simple check for the unknown case. Bug: 189540136 Test: ActivityMetricsLaunchObserverTests Change-Id: Iae4a3ad1ae35f1a206d5cf47c7e41e0013aa5077
-rw-r--r--services/core/java/com/android/server/wm/ActivityMetricsLogger.java2
1 files changed, 1 insertions, 1 deletions
diff --git a/services/core/java/com/android/server/wm/ActivityMetricsLogger.java b/services/core/java/com/android/server/wm/ActivityMetricsLogger.java
index e1b7dd3a081b..98d02776fb30 100644
--- a/services/core/java/com/android/server/wm/ActivityMetricsLogger.java
+++ b/services/core/java/com/android/server/wm/ActivityMetricsLogger.java
@@ -790,7 +790,7 @@ class ActivityMetricsLogger {
// window drawn event should report later to complete the transition. Otherwise all
// activities in this task may be finished, invisible or drawn, so the transition event
// should be cancelled.
- if (t.forAllActivities(
+ if (t != null && t.forAllActivities(
a -> a.mVisibleRequested && !a.isReportedDrawn() && !a.finishing)) {
return;
}