From 3d5cfc0488aa44eaa40a3394f82bc2c1b5824345 Mon Sep 17 00:00:00 2001 From: Vladislav Kaznacheev Date: Thu, 5 Jan 2017 17:50:38 -0800 Subject: [PATCH] Fix pointer icon handling for invisible and overlapping views Ignore invisible views. Allow overlapping views to handle onResolvePointerIcon in top-to-bottom order. This brings the pointer icon dispatch method in line with the existing touch and hover dispatch. Bug: 34114031 Test: android.view.cts.ViewTest#testPointerIconOverlap Change-Id: I120d7c09f122e49afeeaf8ddad6880951b5ccc2c --- core/java/android/view/ViewGroup.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java index 7835899d14196..2465bb4952a65 100644 --- a/core/java/android/view/ViewGroup.java +++ b/core/java/android/view/ViewGroup.java @@ -1759,15 +1759,15 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager for (int i = childrenCount - 1; i >= 0; i--) { final int childIndex = getAndVerifyPreorderedIndex(childrenCount, i, customOrder); final View child = getAndVerifyPreorderedView(preorderedList, children, childIndex); - final PointF point = getLocalPoint(); - if (isTransformedTouchPointInView(x, y, child, point)) { - final PointerIcon pointerIcon = - dispatchResolvePointerIcon(event, pointerIndex, child); - if (pointerIcon != null) { - if (preorderedList != null) preorderedList.clear(); - return pointerIcon; - } - break; + if (!canViewReceivePointerEvents(child) + || !isTransformedTouchPointInView(x, y, child, null)) { + continue; + } + final PointerIcon pointerIcon = + dispatchResolvePointerIcon(event, pointerIndex, child); + if (pointerIcon != null) { + if (preorderedList != null) preorderedList.clear(); + return pointerIcon; } } if (preorderedList != null) preorderedList.clear();