File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change 3939import android .os .Parcel ;
4040import android .os .Parcelable ;
4141import android .os .SystemClock ;
42+ import android .provider .Settings ;
4243import android .text .BoringLayout ;
4344import android .text .DynamicLayout ;
4445import android .text .Editable ;
@@ -7705,14 +7706,23 @@ public void onPopulateAccessibilityEvent(AccessibilityEvent event) {
77057706 super .onPopulateAccessibilityEvent (event );
77067707
77077708 final boolean isPassword = hasPasswordTransformationMethod ();
7708- if (!isPassword ) {
7709- CharSequence text = getTextForAccessibility ();
7709+ if (!isPassword || shouldSpeakPasswordsForAccessibility () ) {
7710+ final CharSequence text = getTextForAccessibility ();
77107711 if (!TextUtils .isEmpty (text )) {
77117712 event .getText ().add (text );
77127713 }
77137714 }
77147715 }
77157716
7717+ /**
7718+ * @return true if the user has explicitly allowed accessibility services
7719+ * to speak passwords.
7720+ */
7721+ private boolean shouldSpeakPasswordsForAccessibility () {
7722+ return (Settings .Secure .getInt (mContext .getContentResolver (),
7723+ Settings .Secure .ACCESSIBILITY_SPEAK_PASSWORD , 0 ) == 1 );
7724+ }
7725+
77167726 @ Override
77177727 public void onInitializeAccessibilityEvent (AccessibilityEvent event ) {
77187728 super .onInitializeAccessibilityEvent (event );
You can’t perform that action at this time.
0 commit comments