Merge "a11y fix: read emergency numbers as digits, not numbers."
This commit is contained in:
committed by
Android (Google) Code Review
commit
0cb322b44e
@@ -21,6 +21,8 @@ import android.database.ContentObserver;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.provider.Settings;
|
||||
import android.telephony.PhoneNumberUtils;
|
||||
import android.text.Spannable;
|
||||
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
import androidx.preference.Preference;
|
||||
@@ -69,8 +71,17 @@ public class EmergencyGestureNumberOverridePreferenceController extends BasePref
|
||||
|
||||
@Override
|
||||
public CharSequence getSummary() {
|
||||
return mContext.getString(R.string.emergency_gesture_call_for_help_summary,
|
||||
mEmergencyNumberUtils.getPoliceNumber());
|
||||
String number = mEmergencyNumberUtils.getPoliceNumber();
|
||||
String summary = mContext.getString(R.string.emergency_gesture_call_for_help_summary,
|
||||
number);
|
||||
int numberStartIndex = summary.indexOf(number);
|
||||
if (numberStartIndex < 0) {
|
||||
return summary;
|
||||
}
|
||||
Spannable summarySpan = Spannable.Factory.getInstance().newSpannable(summary);
|
||||
PhoneNumberUtils.addTtsSpan(summarySpan, numberStartIndex,
|
||||
numberStartIndex + number.length());
|
||||
return summarySpan;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Reference in New Issue
Block a user