Skip to content

Commit d9c9912

Browse files
sganovAndroid (Google) Code Review
authored andcommitted
Merge "Incorrect temporary detach of accessibility focused view may lead to a crash." into jb-mr1-dev
2 parents 4d12d5b + c886060 commit d9c9912

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

core/java/android/view/ViewGroup.java

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

@@ -3934,7 +3933,6 @@ protected void detachViewFromParent(View child) {
39343933
* @see #removeDetachedView(View, boolean)
39353934
*/
39363935
protected void detachViewFromParent(int index) {
3937-
getChildAt(index).clearAccessibilityFocus();
39383936
removeFromArray(index);
39393937
}
39403938

core/java/android/view/ViewRootImpl.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2322,7 +2322,13 @@ private void drawAccessibilityFocusedDrawableIfNeeded(Canvas canvas) {
23222322
mAccessibilityFocusedHost.getDrawingRect(bounds);
23232323
if (mView instanceof ViewGroup) {
23242324
ViewGroup viewGroup = (ViewGroup) mView;
2325-
viewGroup.offsetDescendantRectToMyCoords(mAccessibilityFocusedHost, bounds);
2325+
try {
2326+
viewGroup.offsetDescendantRectToMyCoords(mAccessibilityFocusedHost, bounds);
2327+
} catch (IllegalArgumentException iae) {
2328+
Log.e(TAG, "Temporary detached view that was neither removed not reattached: "
2329+
+ mAccessibilityFocusedHost);
2330+
return;
2331+
}
23262332
}
23272333
} else {
23282334
if (mAccessibilityFocusedVirtualView == null) {

0 commit comments

Comments
 (0)