From 9fc96c5371c1ce62db40aee9b93482504b79769b Mon Sep 17 00:00:00 2001 From: Svet Ganov Date: Thu, 11 Dec 2014 22:33:45 -0800 Subject: [PATCH] Fix an edge case in computing click location in accessibility mode. In accessibility mode to click a view we computed a point where to send down and up touch events. The logic that computes where to send the events was not clipping the bounds of the child to these of the parent. As a result we wrongly computed we can send the events in a location of the child that is outside of its parent, thus the click having no effect or clicking the wrong thing. bug:18672945 Change-Id: If9c452e7e5b196f699db33d37dbc6775d5d1622a --- core/java/android/view/ViewGroup.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java index 25a70eb0ecf2b..b22c187e89573 100644 --- a/core/java/android/view/ViewGroup.java +++ b/core/java/android/view/ViewGroup.java @@ -825,6 +825,12 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager return false; } + // Clip the bounds by our bounds. + bounds.left = Math.max(bounds.left, 0); + bounds.top = Math.max(bounds.top, 0); + bounds.right = Math.min(bounds.right, mRight); + bounds.bottom = Math.min(bounds.bottom, mBottom); + Iterator iterator = obtainOrderedChildIterator(); while (iterator.hasNext()) { View sibling = iterator.next();