diff options
author | alanv <alanv@google.com> | 2012-05-21 14:23:17 -0700 |
---|---|---|
committer | alanv <alanv@google.com> | 2012-05-21 14:23:17 -0700 |
commit | 7d62419c85dbf4fff1895e91d38edccf5d1f46ec (patch) | |
tree | a3256451a0d25a101bb3c9aa25f8cb007c73ad48 | |
parent | 29bb6d925bcaa562212b3fe41de249c3dfb64354 (diff) | |
download | frameworks_base-7d62419c85dbf4fff1895e91d38edccf5d1f46ec.zip frameworks_base-7d62419c85dbf4fff1895e91d38edccf5d1f46ec.tar.gz frameworks_base-7d62419c85dbf4fff1895e91d38edccf5d1f46ec.tar.bz2 |
Make TextView respect ACCESSIBILITY_SPEAK_PASSWORD preference.
Bug: 6523447
Change-Id: I2610b558395dc53a74b5c8c36c09673898da44f2
-rw-r--r-- | core/java/android/widget/TextView.java | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java index aef7929..81a44fd 100644 --- a/core/java/android/widget/TextView.java +++ b/core/java/android/widget/TextView.java @@ -39,6 +39,7 @@ import android.os.Message; import android.os.Parcel; import android.os.Parcelable; import android.os.SystemClock; +import android.provider.Settings; import android.text.BoringLayout; import android.text.DynamicLayout; import android.text.Editable; @@ -7705,14 +7706,23 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener super.onPopulateAccessibilityEvent(event); final boolean isPassword = hasPasswordTransformationMethod(); - if (!isPassword) { - CharSequence text = getTextForAccessibility(); + if (!isPassword || shouldSpeakPasswordsForAccessibility()) { + final CharSequence text = getTextForAccessibility(); if (!TextUtils.isEmpty(text)) { event.getText().add(text); } } } + /** + * @return true if the user has explicitly allowed accessibility services + * to speak passwords. + */ + private boolean shouldSpeakPasswordsForAccessibility() { + return (Settings.Secure.getInt(mContext.getContentResolver(), + Settings.Secure.ACCESSIBILITY_SPEAK_PASSWORD, 0) == 1); + } + @Override public void onInitializeAccessibilityEvent(AccessibilityEvent event) { super.onInitializeAccessibilityEvent(event); |