summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSvetoslav Ganov <svetoslavganov@google.com>2012-05-21 15:11:07 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2012-05-21 15:11:07 -0700
commitf7b8bbadf50f313733dd89c5680f0ffc60f364bc (patch)
treebbc8bba4ff462cbb2c9f65b91dfe18e331a24b5d
parent7eac5eca431a824777530fb322b8c25015813954 (diff)
parentde83e7aa32e7b1a6c8aea780664150345b7ae097 (diff)
downloadframeworks_base-f7b8bbadf50f313733dd89c5680f0ffc60f364bc.zip
frameworks_base-f7b8bbadf50f313733dd89c5680f0ffc60f364bc.tar.gz
frameworks_base-f7b8bbadf50f313733dd89c5680f0ffc60f364bc.tar.bz2
am de83e7aa: Merge "Make TextView respect ACCESSIBILITY_SPEAK_PASSWORD preference." into jb-dev
* commit 'de83e7aa32e7b1a6c8aea780664150345b7ae097': Make TextView respect ACCESSIBILITY_SPEAK_PASSWORD preference.
-rw-r--r--core/java/android/widget/TextView.java14
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);