From 5b002e03f4c5c38b8fc0e5969210a8748b6d5657 Mon Sep 17 00:00:00 2001 From: Julia Tuttle Date: Fri, 1 Apr 2022 15:42:36 -0400 Subject: [PATCH] RemoteInputView: Add null check in WindowInsetsAnimation.Callback We're seeing a rare but consistent crash here, so add a null check and log an error. Ideally we'll get a repro case and find a root cause, but this will mitigate the crash for now. Bug: 219371276 Test: none, since we have no repro case Change-Id: Ia8152f854c8d4fb8a85e221ffa1c781c2923cf40 --- .../systemui/statusbar/policy/RemoteInputView.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/RemoteInputView.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/RemoteInputView.java index 006edcaf41de4..ea423ce7020be 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/RemoteInputView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/RemoteInputView.java @@ -264,8 +264,12 @@ public class RemoteInputView extends LinearLayout implements View.OnClickListene super.onEnd(animation); if (animation.getTypeMask() == WindowInsets.Type.ime()) { mEntry.mRemoteEditImeAnimatingAway = false; - mEntry.mRemoteEditImeVisible = - mEditText.getRootWindowInsets().isVisible(WindowInsets.Type.ime()); + WindowInsets editTextRootWindowInsets = mEditText.getRootWindowInsets(); + if (editTextRootWindowInsets == null) { + Log.w(TAG, "onEnd called on detached view", new Exception()); + } + mEntry.mRemoteEditImeVisible = editTextRootWindowInsets != null + && editTextRootWindowInsets.isVisible(WindowInsets.Type.ime()); if (!mEntry.mRemoteEditImeVisible && !mEditText.mShowImeOnInputConnection) { mController.removeRemoteInput(mEntry, mToken); }