diff --git a/res/values/strings.xml b/res/values/strings.xml
index ea4da306582..51c54c9be0f 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -7473,4 +7473,24 @@
Allow contact searches by your organization to identify callers and contacts
+
+ Computer
+
+
+ Headset
+
+
+ Phone
+
+
+ Imaging
+
+
+ Headphone
+
+
+ Input Peripheral
+
+
+ Bluetooth
diff --git a/src/com/android/settings/bluetooth/BluetoothDevicePreference.java b/src/com/android/settings/bluetooth/BluetoothDevicePreference.java
index 6d953519768..a45e7b40a5c 100644
--- a/src/com/android/settings/bluetooth/BluetoothDevicePreference.java
+++ b/src/com/android/settings/bluetooth/BluetoothDevicePreference.java
@@ -21,12 +21,14 @@ import android.bluetooth.BluetoothClass;
import android.bluetooth.BluetoothDevice;
import android.content.Context;
import android.content.DialogInterface;
+import android.content.res.Resources;
import android.os.UserManager;
import android.support.v7.preference.Preference;
import android.support.v7.preference.PreferenceViewHolder;
import android.text.Html;
import android.text.TextUtils;
import android.util.Log;
+import android.util.Pair;
import android.util.TypedValue;
import android.view.View;
import android.view.View.OnClickListener;
@@ -59,6 +61,19 @@ public final class BluetoothDevicePreference extends Preference implements
private AlertDialog mDisconnectDialog;
+ private String contentDescription = null;
+
+ /* Talk-back descriptions for various BT icons */
+ Resources r = getContext().getResources();
+ public final String COMPUTER = r.getString(R.string.bluetooth_talkback_computer);
+ public final String INPUT_PERIPHERAL = r.getString(
+ R.string.bluetooth_talkback_input_peripheral);
+ public final String HEADSET = r.getString(R.string.bluetooth_talkback_headset);
+ public final String PHONE = r.getString(R.string.bluetooth_talkback_phone);
+ public final String IMAGING = r.getString(R.string.bluetooth_talkback_imaging);
+ public final String HEADPHONE = r.getString(R.string.bluetooth_talkback_headphone);
+ public final String BLUETOOTH = r.getString(R.string.bluetooth_talkback_bluetooth);
+
public BluetoothDevicePreference(Context context, CachedBluetoothDevice cachedDevice) {
super(context);
@@ -121,9 +136,11 @@ public final class BluetoothDevicePreference extends Preference implements
setSummary(null); // empty summary for unpaired devices
}
- int iconResId = getBtClassDrawable();
- if (iconResId != 0) {
- setIcon(iconResId);
+
+ Pair pair = getBtClassDrawableWithDescription();
+ if (pair.first != 0) {
+ setIcon(pair.first);
+ contentDescription = pair.second;
}
// Used to gray out the item
@@ -148,7 +165,10 @@ public final class BluetoothDevicePreference extends Preference implements
deviceDetails.setTag(mCachedDevice);
}
}
-
+ final ImageView imageView = (ImageView) view.findViewById(android.R.id.icon);
+ if (imageView != null) {
+ imageView.setContentDescription(contentDescription);
+ }
super.onBindViewHolder(view);
}
@@ -234,21 +254,22 @@ public final class BluetoothDevicePreference extends Preference implements
}
}
- private int getBtClassDrawable() {
+ private Pair getBtClassDrawableWithDescription() {
BluetoothClass btClass = mCachedDevice.getBtClass();
if (btClass != null) {
switch (btClass.getMajorDeviceClass()) {
case BluetoothClass.Device.Major.COMPUTER:
- return R.drawable.ic_bt_laptop;
+ return new Pair(R.drawable.ic_bt_laptop, COMPUTER);
case BluetoothClass.Device.Major.PHONE:
- return R.drawable.ic_bt_cellphone;
+ return new Pair(R.drawable.ic_bt_cellphone, PHONE);
case BluetoothClass.Device.Major.PERIPHERAL:
- return HidProfile.getHidClassDrawable(btClass);
+ return new Pair(HidProfile.getHidClassDrawable(btClass),
+ INPUT_PERIPHERAL);
case BluetoothClass.Device.Major.IMAGING:
- return R.drawable.ic_bt_imaging;
+ return new Pair(R.drawable.ic_bt_imaging, IMAGING);
default:
// unrecognized device class; continue
@@ -261,18 +282,17 @@ public final class BluetoothDevicePreference extends Preference implements
for (LocalBluetoothProfile profile : profiles) {
int resId = profile.getDrawableResource(btClass);
if (resId != 0) {
- return resId;
+ return new Pair(resId, null);
}
}
if (btClass != null) {
if (btClass.doesClassMatch(BluetoothClass.PROFILE_A2DP)) {
- return R.drawable.ic_bt_headphones_a2dp;
-
+ return new Pair(R.drawable.ic_bt_headphones_a2dp, HEADPHONE);
}
if (btClass.doesClassMatch(BluetoothClass.PROFILE_HEADSET)) {
- return R.drawable.ic_bt_headset_hfp;
+ return new Pair(R.drawable.ic_bt_headset_hfp, HEADSET);
}
}
- return R.drawable.ic_settings_bluetooth;
+ return new Pair(R.drawable.ic_settings_bluetooth, BLUETOOTH);
}
}