Methods Summary |
---|
public void | onInitializeAccessibilityNodeInfo(android.view.View host, android.view.accessibility.AccessibilityNodeInfo info)
super.onInitializeAccessibilityNodeInfo(host, info);
if (shouldObscureSpeech()) {
final Context ctx = host.getContext();
info.setText(null);
info.setContentDescription(
ctx.getString(R.string.keyboard_password_character_no_headset));
}
|
public void | onPopulateAccessibilityEvent(android.view.View host, android.view.accessibility.AccessibilityEvent event)
super.onPopulateAccessibilityEvent(host, event);
if ((event.getEventType() != AccessibilityEvent.TYPE_ANNOUNCEMENT)
&& shouldObscureSpeech()) {
event.getText().clear();
event.setContentDescription(host.getContext().getString(
R.string.keyboard_password_character_no_headset));
}
|
public void | sendAccessibilityEvent(android.view.View host, int eventType)
super.sendAccessibilityEvent(host, eventType);
// Play the "headset required" announcement the first time the user
// places accessibility focus on a key.
if ((eventType == AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUSED)
&& !sAnnouncedHeadset && shouldObscureSpeech()) {
sAnnouncedHeadset = true;
host.announceForAccessibility(host.getContext().getString(
R.string.keyboard_headset_required_to_hear_password));
}
|
private boolean | shouldObscureSpeech()
// The user can optionally force speaking passwords.
if (Settings.Secure.getIntForUser(mContentResolver,
Settings.Secure.ACCESSIBILITY_SPEAK_PASSWORD, 0, UserHandle.USER_CURRENT) != 0) {
return false;
}
// Always speak if the user is listening through headphones.
if (mAudioManager.isWiredHeadsetOn() || mAudioManager.isBluetoothA2dpOn()) {
return false;
}
// Don't speak since this key is used to type a password.
return true;
|