Ensure a11y ids for LabeledSeekBar are in bounds

Bug: 64124736
Test: I just played with it with TalkBack on. The crash
was difficult to reproduce before, and I can't make it
fail now. I believe I got it.

Change-Id: I17ffe8d83e21e716d1c0cadea52afcf09bff6e97
This commit is contained in:
Phil Weaver
2017-07-28 11:05:40 -07:00
parent bd891f5813
commit 54ee713dfb

View File

@@ -201,6 +201,7 @@ public class LabeledSeekBar extends SeekBar {
int posBase = Math.max(0,
((int) x - LabeledSeekBar.this.getPaddingStart()) / getHalfVirtualViewWidth());
posBase = (posBase + 1) / 2;
posBase = Math.min(posBase, LabeledSeekBar.this.getMax());
return mIsLayoutRtl ? LabeledSeekBar.this.getMax() - posBase : posBase;
}