am 65bce4ca: Merge "Never pass negative values to setSelection."

* commit '65bce4cabc9d1a1e8087e9769311ac00f3888d0e':
  Never pass negative values to setSelection.
main
Jean Chalard 2014-02-24 05:57:13 -08:00 committed by Android Git Automerger
commit 94393f057f
1 changed files with 6 additions and 2 deletions

View File

@ -483,12 +483,16 @@ public final class RichInputConnection {
* *
* @param start the character index where the selection should start. * @param start the character index where the selection should start.
* @param end the character index where the selection should end. * @param end the character index where the selection should end.
* @return Returns true on success, false if the input connection is no longer valid either when * @return Returns true on success, false on failure: either the input connection is no longer
* setting the selection or when retrieving the text cache at that point. * valid when setting the selection or when retrieving the text cache at that point, or
* invalid arguments were passed.
*/ */
public boolean setSelection(final int start, final int end) { public boolean setSelection(final int start, final int end) {
if (DEBUG_BATCH_NESTING) checkBatchEdit(); if (DEBUG_BATCH_NESTING) checkBatchEdit();
if (DEBUG_PREVIOUS_TEXT) checkConsistencyForDebug(); if (DEBUG_PREVIOUS_TEXT) checkConsistencyForDebug();
if (start < 0 || end < 0) {
return false;
}
mExpectedSelStart = start; mExpectedSelStart = start;
mExpectedSelEnd = end; mExpectedSelEnd = end;
if (null != mIC) { if (null != mIC) {