Fix tooltip handling for invisible and overlapping views

Ignore invisible views. Allow overlapping views to handle
dispatchTooltipHoverEvent in top-to-bottom order.

This brings the tooltip event handling method in line with
the existing touch and hover dispatch.

Bug: 34124732
Test: android.view.cts.TooltipTest#testMouseHoverOverlap
Change-Id: I37213318115dd2bb66979dac0f63f96e7221e8d7
This commit is contained in:
Vladislav Kaznacheev
2017-01-06 09:52:51 -08:00
parent 412706458e
commit 943cf0eb78

View File

@@ -2062,11 +2062,12 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
getAndVerifyPreorderedIndex(childrenCount, i, customOrder);
final View child =
getAndVerifyPreorderedView(preorderedList, children, childIndex);
final PointF point = getLocalPoint();
if (isTransformedTouchPointInView(x, y, child, point)) {
if (dispatchTooltipHoverEvent(event, child)) {
newTarget = child;
}
if (!canViewReceivePointerEvents(child)
|| !isTransformedTouchPointInView(x, y, child, null)) {
continue;
}
if (dispatchTooltipHoverEvent(event, child)) {
newTarget = child;
break;
}
}