Skip to content

Commit 8d0739d

Browse files
committed
Accessibility focus not cleared on temporary detach.
1. There was a path for removing a view without clearing its accessibility focus. Then when we try to draw the focused rectangle we get an exception since the accessibility focused view is not attached to the view tree when computing the location of the rectangel to draw. bug:7297191 Change-Id: I81e3c35e830e27cf95e73accb665629d0c456afb
1 parent 7ef38ea commit 8d0739d

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

core/java/android/view/ViewGroup.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3912,6 +3912,7 @@ protected void attachViewToParent(View child, int index, LayoutParams params) {
39123912
* @see #removeDetachedView(View, boolean)
39133913
*/
39143914
protected void detachViewFromParent(View child) {
3915+
child.clearAccessibilityFocus();
39153916
removeFromArray(indexOfChild(child));
39163917
}
39173918

@@ -3933,6 +3934,7 @@ protected void detachViewFromParent(View child) {
39333934
* @see #removeDetachedView(View, boolean)
39343935
*/
39353936
protected void detachViewFromParent(int index) {
3937+
getChildAt(index).clearAccessibilityFocus();
39363938
removeFromArray(index);
39373939
}
39383940

0 commit comments

Comments
 (0)