Dispatch View#onVisibilityAggregated to views becoming invisible

When a view becomes newly invisible/gone via setFlags, its visibility
state will have already changed by the time we
dispatchVisibilityAggregated. Since we already do visibility filtering
in the ViewGroup override when we traverse to child views, permit the
normal View implementation to dispatch onVisibilityAggregated if we're
not visible and dispatching visibility false.

Bug 28123146

Change-Id: I528dffe95d2057ef938508b9fb4219c5338b060c
This commit is contained in:
Adam Powell
2016-04-12 11:13:23 -07:00
parent f763ea3b05
commit fa58a8daa6

View File

@@ -10278,7 +10278,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
*/
@Visibility boolean dispatchVisibilityAggregated(boolean isVisible) {
final boolean thisVisible = getVisibility() == VISIBLE;
if (thisVisible) {
// If we're not visible but something is telling us we are, ignore it.
if (thisVisible || !isVisible) {
onVisibilityAggregated(isVisible);
}
return thisVisible && isVisible;