From 8d0739da7ff6589101f1dc2d5f579f3bfdefd3b4 Mon Sep 17 00:00:00 2001 From: Svetoslav Ganov Date: Fri, 5 Oct 2012 17:26:38 -0700 Subject: [PATCH] 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 --- core/java/android/view/ViewGroup.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java index db1c00aeccd25..726fa28f2ee3b 100644 --- a/core/java/android/view/ViewGroup.java +++ b/core/java/android/view/ViewGroup.java @@ -3912,6 +3912,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager * @see #removeDetachedView(View, boolean) */ protected void detachViewFromParent(View child) { + child.clearAccessibilityFocus(); removeFromArray(indexOfChild(child)); } @@ -3933,6 +3934,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager * @see #removeDetachedView(View, boolean) */ protected void detachViewFromParent(int index) { + getChildAt(index).clearAccessibilityFocus(); removeFromArray(index); }