summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Maryam Dehaini <mdehaini@google.com> 2023-11-22 00:03:10 -0800
committer Maryam Dehaini <mdehaini@google.com> 2023-11-22 00:10:27 -0800
commit1a2061e54e383fe8f005feecebe9d255452c8898 (patch)
treedb88c04aa8c7230f85e452f27d442acdae84d0d8
parent5cd1f906dce40b1957d95c2b4c0079c1a1860c28 (diff)
Add null check to offsetCaptionLocation
There is currently a bug that is causing window decorations to exist even after the task they belong to has been deleted. This is causing a null pointer exception here since we are searching for the TaskInfo of an already deleted task using TaskOrganizer#getRunningTaskInfo which causes it to return null. Bug: 311273642 Test: Move task around and change windowing modes to make sure SysUi is no longer crashing Change-Id: I4972f041d36e345a40a026bdfc4c4077ff13dfe0
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecoration.java6
1 files changed, 4 insertions, 2 deletions
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecoration.java b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecoration.java
index e1d177af2331..6ec91e0e28dd 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecoration.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecoration.java
@@ -548,8 +548,10 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin
*/
private PointF offsetCaptionLocation(MotionEvent ev) {
final PointF result = new PointF(ev.getX(), ev.getY());
- final Point positionInParent = mTaskOrganizer.getRunningTaskInfo(mTaskInfo.taskId)
- .positionInParent;
+ final ActivityManager.RunningTaskInfo taskInfo =
+ mTaskOrganizer.getRunningTaskInfo(mTaskInfo.taskId);
+ if (taskInfo == null) return result;
+ final Point positionInParent = taskInfo.positionInParent;
result.offset(-mRelayoutParams.mCaptionX, -mRelayoutParams.mCaptionY);
result.offset(-positionInParent.x, -positionInParent.y);
return result;