diff options
| author | Svetoslav Ganov <svetoslavganov@google.com> | 2012-10-05 17:45:06 -0700 |
|---|---|---|
| committer | Svetoslav Ganov <svetoslavganov@google.com> | 2012-10-05 18:47:13 -0700 |
| commit | c8860602726d771c69a3fefedfa03419d1c03b1c (patch) | |
| tree | cd8fb100d975889117b6d6457f60183ca738441f /core/java/android | |
| parent | 8d0739da7ff6589101f1dc2d5f579f3bfdefd3b4 (diff) | |
Incorrect temporary detach of accessibility focused view may lead to a crash.
1. If an app naither reattaches nor removes detached view that has
accessibility focus, an exception in the drawing of accessibility
focus occurs since we are trying to compute the focused rect by
offseting the bounds of the focused view in coords of the root
but the focused one is not attached.
bug:7297191
Change-Id: Ib69d52e474b8ea365754f5311f5e809bd757dd1a
Diffstat (limited to 'core/java/android')
| -rw-r--r-- | core/java/android/view/ViewGroup.java | 2 | ||||
| -rw-r--r-- | core/java/android/view/ViewRootImpl.java | 8 |
2 files changed, 7 insertions, 3 deletions
diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java index 726fa28f2ee3..db1c00aeccd2 100644 --- a/core/java/android/view/ViewGroup.java +++ b/core/java/android/view/ViewGroup.java @@ -3912,7 +3912,6 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager * @see #removeDetachedView(View, boolean) */ protected void detachViewFromParent(View child) { - child.clearAccessibilityFocus(); removeFromArray(indexOfChild(child)); } @@ -3934,7 +3933,6 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager * @see #removeDetachedView(View, boolean) */ protected void detachViewFromParent(int index) { - getChildAt(index).clearAccessibilityFocus(); removeFromArray(index); } diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java index be2d5b3c8add..04752832aea0 100644 --- a/core/java/android/view/ViewRootImpl.java +++ b/core/java/android/view/ViewRootImpl.java @@ -2322,7 +2322,13 @@ public final class ViewRootImpl implements ViewParent, mAccessibilityFocusedHost.getDrawingRect(bounds); if (mView instanceof ViewGroup) { ViewGroup viewGroup = (ViewGroup) mView; - viewGroup.offsetDescendantRectToMyCoords(mAccessibilityFocusedHost, bounds); + try { + viewGroup.offsetDescendantRectToMyCoords(mAccessibilityFocusedHost, bounds); + } catch (IllegalArgumentException iae) { + Log.e(TAG, "Temporary detached view that was neither removed not reattached: " + + mAccessibilityFocusedHost); + return; + } } } else { if (mAccessibilityFocusedVirtualView == null) { |
