Merge "Guarding against null pointer exception when setting view structure info for content capture" into sc-dev am: 59fe064d75
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15067633 Change-Id: I44029be8fb1c54fcda0915274684be4952341581
This commit is contained in:
@@ -11854,6 +11854,8 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
|
|||||||
|
|
||||||
// Get the text and trim it to the range we are reporting.
|
// Get the text and trim it to the range we are reporting.
|
||||||
CharSequence text = getText();
|
CharSequence text = getText();
|
||||||
|
|
||||||
|
if (text != null) {
|
||||||
if (expandedTopChar > 0 || expandedBottomChar < text.length()) {
|
if (expandedTopChar > 0 || expandedBottomChar < text.length()) {
|
||||||
text = text.subSequence(expandedTopChar, expandedBottomChar);
|
text = text.subSequence(expandedTopChar, expandedBottomChar);
|
||||||
}
|
}
|
||||||
@@ -11861,7 +11863,9 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
|
|||||||
if (viewFor == VIEW_STRUCTURE_FOR_AUTOFILL) {
|
if (viewFor == VIEW_STRUCTURE_FOR_AUTOFILL) {
|
||||||
structure.setText(text);
|
structure.setText(text);
|
||||||
} else {
|
} else {
|
||||||
structure.setText(text, selStart - expandedTopChar, selEnd - expandedTopChar);
|
structure.setText(text,
|
||||||
|
selStart - expandedTopChar,
|
||||||
|
selEnd - expandedTopChar);
|
||||||
|
|
||||||
final int[] lineOffsets = new int[bottomLine - topLine + 1];
|
final int[] lineOffsets = new int[bottomLine - topLine + 1];
|
||||||
final int[] lineBaselines = new int[bottomLine - topLine + 1];
|
final int[] lineBaselines = new int[bottomLine - topLine + 1];
|
||||||
@@ -11873,6 +11877,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
|
|||||||
structure.setTextLines(lineOffsets, lineBaselines);
|
structure.setTextLines(lineOffsets, lineBaselines);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (viewFor == VIEW_STRUCTURE_FOR_ASSIST
|
if (viewFor == VIEW_STRUCTURE_FOR_ASSIST
|
||||||
|| viewFor == VIEW_STRUCTURE_FOR_CONTENT_CAPTURE) {
|
|| viewFor == VIEW_STRUCTURE_FOR_CONTENT_CAPTURE) {
|
||||||
|
|||||||
Reference in New Issue
Block a user