From 9cc9e483e0f6df5eb35af9943d4b70e9bfaf4b27 Mon Sep 17 00:00:00 2001 From: HanWang Date: Wed, 9 Aug 2023 19:54:14 +0800 Subject: [PATCH] Add null pointer judgment processing to prevent restarting When getDisplayArea() is not default display,there will be a null pointer situation, to avoid this situation, a null pointer judgment has been added. Bug:295103280 Test:Stability test Change-Id: I46c1463bab7889ba0395c67b8bd1ffa1148326cf Signed-off-by: HanWang --- services/core/java/com/android/server/wm/Task.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/wm/Task.java b/services/core/java/com/android/server/wm/Task.java index 91c0c6953a9ab..bda0a0f57ed71 100644 --- a/services/core/java/com/android/server/wm/Task.java +++ b/services/core/java/com/android/server/wm/Task.java @@ -5748,7 +5748,7 @@ class Task extends TaskFragment { false /* deferResume */); ActivityRecord topActivity = getDisplayArea().topRunningActivity(); - Task topRootTask = topActivity.getRootTask(); + Task topRootTask = topActivity == null ? null : topActivity.getRootTask(); if (topRootTask != null && topRootTask != this && topActivity.isState(RESUMED)) { // Usually resuming a top activity triggers the next app transition, but nothing's got // resumed in this case, so we need to execute it explicitly.