diff options
| author | 2024-12-16 16:20:23 +0800 | |
|---|---|---|
| committer | 2024-12-16 20:50:57 +0800 | |
| commit | d20a111ddc60ba1a5c61d13425e99e34091e6871 (patch) | |
| tree | 5fda42e192b87f450e8a05be2338d06251a4fe0d | |
| parent | 2daef7f6cf3ab06149a0fd6aa63b06554c9c4e60 (diff) | |
RecentTasks:fix NPE problem to avoid system_server process crash.
It is possible for a task.getBaseIntent() method call to return a null object, so it is necessary to determine whether it is null before calling it
Test: atest
Bug: 384431818
Change-Id: Id4d9ad2addba4f0a7f298b6d752b3c4ed14b422a
| -rw-r--r-- | services/core/java/com/android/server/wm/RecentTasks.java | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/services/core/java/com/android/server/wm/RecentTasks.java b/services/core/java/com/android/server/wm/RecentTasks.java index 9da848aa05d8..9cde39783b7f 100644 --- a/services/core/java/com/android/server/wm/RecentTasks.java +++ b/services/core/java/com/android/server/wm/RecentTasks.java @@ -1488,9 +1488,9 @@ class RecentTasks { boolean skipExcludedCheck) { if (!skipExcludedCheck) { // Keep the most recent task of home display even if it is excluded from recents. - final boolean isExcludeFromRecents = - (task.getBaseIntent().getFlags() & FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS) - == FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS; + final boolean isExcludeFromRecents = task.getBaseIntent() != null + && (task.getBaseIntent().getFlags() & FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS) + == FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS; if (isExcludeFromRecents) { if (DEBUG_RECENTS_TRIM_TASKS) { Slog.d(TAG, |