Fix for bug 7358703 Gmail ANR when trying to compose a message
When deferring scroll to a point, it's possible the text changed between the time the scroll was requested to the time layout happens. In this case, it attempts to scroll to a point past the end of the text buffer, which created an infinite loop. This patch clamps the scroll offset to the length of the text, so it just scrolls to the end in that case, rather than crashing. Change-Id: I53740d119d588560f5a4d9fb80e38f7057faab89
This commit is contained in:
committed by
The Android Automerger
parent
1ce43222a5
commit
1b2415fbdf
@@ -6321,7 +6321,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
|
||||
if (mDeferScroll >= 0) {
|
||||
int curs = mDeferScroll;
|
||||
mDeferScroll = -1;
|
||||
bringPointIntoView(curs);
|
||||
bringPointIntoView(Math.min(curs, mText.length()));
|
||||
}
|
||||
if (changed && mEditor != null) mEditor.invalidateTextDisplayList();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user