Add provider name to on/off switch talkback

Test: ondevice manual
Bug: 322274544

Change-Id: If067b3bea941ae997d9aefe03286d3b223956326
This commit is contained in:
Becca Hughes
2024-04-05 16:26:25 +00:00
parent 679e2d6556
commit cf2d635601
2 changed files with 22 additions and 0 deletions

View File

@@ -1072,6 +1072,22 @@ public class CredentialManagerPreferenceController extends BasePreferenceControl
return mChecked;
}
@Override
public void setTitle(@Nullable CharSequence title) {
super.setTitle(title);
maybeUpdateContentDescription();
}
private void maybeUpdateContentDescription() {
final CharSequence appName = getTitle();
if (mSwitch != null && !TextUtils.isEmpty(appName)) {
mSwitch.setContentDescription(
getContext().getString(
R.string.credman_on_off_switch_content_description, appName));
}
}
public void setPreferenceListener(OnCombiPreferenceClickListener onClickListener) {
mOnClickListener = onClickListener;
}
@@ -1094,6 +1110,9 @@ public class CredentialManagerPreferenceController extends BasePreferenceControl
// Store this for later.
mSwitch = switchView;
// Update the content description.
maybeUpdateContentDescription();
}
super.setOnPreferenceClickListener(