From 7e8dcbea65356807ca052ee5e98c9b25b7f0b1ca Mon Sep 17 00:00:00 2001 From: Svetoslav Ganov Date: Mon, 5 Dec 2011 12:54:53 -0800 Subject: Adding a system preference whether to speak passwords in accessibility mode (settings). By default we do not speak passwords if the user has no headset. However, many users find this too restrictive and would like a way to enable password announcement. While we cannot speak the passwords all the time ,to avoid leaking them, we expose a preference so each user can choose the option that best works for him/her. bug:5712607 Change-Id: I1a6e95c392c18dc8d7406b1cef49705756b31254 --- res/values/strings.xml | 2 ++ res/xml/accessibility_settings.xml | 12 +++++++++--- src/com/android/settings/AccessibilitySettings.java | 20 ++++++++++++++++++++ 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index bca1d09..aa3b94f 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -2760,6 +2760,8 @@ found in the list of installed apps. Large text Power button ends call + + Speak passwords Explore by touch diff --git a/res/xml/accessibility_settings.xml b/res/xml/accessibility_settings.xml index 45f1dce..90bdfd9 100644 --- a/res/xml/accessibility_settings.xml +++ b/res/xml/accessibility_settings.xml @@ -45,11 +45,17 @@ android:persistent="false" android:order="3"/> + + + android:order="5" > @@ -63,7 +69,7 @@ android:entries="@array/long_press_timeout_selector_titles" android:entryValues="@array/long_press_timeout_selector_values" android:persistent="false" - android:order="5"/> + android:order="6"/> + android:order="7"/> diff --git a/src/com/android/settings/AccessibilitySettings.java b/src/com/android/settings/AccessibilitySettings.java index 9aabe21..827af13 100644 --- a/src/com/android/settings/AccessibilitySettings.java +++ b/src/com/android/settings/AccessibilitySettings.java @@ -108,6 +108,8 @@ public class AccessibilitySettings extends SettingsPreferenceFragment implements "toggle_power_button_ends_call_preference"; private static final String TOGGLE_AUTO_ROTATE_SCREEN_PREFERENCE = "toggle_auto_rotate_screen_preference"; + private static final String TOGGLE_SPEAK_PASSWORD_PREFERENCE = + "toggle_speak_password_preference"; private static final String TOGGLE_TOUCH_EXPLORATION_PREFERENCE = "toggle_touch_exploration_preference"; private static final String SELECT_LONG_PRESS_TIMEOUT_PREFERENCE = @@ -159,6 +161,7 @@ public class AccessibilitySettings extends SettingsPreferenceFragment implements private CheckBoxPreference mToggleLargeTextPreference; private CheckBoxPreference mTogglePowerButtonEndsCallPreference; private CheckBoxPreference mToggleAutoRotateScreenPreference; + private CheckBoxPreference mToggleSpeakPasswordPreference; private Preference mToggleTouchExplorationPreference; private ListPreference mSelectLongPressTimeoutPreference; private AccessibilityEnableScriptInjectionPreference mToggleScriptInjectionPreference; @@ -213,6 +216,8 @@ public class AccessibilitySettings extends SettingsPreferenceFragment implements } else if (mToggleAutoRotateScreenPreference == preference) { handleToggleAutoRotateScreenPreferenceClick(); return true; + } else if (mToggleSpeakPasswordPreference == preference) { + handleToggleSpeakPasswordPreferenceClick(); } return super.onPreferenceTreeClick(preferenceScreen, preference); } @@ -248,6 +253,12 @@ public class AccessibilitySettings extends SettingsPreferenceFragment implements } } + private void handleToggleSpeakPasswordPreferenceClick() { + Settings.Secure.putInt(getContentResolver(), + Settings.Secure.ACCESSIBILITY_SPEAK_PASSWORD, + mToggleSpeakPasswordPreference.isChecked() ? 1 : 0); + } + private void initializeAllPreferences() { mServicesCategory = (PreferenceCategory) findPreference(SERVICES_CATEGORY); mSystemsCategory = (PreferenceCategory) findPreference(SYSTEM_CATEGORY); @@ -268,6 +279,10 @@ public class AccessibilitySettings extends SettingsPreferenceFragment implements mToggleAutoRotateScreenPreference = (CheckBoxPreference) findPreference(TOGGLE_AUTO_ROTATE_SCREEN_PREFERENCE); + // Speak passwords. + mToggleSpeakPasswordPreference = + (CheckBoxPreference) findPreference(TOGGLE_SPEAK_PASSWORD_PREFERENCE); + // Touch exploration enabled. mToggleTouchExplorationPreference = findPreference(TOGGLE_TOUCH_EXPLORATION_PREFERENCE); @@ -427,6 +442,11 @@ public class AccessibilitySettings extends SettingsPreferenceFragment implements Settings.System.ACCELEROMETER_ROTATION, 0) != 0; mToggleAutoRotateScreenPreference.setChecked(autoRotationEnabled); + // Speak passwords. + final boolean speakPasswordEnabled = Settings.Secure.getInt(getContentResolver(), + Settings.Secure.ACCESSIBILITY_SPEAK_PASSWORD, 0) != 0; + mToggleSpeakPasswordPreference.setChecked(speakPasswordEnabled); + // Touch exploration enabled. if (AccessibilityManager.getInstance(getActivity()).isEnabled()) { mSystemsCategory.addPreference(mToggleTouchExplorationPreference); -- cgit v1.1