From 943cf0eb78030493a4aa46071f9342222fd15ca7 Mon Sep 17 00:00:00 2001 From: Vladislav Kaznacheev Date: Fri, 6 Jan 2017 09:52:51 -0800 Subject: [PATCH] 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 --- core/java/android/view/ViewGroup.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java index 7835899d14196..50dcf1a354681 100644 --- a/core/java/android/view/ViewGroup.java +++ b/core/java/android/view/ViewGroup.java @@ -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; } }