From 04b037e07d8930796e76c97096041aef6d7e0ec3 Mon Sep 17 00:00:00 2001 From: Joanne Chung Date: Tue, 22 Feb 2022 20:20:16 +0800 Subject: [PATCH] Fix NPE when calling dispatchTouchEvent in FloatingToolbarRoot Bug: 220328857 Test: manual Change-Id: Ib41e6910e001ecb71c82f12db22b94ef7329a3fd --- .../android/service/selectiontoolbar/FloatingToolbarRoot.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/java/android/service/selectiontoolbar/FloatingToolbarRoot.java b/core/java/android/service/selectiontoolbar/FloatingToolbarRoot.java index 8fe6f71b598da..adc9251d89be6 100644 --- a/core/java/android/service/selectiontoolbar/FloatingToolbarRoot.java +++ b/core/java/android/service/selectiontoolbar/FloatingToolbarRoot.java @@ -40,7 +40,7 @@ public class FloatingToolbarRoot extends LinearLayout { private final IBinder mTargetInputToken; private final SelectionToolbarRenderService.TransferTouchListener mTransferTouchListener; - private Rect mContentRect; + private final Rect mContentRect = new Rect(); private int mLastDownX = -1; private int mLastDownY = -1; @@ -57,7 +57,7 @@ public class FloatingToolbarRoot extends LinearLayout { * Sets the Rect that shows the selection toolbar content. */ public void setContentRect(Rect contentRect) { - mContentRect = contentRect; + mContentRect.set(contentRect); } @Override