Merge "Fix crash with a11y set text with text filters." into nyc-dev

am: 7a61d60

* commit '7a61d6031b0ce9de00bfc77caa196396ad1781d5':
  Fix crash with a11y set text with text filters.

Change-Id: I69de849d434f21f736d0a26be153397d00b7295b
This commit is contained in:
Phil Weaver
2016-04-27 16:55:10 +00:00
committed by android-build-merger
2 changed files with 5 additions and 24 deletions

View File

@@ -149,26 +149,4 @@ public class EditText extends TextView {
info.addAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_SET_TEXT);
}
}
/** @hide */
@Override
public boolean performAccessibilityActionInternal(int action, Bundle arguments) {
switch (action) {
case AccessibilityNodeInfo.ACTION_SET_TEXT: {
if (!isEnabled()) {
return false;
}
CharSequence text = (arguments != null) ? arguments.getCharSequence(
AccessibilityNodeInfo.ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE) : null;
setText(text);
if (text != null && text.length() > 0) {
setSelection(text.length());
}
return true;
}
default: {
return super.performAccessibilityActionInternal(action, arguments);
}
}
}
}

View File

@@ -9203,8 +9203,11 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
CharSequence text = (arguments != null) ? arguments.getCharSequence(
AccessibilityNodeInfo.ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE) : null;
setText(text);
if (text != null && text.length() > 0) {
Selection.setSelection((Spannable) mText, text.length());
if (mText != null) {
int updatedTextLength = mText.length();
if (updatedTextLength > 0) {
Selection.setSelection((Spannable) mText, updatedTextLength);
}
}
} return true;
default: {