Merge "Fix crash with a11y set text with text filters." into nyc-dev
This commit is contained in:
@@ -149,26 +149,4 @@ public class EditText extends TextView {
|
|||||||
info.addAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_SET_TEXT);
|
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9203,8 +9203,11 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
|
|||||||
CharSequence text = (arguments != null) ? arguments.getCharSequence(
|
CharSequence text = (arguments != null) ? arguments.getCharSequence(
|
||||||
AccessibilityNodeInfo.ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE) : null;
|
AccessibilityNodeInfo.ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE) : null;
|
||||||
setText(text);
|
setText(text);
|
||||||
if (text != null && text.length() > 0) {
|
if (mText != null) {
|
||||||
Selection.setSelection((Spannable) mText, text.length());
|
int updatedTextLength = mText.length();
|
||||||
|
if (updatedTextLength > 0) {
|
||||||
|
Selection.setSelection((Spannable) mText, updatedTextLength);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} return true;
|
} return true;
|
||||||
default: {
|
default: {
|
||||||
|
|||||||
Reference in New Issue
Block a user