diff options
author | Alan Viverette <alanv@google.com> | 2013-05-07 17:17:35 -0700 |
---|---|---|
committer | Alan Viverette <alanv@google.com> | 2013-05-07 17:17:35 -0700 |
commit | 239a0c0e6a6fc36025fdb1c662e1c7acaec144bb (patch) | |
tree | 5d037d2192a4e1e12779c6ffd086203742d4d5c2 | |
parent | 81a8bb1ca9df314faf6de09cc2da0a1db70c7391 (diff) | |
download | frameworks_base-239a0c0e6a6fc36025fdb1c662e1c7acaec144bb.zip frameworks_base-239a0c0e6a6fc36025fdb1c662e1c7acaec144bb.tar.gz frameworks_base-239a0c0e6a6fc36025fdb1c662e1c7acaec144bb.tar.bz2 |
Ensure ViewRootImpl.setAccessibilityFocus() doesn't crash when reentrant.
Internal state must be cleared before calling any methods on the focus
host, since the method may be called again from the host and attempt to
recycle the same AccessibilityNodeInfo twice.
BUG: 8856860
Change-Id: I0410989fd6f3ce3ce29de8edebdfbf3847188843
-rw-r--r-- | core/java/android/view/ViewRootImpl.java | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java index 7ecb52e..3862c32 100644 --- a/core/java/android/view/ViewRootImpl.java +++ b/core/java/android/view/ViewRootImpl.java @@ -2709,7 +2709,6 @@ public final class ViewRootImpl implements ViewParent, AccessibilityNodeInfo focusNode = mAccessibilityFocusedVirtualView; View focusHost = mAccessibilityFocusedHost; - focusHost.clearAccessibilityFocusNoCallbacks(); // Wipe the state of the current accessibility focus since // the call into the provider to clear accessibility focus @@ -2719,6 +2718,10 @@ public final class ViewRootImpl implements ViewParent, mAccessibilityFocusedHost = null; mAccessibilityFocusedVirtualView = null; + // Clear accessibility focus on the host after clearing state since + // this method may be reentrant. + focusHost.clearAccessibilityFocusNoCallbacks(); + AccessibilityNodeProvider provider = focusHost.getAccessibilityNodeProvider(); if (provider != null) { // Invalidate the area of the cleared accessibility focus. |