Skip to content

Commit 9c377bd

Browse files
sganovAndroid Git Automerger
authored andcommitted
am 481a0aa: am 88ae2e2: am d9c9912: Merge "Incorrect temporary detach of accessibility focused view may lead to a crash." into jb-mr1-dev
* commit '481a0aac1f28233854ead339f0c9697eb1286653': Incorrect temporary detach of accessibility focused view may lead to a crash.
2 parents dde8e78 + 481a0aa commit 9c377bd

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
@@ -4006,7 +4006,6 @@ protected void attachViewToParent(View child, int index, LayoutParams params) {
40064006
* @see #removeDetachedView(View, boolean)
40074007
*/
40084008
protected void detachViewFromParent(View child) {
4009-
child.clearAccessibilityFocus();
40104009
removeFromArray(indexOfChild(child));
40114010
}
40124011

@@ -4028,7 +4027,6 @@ protected void detachViewFromParent(View child) {
40284027
* @see #removeDetachedView(View, boolean)
40294028
*/
40304029
protected void detachViewFromParent(int index) {
4031-
getChildAt(index).clearAccessibilityFocus();
40324030
removeFromArray(index);
40334031
}
40344032

core/java/android/view/ViewRootImpl.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2382,7 +2382,13 @@ private void drawAccessibilityFocusedDrawableIfNeeded(Canvas canvas) {
23822382
mAccessibilityFocusedHost.getDrawingRect(bounds);
23832383
if (mView instanceof ViewGroup) {
23842384
ViewGroup viewGroup = (ViewGroup) mView;
2385-
viewGroup.offsetDescendantRectToMyCoords(mAccessibilityFocusedHost, bounds);
2385+
try {
2386+
viewGroup.offsetDescendantRectToMyCoords(mAccessibilityFocusedHost, bounds);
2387+
} catch (IllegalArgumentException iae) {
2388+
Log.e(TAG, "Temporary detached view that was neither removed not reattached: "
2389+
+ mAccessibilityFocusedHost);
2390+
return;
2391+
}
23862392
}
23872393
} else {
23882394
if (mAccessibilityFocusedVirtualView == null) {

0 commit comments

Comments
 (0)