Loading core/java/android/view/inputmethod/BaseInputConnection.java +6 −1 Original line number Original line Diff line number Diff line Loading @@ -608,7 +608,12 @@ public class BaseInputConnection implements InputConnection { Preconditions.checkArgumentNonnegative(afterLength); Preconditions.checkArgumentNonnegative(afterLength); final Editable content = getEditable(); final Editable content = getEditable(); if (content == null) return null; // If {@link #getEditable()} is null or {@code mEditable} is equal to {@link #getEditable()} // (a.k.a, a fake editable), it means we cannot get valid content from the editable, so // fallback to retrieve surrounding text from other APIs. if (content == null || mEditable == content) { return InputConnection.super.getSurroundingText(beforeLength, afterLength, flags); } int selStart = Selection.getSelectionStart(content); int selStart = Selection.getSelectionStart(content); int selEnd = Selection.getSelectionEnd(content); int selEnd = Selection.getSelectionEnd(content); Loading core/java/android/view/inputmethod/InputConnection.java +5 −5 Original line number Original line Diff line number Diff line Loading @@ -325,16 +325,16 @@ public interface InputConnection { CharSequence textBeforeCursor = getTextBeforeCursor(beforeLength, flags); CharSequence textBeforeCursor = getTextBeforeCursor(beforeLength, flags); if (textBeforeCursor == null) { if (textBeforeCursor == null) { textBeforeCursor = ""; return null; } CharSequence textAfterCursor = getTextAfterCursor(afterLength, flags); if (textAfterCursor == null) { return null; } } CharSequence selectedText = getSelectedText(flags); CharSequence selectedText = getSelectedText(flags); if (selectedText == null) { if (selectedText == null) { selectedText = ""; selectedText = ""; } } CharSequence textAfterCursor = getTextAfterCursor(afterLength, flags); if (textAfterCursor == null) { textAfterCursor = ""; } CharSequence surroundingText = CharSequence surroundingText = TextUtils.concat(textBeforeCursor, selectedText, textAfterCursor); TextUtils.concat(textBeforeCursor, selectedText, textAfterCursor); return new SurroundingText(surroundingText, textBeforeCursor.length(), return new SurroundingText(surroundingText, textBeforeCursor.length(), Loading Loading
core/java/android/view/inputmethod/BaseInputConnection.java +6 −1 Original line number Original line Diff line number Diff line Loading @@ -608,7 +608,12 @@ public class BaseInputConnection implements InputConnection { Preconditions.checkArgumentNonnegative(afterLength); Preconditions.checkArgumentNonnegative(afterLength); final Editable content = getEditable(); final Editable content = getEditable(); if (content == null) return null; // If {@link #getEditable()} is null or {@code mEditable} is equal to {@link #getEditable()} // (a.k.a, a fake editable), it means we cannot get valid content from the editable, so // fallback to retrieve surrounding text from other APIs. if (content == null || mEditable == content) { return InputConnection.super.getSurroundingText(beforeLength, afterLength, flags); } int selStart = Selection.getSelectionStart(content); int selStart = Selection.getSelectionStart(content); int selEnd = Selection.getSelectionEnd(content); int selEnd = Selection.getSelectionEnd(content); Loading
core/java/android/view/inputmethod/InputConnection.java +5 −5 Original line number Original line Diff line number Diff line Loading @@ -325,16 +325,16 @@ public interface InputConnection { CharSequence textBeforeCursor = getTextBeforeCursor(beforeLength, flags); CharSequence textBeforeCursor = getTextBeforeCursor(beforeLength, flags); if (textBeforeCursor == null) { if (textBeforeCursor == null) { textBeforeCursor = ""; return null; } CharSequence textAfterCursor = getTextAfterCursor(afterLength, flags); if (textAfterCursor == null) { return null; } } CharSequence selectedText = getSelectedText(flags); CharSequence selectedText = getSelectedText(flags); if (selectedText == null) { if (selectedText == null) { selectedText = ""; selectedText = ""; } } CharSequence textAfterCursor = getTextAfterCursor(afterLength, flags); if (textAfterCursor == null) { textAfterCursor = ""; } CharSequence surroundingText = CharSequence surroundingText = TextUtils.concat(textBeforeCursor, selectedText, textAfterCursor); TextUtils.concat(textBeforeCursor, selectedText, textAfterCursor); return new SurroundingText(surroundingText, textBeforeCursor.length(), return new SurroundingText(surroundingText, textBeforeCursor.length(), Loading