From 961bf0e9b4ef94f52ae66856ac573995f1f34578 Mon Sep 17 00:00:00 2001 From: Svetoslav Ganov Date: Tue, 8 May 2012 09:40:03 -0700 Subject: Accessibility focus on temporary detached view not cleared. 1. When a view that has accessibility focus is temporary detached we try to draw the focus highlight and crash. Since the detached view will be modified and then either attached or detached from the window we should not keep accessibility focus on a temporary detached view. Otherwise, we may have a scenario where the user thinks he is in one item scroll acound and being in completely different item because of the view being recycled but the user has no clue. 2. Clearing accessibility focus when the view is removed from the parent as opposed as when it is detached from the window. Since we may have transitioning views for removal we do not want accessibility focus on such views during the anumation. bug:6457339 Change-Id: I62287a089ec6850fb1d691ae26dea54e1da39c94 --- core/java/android/view/View.java | 2 +- core/java/android/view/ViewGroup.java | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index 2972774ff86f..4d2bc42a141d 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -6665,6 +6665,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * @hide */ public void dispatchStartTemporaryDetach() { + clearAccessibilityFocus(); onStartTemporaryDetach(); } @@ -11279,7 +11280,6 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal resetResolvedLayoutDirection(); resetResolvedTextAlignment(); resetAccessibilityStateChanged(); - clearAccessibilityFocus(); } /** diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java index 29613d557039..acfca26db219 100644 --- a/core/java/android/view/ViewGroup.java +++ b/core/java/android/view/ViewGroup.java @@ -3586,6 +3586,8 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager clearChildFocus = true; } + view.clearAccessibilityFocus(); + cancelTouchTarget(view); cancelHoverTarget(view); @@ -3669,6 +3671,8 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager clearChildFocus = view; } + view.clearAccessibilityFocus(); + cancelTouchTarget(view); cancelHoverTarget(view); @@ -3742,6 +3746,8 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager clearChildFocus = view; } + view.clearAccessibilityFocus(); + cancelTouchTarget(view); cancelHoverTarget(view); @@ -3790,6 +3796,8 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager child.clearFocus(); } + child.clearAccessibilityFocus(); + cancelTouchTarget(child); cancelHoverTarget(child); -- cgit v1.2.3-59-g8ed1b