TalkBack was speaking all Toasts twice because we were
sending both NOTIFICATION and a WINDOW_STATE_CHANGE events
when Toasts were displayed.
Stop sending the WINDOW_STATE_CHANGE event for toasts.
Bug:
30570188
Change-Id: I26c6dc50350dfd4daf2a706b94fadcf5d1e03557
}
if (changedVisibility || regainedFocus) {
- host.sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED);
+ // Toasts are presented as notifications - don't present them as windows as well
+ boolean isToast = (mWindowAttributes == null) ? false
+ : (mWindowAttributes.type == WindowManager.LayoutParams.TYPE_TOAST);
+ if (!isToast) {
+ host.sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED);
+ }
}
mFirst = false;