From 97ae10814c7e668670a48ac9e2263f788ebd9fb4 Mon Sep 17 00:00:00 2001 From: Yuncheol Heo Date: Mon, 18 Jan 2021 12:06:04 -0800 Subject: [PATCH] Fix NPE in TaskView. Bug: 177646952 Change-Id: I14c0244e2d4b494491092c09f96bb50d9c2ceaaf --- .../Shell/src/com/android/wm/shell/TaskView.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/TaskView.java b/libs/WindowManager/Shell/src/com/android/wm/shell/TaskView.java index 8d0e9655f28dc..dd4313957f206 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/TaskView.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/TaskView.java @@ -252,7 +252,9 @@ public class TaskView extends SurfaceView implements SurfaceHolder.Callback, mTaskOrganizer.setInterceptBackPressedOnTaskRoot(mTaskToken, true); // TODO: Synchronize show with the resize onLocationChanged(); - setResizeBackgroundColor(taskInfo.taskDescription.getBackgroundColor()); + if (taskInfo.taskDescription != null) { + setResizeBackgroundColor(taskInfo.taskDescription.getBackgroundColor()); + } if (mListener != null) { mListenerExecutor.execute(() -> { @@ -279,8 +281,9 @@ public class TaskView extends SurfaceView implements SurfaceHolder.Callback, @Override public void onTaskInfoChanged(ActivityManager.RunningTaskInfo taskInfo) { - mTaskInfo.taskDescription = taskInfo.taskDescription; - setResizeBackgroundColor(taskInfo.taskDescription.getBackgroundColor()); + if (taskInfo.taskDescription != null) { + setResizeBackgroundColor(taskInfo.taskDescription.getBackgroundColor()); + } } @Override