From 9ad4a5520d629b662332b3b40f239111d51f9b99 Mon Sep 17 00:00:00 2001 From: Jeff DeCew Date: Fri, 11 Jun 2021 09:59:57 -0400 Subject: [PATCH] Prevent exception when temporarily detaching the RemoteInputView's EditText. Fixes: 187195960 Test: unable to repro crash, either before or after the fix. :/ Change-Id: I9a97df5e77fc9173ca9ae4416986f979b41d564b --- .../android/systemui/statusbar/policy/RemoteInputView.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 7022fb13d2cd9..6c61e205c6325 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/RemoteInputView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/RemoteInputView.java @@ -749,7 +749,10 @@ public class RemoteInputView extends LinearLayout implements View.OnClickListene super.dispatchStartTemporaryDetach(); // Detach the EditText temporarily such that it doesn't get onDetachedFromWindow and // won't lose IME focus. - detachViewFromParent(mEditText); + final int iEditText = indexOfChild(mEditText); + if (iEditText != -1) { + detachViewFromParent(iEditText); + } } @Override