Merge "ListViewTest: allow custom backgrounds in list items" into android10-tests-dev
diff --git a/tests/tests/widget/src/android/widget/cts/ListViewTest.java b/tests/tests/widget/src/android/widget/cts/ListViewTest.java
index 548bce6..661df06 100644
--- a/tests/tests/widget/src/android/widget/cts/ListViewTest.java
+++ b/tests/tests/widget/src/android/widget/cts/ListViewTest.java
@@ -1000,8 +1000,12 @@
@Override
public View getView(int position, View convertView, ViewGroup parent) {
final View view = super.getView(position, convertView, parent);
- if (view.getBackground() == null) {
- view.setBackground(spy(new ColorDrawable(Color.BLACK)));
+ if (convertView == null) {
+ if (view.getBackground() == null) {
+ view.setBackground(spy(new ColorDrawable(Color.BLACK)));
+ } else {
+ view.setBackground(spy(view.getBackground()));
+ }
}
return view;
}