diff options
| -rw-r--r-- | api/current.txt | 1 | ||||
| -rw-r--r-- | core/java/android/inputmethodservice/KeyboardView.java | 10 | ||||
| -rw-r--r-- | core/java/android/provider/Settings.java | 6 | ||||
| -rw-r--r-- | packages/SettingsProvider/res/values/defaults.xml | 3 | ||||
| -rw-r--r-- | packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java | 21 | 
5 files changed, 38 insertions, 3 deletions
diff --git a/api/current.txt b/api/current.txt index c62d82b2b4c6..b2da0c5e1bc4 100644 --- a/api/current.txt +++ b/api/current.txt @@ -17429,6 +17429,7 @@ package android.provider {      method public static boolean putString(android.content.ContentResolver, java.lang.String, java.lang.String);      method public static final void setLocationProviderEnabled(android.content.ContentResolver, java.lang.String, boolean);      field public static final java.lang.String ACCESSIBILITY_ENABLED = "accessibility_enabled"; +    field public static final java.lang.String ACCESSIBILITY_SPEAK_PASSWORD = "speak_password";      field public static final java.lang.String ADB_ENABLED = "adb_enabled";      field public static final java.lang.String ALLOWED_GEOLOCATION_ORIGINS = "allowed_geolocation_origins";      field public static final java.lang.String ALLOW_MOCK_LOCATION = "mock_location"; diff --git a/core/java/android/inputmethodservice/KeyboardView.java b/core/java/android/inputmethodservice/KeyboardView.java index 5143f7f4712b..72575217fbd2 100644 --- a/core/java/android/inputmethodservice/KeyboardView.java +++ b/core/java/android/inputmethodservice/KeyboardView.java @@ -31,6 +31,7 @@ import android.inputmethodservice.Keyboard.Key;  import android.media.AudioManager;  import android.os.Handler;  import android.os.Message; +import android.provider.Settings;  import android.util.AttributeSet;  import android.util.TypedValue;  import android.view.GestureDetector; @@ -967,8 +968,13 @@ public class KeyboardView extends View implements View.OnClickListener {              AccessibilityEvent event = AccessibilityEvent.obtain(eventType);              onInitializeAccessibilityEvent(event);              String text = null; -            // Add text only if headset is used to avoid leaking passwords. -            if (mAudioManager.isBluetoothA2dpOn() || mAudioManager.isWiredHeadsetOn()) { +            // This is very efficient since the properties are cached. +            final boolean speakPassword = Settings.Secure.getInt(mContext.getContentResolver(), +                    Settings.Secure.ACCESSIBILITY_SPEAK_PASSWORD, 0) != 0; +            // Add text only if password announcement is enabled or if headset is +            // used to avoid leaking passwords. +            if (speakPassword || mAudioManager.isBluetoothA2dpOn() +                    || mAudioManager.isWiredHeadsetOn()) {                  switch (code) {                      case Keyboard.KEYCODE_ALT:                          text = mContext.getString(R.string.keyboardview_keycode_alt); diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index 15e44380a05f..74bcc9b5ef81 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -2754,6 +2754,11 @@ public final class Settings {              "enabled_accessibility_services";          /** +         * Whether to speak passwords while in accessibility mode. +         */ +        public static final String ACCESSIBILITY_SPEAK_PASSWORD = "speak_password"; + +        /**           * If injection of accessibility enhancing JavaScript scripts           * is enabled.           * <p> @@ -4079,6 +4084,7 @@ public final class Settings {              ENABLED_ACCESSIBILITY_SERVICES,              TOUCH_EXPLORATION_ENABLED,              ACCESSIBILITY_ENABLED, +            ACCESSIBILITY_SPEAK_PASSWORD,              TTS_USE_DEFAULTS,              TTS_DEFAULT_RATE,              TTS_DEFAULT_PITCH, diff --git a/packages/SettingsProvider/res/values/defaults.xml b/packages/SettingsProvider/res/values/defaults.xml index 7a98615fe836..1ebed1fd3c76 100644 --- a/packages/SettingsProvider/res/values/defaults.xml +++ b/packages/SettingsProvider/res/values/defaults.xml @@ -80,6 +80,9 @@      <!-- Default for Settings.Secure.ACCESSIBILITY_SCRIPT_INJECTION -->      <bool name="def_accessibility_script_injection">false</bool> +    <!-- Default for Settings.Secure.ACCESSIBILITY_SPEAK_PASSWORD --> +    <bool name="def_accessibility_speak_password">false</bool> +      <!-- Default for Settings.Secure.ACCESSIBILITY_WEB_CONTENT_KEY_BINDINGS -->      <string name="def_accessibility_web_content_key_bindings" translatable="false">              <!-- DPAD/Trackball UP - traverse previous on current axis and send an event. --> diff --git a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java index 080d345e51d9..8360b72cf7a0 100644 --- a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java +++ b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java @@ -63,7 +63,7 @@ public class DatabaseHelper extends SQLiteOpenHelper {      // database gets upgraded properly. At a minimum, please confirm that 'upgradeVersion'      // is properly propagated through your change.  Not doing so will result in a loss of user      // settings. -    private static final int DATABASE_VERSION = 71; +    private static final int DATABASE_VERSION = 72;      private Context mContext; @@ -952,6 +952,22 @@ public class DatabaseHelper extends SQLiteOpenHelper {              upgradeVersion = 71;          } +        if (upgradeVersion == 71) { +             // New setting to specify whether to speak passwords in accessibility mode. +            db.beginTransaction(); +            SQLiteStatement stmt = null; +            try { +                stmt = db.compileStatement("INSERT INTO secure(name,value)" +                        + " VALUES(?,?);"); +                loadBooleanSetting(stmt, Settings.Secure.ACCESSIBILITY_SPEAK_PASSWORD, +                        R.bool.def_accessibility_speak_password); +            } finally { +                db.endTransaction(); +                if (stmt != null) stmt.close(); +            } +            upgradeVersion = 72; +        } +          // *** Remember to update DATABASE_VERSION above!          if (upgradeVersion != currentVersion) { @@ -1490,6 +1506,9 @@ public class DatabaseHelper extends SQLiteOpenHelper {              loadBooleanSetting(stmt, Settings.Secure.TOUCH_EXPLORATION_ENABLED,                      R.bool.def_touch_exploration_enabled); + +            loadBooleanSetting(stmt, Settings.Secure.ACCESSIBILITY_SPEAK_PASSWORD, +                    R.bool.def_accessibility_speak_password);          } finally {              if (stmt != null) stmt.close();          }  |