a11y fix: read emergency numbers as digits, not numbers.

Instead of reading as one hundred and ten, it should read as one-one-o.

Also make the number override dialog text input box a little bigger

Fix: 175517632
Fix: 175514672
Test: robotests
Change-Id: I7e3e823792f885004868ede790fc414a3fa66f01
This commit is contained in:
Fan Zhang
2020-12-15 12:15:05 -08:00
parent 04322e2202
commit 8e154d094f
3 changed files with 16 additions and 4 deletions

View File

@@ -32,7 +32,8 @@
android:imeOptions="actionDone" android:imeOptions="actionDone"
android:inputType="numberSigned" android:inputType="numberSigned"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"/> android:layout_height="wrap_content"
android:minHeight="@dimen/min_tap_target_size"/>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"

View File

@@ -21,6 +21,8 @@ import android.database.ContentObserver;
import android.os.Handler; import android.os.Handler;
import android.os.Looper; import android.os.Looper;
import android.provider.Settings; import android.provider.Settings;
import android.telephony.PhoneNumberUtils;
import android.text.Spannable;
import androidx.annotation.VisibleForTesting; import androidx.annotation.VisibleForTesting;
import androidx.preference.Preference; import androidx.preference.Preference;
@@ -69,8 +71,17 @@ public class EmergencyGestureNumberOverridePreferenceController extends BasePref
@Override @Override
public CharSequence getSummary() { public CharSequence getSummary() {
return mContext.getString(R.string.emergency_gesture_call_for_help_summary, String number = mEmergencyNumberUtils.getPoliceNumber();
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 @Override

View File

@@ -90,7 +90,7 @@ public class EmergencyGestureNumberOverridePreferenceControllerTest {
mController.updateState(preference); mController.updateState(preference);
assertThat(preference.getSummary()).isEqualTo( assertThat(preference.getSummary().toString()).isEqualTo(
mContext.getString(R.string.emergency_gesture_call_for_help_summary, "123")); mContext.getString(R.string.emergency_gesture_call_for_help_summary, "123"));
} }