Fix 5249234: Add contentDescription to buttons on transport control on lock screen.
Change-Id: Ie4e9139e01c37a0d9542ff9996a84db0083b35ef
diff --git a/core/java/com/android/internal/widget/TransportControlView.java b/core/java/com/android/internal/widget/TransportControlView.java
index 1042a59..73d9f10 100644
--- a/core/java/com/android/internal/widget/TransportControlView.java
+++ b/core/java/com/android/internal/widget/TransportControlView.java
@@ -336,20 +336,27 @@
if (state == mPlayState) {
return;
}
+ final int imageResId;
+ final int imageDescId;
switch (state) {
case RemoteControlClient.PLAYSTATE_PLAYING:
- mBtnPlay.setImageResource(com.android.internal.R.drawable.ic_media_pause);
+ imageResId = com.android.internal.R.drawable.ic_media_pause;
+ imageDescId = com.android.internal.R.string.lockscreen_transport_pause_description;
break;
case RemoteControlClient.PLAYSTATE_BUFFERING:
- mBtnPlay.setImageResource(com.android.internal.R.drawable.ic_media_stop);
+ imageResId = com.android.internal.R.drawable.ic_media_stop;
+ imageDescId = com.android.internal.R.string.lockscreen_transport_stop_description;
break;
case RemoteControlClient.PLAYSTATE_PAUSED:
default:
- mBtnPlay.setImageResource(com.android.internal.R.drawable.ic_media_play);
+ imageResId = com.android.internal.R.drawable.ic_media_play;
+ imageDescId = com.android.internal.R.string.lockscreen_transport_play_description;
break;
}
+ mBtnPlay.setImageResource(imageResId);
+ mBtnPlay.setContentDescription(getResources().getString(imageDescId));
mPlayState = state;
}
diff --git a/core/res/res/layout/keyguard_transport_control.xml b/core/res/res/layout/keyguard_transport_control.xml
index 2ebe5fc..6e24ce2 100644
--- a/core/res/res/layout/keyguard_transport_control.xml
+++ b/core/res/res/layout/keyguard_transport_control.xml
@@ -66,7 +66,8 @@
android:src="@drawable/ic_media_rew"
android:clickable="true"
android:background="?android:attr/selectableItemBackground"
- android:padding="10dip"/>
+ android:padding="10dip"
+ android:contentDescription="@string/lockscreen_transport_prev_description"/>
</FrameLayout>
<FrameLayout
android:layout_width="wrap_content"
@@ -80,7 +81,8 @@
android:clickable="true"
android:src="@drawable/ic_media_play"
android:background="?android:attr/selectableItemBackground"
- android:padding="10dip"/>
+ android:padding="10dip"
+ android:contentDescription="@string/lockscreen_transport_play_description"/>
</FrameLayout>
<FrameLayout
android:layout_width="wrap_content"
@@ -94,7 +96,8 @@
android:clickable="true"
android:src="@drawable/ic_media_ff"
android:background="?android:attr/selectableItemBackground"
- android:padding="10dip"/>
+ android:padding="10dip"
+ android:contentDescription="@string/lockscreen_transport_next_description"/>
</FrameLayout>
</LinearLayout>
</LinearLayout>
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index 3f0f2f34..fb4783b 100755
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -953,7 +953,7 @@
social updates from your friends. Malicious apps can use this to pretend to be a friend
and trick you into revealing passwords or other confidential information.</string>
-
+
<!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
<string name="permlab_readCalendar">read calendar events plus confidential information</string>
<!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
@@ -1831,6 +1831,17 @@
<string name="lockscreen_permanent_disabled_sim_instructions">Your SIM card is permanently disabled.\n
Please contact your wireless service provider to obtain another SIM card.</string>
+ <!-- Shown on transport control of lockscreen. Pressing button goes to previous track. -->
+ <string name="lockscreen_transport_prev_description">Previous track button</string>
+ <!-- Shown on transport control of lockscreen. Pressing button goes to next track. -->
+ <string name="lockscreen_transport_next_description">Next track button</string>
+ <!-- Shown on transport control of lockscreen. Pressing button pauses playback -->
+ <string name="lockscreen_transport_pause_description">Pause button</string>
+ <!-- Shown on transport control of lockscreen. Pressing button pauses playback -->
+ <string name="lockscreen_transport_play_description">Play button</string>
+ <!-- Shown on transport control of lockscreen. Pressing button pauses playback -->
+ <string name="lockscreen_transport_stop_description">Stop button</string>
+
<!-- Shown in the lock screen when there is emergency calls only mode. -->
<string name="emergency_calls_only" msgid="2485604591272668370">Emergency calls only</string>