Add content description to suggestion card close button.
Change-Id: I2354dd5a4b092ac24bbc0c197bd228b73d8ede64
Fixes: 72958040
Test: talkback, make RunSettingsRoboTests
diff --git a/res/layout/suggestion_tile.xml b/res/layout/suggestion_tile.xml
index fa3f3af..850e55a 100644
--- a/res/layout/suggestion_tile.xml
+++ b/res/layout/suggestion_tile.xml
@@ -52,6 +52,7 @@
android:layout_alignParentEnd="true"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
+ android:contentDescription="@string/dlg_close"
android:src="@drawable/ic_suggestion_close_button"/>
</RelativeLayout>
diff --git a/res/layout/suggestion_tile_with_button.xml b/res/layout/suggestion_tile_with_button.xml
index de3494a..8fb8e84 100644
--- a/res/layout/suggestion_tile_with_button.xml
+++ b/res/layout/suggestion_tile_with_button.xml
@@ -52,6 +52,7 @@
android:layout_alignParentEnd="true"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
+ android:contentDescription="@string/dlg_close"
android:src="@drawable/ic_suggestion_close_button"/>
</RelativeLayout>
diff --git a/tests/robotests/src/com/android/settings/dashboard/suggestions/SuggestionAdapterTest.java b/tests/robotests/src/com/android/settings/dashboard/suggestions/SuggestionAdapterTest.java
index bac02d3..4ff09c1 100644
--- a/tests/robotests/src/com/android/settings/dashboard/suggestions/SuggestionAdapterTest.java
+++ b/tests/robotests/src/com/android/settings/dashboard/suggestions/SuggestionAdapterTest.java
@@ -295,6 +295,19 @@
}
@Test
+ public void onBindViewHolder_closeButtonShouldHaveContentDescription()
+ throws PendingIntent.CanceledException {
+ final List<Suggestion> suggestions = makeSuggestions("pkg1");
+ setupSuggestions(mActivity, suggestions);
+
+ mSuggestionAdapter.onBindViewHolder(mSuggestionHolder, 0);
+
+ assertThat(
+ mSuggestionHolder.itemView.findViewById(R.id.close_button).getContentDescription())
+ .isNotNull();
+ }
+
+ @Test
public void setCardLayout_oneCard_shouldSetCardWidthToMatchParent() {
final List<Suggestion> suggestions = makeSuggestions("pkg1");
setupSuggestions(mContext, suggestions);