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 b17028b05f787..efeeac6694917 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