Skip to content

Commit b72fe7a

Browse files
committed
Don't overwrite accessibility delegates in AbsListView items.
Bug: 6856579 Change-Id: I2963edcefdc0dd5e1413b57858e6f319904a269d
1 parent ac137b3 commit b72fe7a

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

core/java/android/view/View.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4924,6 +4924,18 @@ && isShown()
49244924
return false;
49254925
}
49264926

4927+
/**
4928+
* Returns the delegate for implementing accessibility support via
4929+
* composition. For more details see {@link AccessibilityDelegate}.
4930+
*
4931+
* @return The delegate, or null if none set.
4932+
*
4933+
* @hide
4934+
*/
4935+
public AccessibilityDelegate getAccessibilityDelegate() {
4936+
return mAccessibilityDelegate;
4937+
}
4938+
49274939
/**
49284940
* Sets a delegate for implementing accessibility support via compositon as
49294941
* opposed to inheritance. The delegate's primary use is for implementing

core/java/android/widget/AbsListView.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2158,7 +2158,9 @@ View obtainView(int position, boolean[] isScrap) {
21582158
if (mAccessibilityDelegate == null) {
21592159
mAccessibilityDelegate = new ListItemAccessibilityDelegate();
21602160
}
2161-
child.setAccessibilityDelegate(mAccessibilityDelegate);
2161+
if (child.getAccessibilityDelegate() == null) {
2162+
child.setAccessibilityDelegate(mAccessibilityDelegate);
2163+
}
21622164
}
21632165

21642166
return child;

0 commit comments

Comments
 (0)