Announce inattentive sleep warning for accessibility

The inattentive sleep warning currently isn't being read out by
TalkBack. This change explicitly asks TalkBack to announce the warning
text when the warning is shown.

Bug: 192336859
Test: Enable TalkBack & set low attentive timeout:
      adb shell settings put secure attentive_timeout 40000
      Verify that when the warning is shown, TalkBack announces it
Change-Id: Ia40fc94b618afb39f88f9aac8e8f10399456463b
This commit is contained in:
Robert Horvath
2021-06-29 17:01:30 +02:00
parent d87df18092
commit a9e51b3e2b

View File

@@ -93,6 +93,8 @@ public class InattentiveSleepWarningView extends FrameLayout {
setAlpha(1f);
setVisibility(View.VISIBLE);
mWindowManager.addView(this, getLayoutParams(mWindowToken));
announceForAccessibility(
getContext().getString(R.string.inattentive_sleep_warning_message));
}
/**