Force talkback to read imei # digit by digit am: cf21d91b76
am: 72e264b1be
Change-Id: I5d34152d7e3fb758a38b095d8e7b98a575f9c269
diff --git a/src/com/android/settings/deviceinfo/ImeiInformation.java b/src/com/android/settings/deviceinfo/ImeiInformation.java
index 7145212..9ea54ea 100644
--- a/src/com/android/settings/deviceinfo/ImeiInformation.java
+++ b/src/com/android/settings/deviceinfo/ImeiInformation.java
@@ -21,8 +21,13 @@
import android.support.v7.preference.PreferenceScreen;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
+import android.text.Spannable;
+import android.text.SpannableString;
+import android.text.SpannableStringBuilder;
+import android.text.Spanned;
import android.text.TextUtils;
+import android.text.style.TtsSpan;
import com.android.internal.logging.MetricsProto.MetricsEvent;
import com.android.internal.telephony.Phone;
import com.android.internal.telephony.PhoneConstants;
@@ -80,7 +85,7 @@
if (phone.getLteOnCdmaMode() == PhoneConstants.LTE_ON_CDMA_TRUE) {
// Show ICC ID and IMEI for LTE device
setSummaryText(KEY_ICC_ID, phone.getIccSerialNumber());
- setSummaryText(KEY_IMEI, phone.getImei());
+ setSummaryTextAsDigit(KEY_IMEI, phone.getImei());
} else {
// device is not GSM/UMTS, do not display GSM/UMTS features
// check Null in case no specified preference in overlay xml
@@ -88,8 +93,8 @@
removePreferenceFromScreen(KEY_ICC_ID);
}
} else {
- setSummaryText(KEY_IMEI, phone.getImei());
- setSummaryText(KEY_IMEI_SV, phone.getDeviceSvn());
+ setSummaryTextAsDigit(KEY_IMEI, phone.getImei());
+ setSummaryTextAsDigit(KEY_IMEI_SV, phone.getDeviceSvn());
// device is not CDMA, do not display CDMA features
// check Null in case no specified preference in overlay xml
removePreferenceFromScreen(KEY_PRL_VERSION);
@@ -128,10 +133,23 @@
}
private void setSummaryText(String key, String text) {
+ setSummaryText(key, text, false /* forceDigit */);
+ }
+
+ private void setSummaryTextAsDigit(String key, String text) {
+ setSummaryText(key, text, true /* forceDigit */);
+ }
+
+ private void setSummaryText(String key, CharSequence text, boolean forceDigit) {
final Preference preference = findPreference(key);
if (TextUtils.isEmpty(text)) {
text = getResources().getString(R.string.device_info_default);
+ } else if (forceDigit && TextUtils.isDigitsOnly(text)) {
+ final Spannable spannable = new SpannableStringBuilder(text);
+ final TtsSpan span = new TtsSpan.DigitsBuilder(text.toString()).build();
+ spannable.setSpan(span, 0, spannable.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
+ text = spannable;
}
if (preference != null) {