Stop double notifying a11y about Toasts.
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
This commit is contained in:
@@ -2172,7 +2172,12 @@ public final class ViewRootImpl implements ViewParent,
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user