diff options
| author | Svetoslav Ganov <svetoslavganov@google.com> | 2011-12-05 11:42:07 -0800 |
|---|---|---|
| committer | Svetoslav Ganov <svetoslavganov@google.com> | 2011-12-05 14:54:59 -0800 |
| commit | 55f937abe1a4fedb86c2679c66f0b5220ec3780e (patch) | |
| tree | 880f926d03c61252fbad516cfde201c316c10ca8 /core/java/android/inputmethodservice/KeyboardView.java | |
| parent | 003c15d72ccd3856d5abfe6d66a2a40d0eca85bc (diff) | |
Adding a system preference whether to speak passwords in accessibility mode.
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: I6eb0c40834abe5297f7dc74be02d180a5bef0174
Diffstat (limited to 'core/java/android/inputmethodservice/KeyboardView.java')
| -rw-r--r-- | core/java/android/inputmethodservice/KeyboardView.java | 10 |
1 files changed, 8 insertions, 2 deletions
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); |
