summaryrefslogtreecommitdiffstats
path: root/core/java
diff options
context:
space:
mode:
authorSvetoslav <svetoslavganov@google.com>2015-01-27 04:36:31 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-01-27 04:36:31 +0000
commite5743753eee8da6019594a95d2c27881599a0582 (patch)
tree529f04fae4788c52181de4d5714c74763b430f21 /core/java
parent69fbcf1f100905f5a28909d561db4753189bd717 (diff)
parent55120a0f1acb9a46dc56bbdab877bc2c635f1356 (diff)
downloadframeworks_base-e5743753eee8da6019594a95d2c27881599a0582.zip
frameworks_base-e5743753eee8da6019594a95d2c27881599a0582.tar.gz
frameworks_base-e5743753eee8da6019594a95d2c27881599a0582.tar.bz2
am 55120a0f: am 197adec3: Merge "Accessibility: Ignore overlapping siblings when computing a click location" into lmp-mr1-dev
* commit '55120a0f1acb9a46dc56bbdab877bc2c635f1356': Accessibility: Ignore overlapping siblings when computing a click location
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/view/View.java17
-rw-r--r--core/java/android/view/ViewGroup.java74
-rw-r--r--core/java/android/widget/HorizontalScrollView.java12
-rw-r--r--core/java/android/widget/Toolbar.java12
-rw-r--r--core/java/com/android/internal/widget/ActionBarContainer.java12
5 files changed, 5 insertions, 122 deletions
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index b8eb80a..ed75de3 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -5932,23 +5932,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
return true;
}
- /**
- * Adds the clickable rectangles withing the bounds of this view. They
- * may overlap. This method is intended for use only by the accessibility
- * layer.
- *
- * @param outRects List to which to add clickable areas.
- *
- * @hide
- */
- public void addClickableRectsForAccessibility(List<RectF> outRects) {
- if (isClickable() || isLongClickable()) {
- RectF bounds = new RectF();
- bounds.set(0, 0, getWidth(), getHeight());
- outRects.add(bounds);
- }
- }
-
static void offsetRects(List<RectF> rects, float offsetX, float offsetY) {
final int rectCount = rects.size();
for (int i = 0; i < rectCount; i++) {
diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java
index 0d509e7..dc97833 100644
--- a/core/java/android/view/ViewGroup.java
+++ b/core/java/android/view/ViewGroup.java
@@ -855,27 +855,11 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
// Compute the intersection between the child and the sibling.
if (siblingBounds.intersect(bounds)) {
- List<RectF> clickableRects = new ArrayList<>();
- sibling.addClickableRectsForAccessibility(clickableRects);
-
- final int clickableRectCount = clickableRects.size();
- for (int j = 0; j < clickableRectCount; j++) {
- RectF clickableRect = clickableRects.get(j);
-
- // Translate the clickable rect to our coordinates.
- offsetChildRectToMyCoords(clickableRect, sibling);
-
- // Compute the intersection between the child and the clickable rects.
- if (clickableRect.intersect(bounds)) {
- // If a clickable rect completely covers the child, done.
- if (clickableRect.equals(bounds)) {
- releaseOrderedChildIterator();
- return false;
- }
- // Keep track of the intersection rectangle.
- intersections.add(clickableRect);
- }
- }
+ // Conservatively we consider an overlapping sibling to be
+ // interactive and ignore it. This is not ideal as if the
+ // sibling completely covers the view despite handling no
+ // touch events we will not be able to click on the view.
+ intersections.add(siblingBounds);
}
}
@@ -890,54 +874,6 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
return true;
}
- /**
- * @hide
- */
- @Override
- public void addClickableRectsForAccessibility(List<RectF> outRects) {
- int sizeBefore = outRects.size();
-
- super.addClickableRectsForAccessibility(outRects);
-
- // If we added ourselves, then no need to visit children.
- if (outRects.size() > sizeBefore) {
- return;
- }
-
- Iterator<View> iterator = obtainOrderedChildIterator();
- while (iterator.hasNext()) {
- View child = iterator.next();
-
- // Cannot click on an invisible view.
- if (!isVisible(child)) {
- continue;
- }
-
- sizeBefore = outRects.size();
-
- // Add clickable rects in the child bounds.
- child.addClickableRectsForAccessibility(outRects);
-
- // Offset the clickable rects for out children to our coordinates.
- final int sizeAfter = outRects.size();
- for (int j = sizeBefore; j < sizeAfter; j++) {
- RectF rect = outRects.get(j);
-
- // Translate the clickable rect to our coordinates.
- offsetChildRectToMyCoords(rect, child);
-
- // If a clickable rect fills the parent, done.
- if ((int) rect.left == 0 && (int) rect.top == 0
- && (int) rect.right == mRight && (int) rect.bottom == mBottom) {
- releaseOrderedChildIterator();
- return;
- }
- }
- }
-
- releaseOrderedChildIterator();
- }
-
private void offsetChildRectToMyCoords(RectF rect, View child) {
if (!child.hasIdentityMatrix()) {
child.getMatrix().mapRect(rect);
diff --git a/core/java/android/widget/HorizontalScrollView.java b/core/java/android/widget/HorizontalScrollView.java
index 371b480..1b93b97 100644
--- a/core/java/android/widget/HorizontalScrollView.java
+++ b/core/java/android/widget/HorizontalScrollView.java
@@ -762,18 +762,6 @@ public class HorizontalScrollView extends FrameLayout {
awakenScrollBars();
}
- /**
- * @hide
- */
- @Override
- public void addClickableRectsForAccessibility(List<RectF> outRects) {
- // This class always consumes touch events, therefore if it
- // covers a view we do not want to send a click over it.
- RectF bounds = new RectF();
- bounds.set(0, 0, getWidth(), getHeight());
- outRects.add(bounds);
- }
-
@Override
public boolean performAccessibilityAction(int action, Bundle arguments) {
if (super.performAccessibilityAction(action, arguments)) {
diff --git a/core/java/android/widget/Toolbar.java b/core/java/android/widget/Toolbar.java
index 0f35e0d..c5325c4 100644
--- a/core/java/android/widget/Toolbar.java
+++ b/core/java/android/widget/Toolbar.java
@@ -1101,18 +1101,6 @@ public class Toolbar extends ViewGroup {
* @hide
*/
@Override
- public void addClickableRectsForAccessibility(List<RectF> outRects) {
- // This class always consumes touch events, therefore if it
- // covers a view we do not want to send a click over it.
- RectF bounds = new RectF();
- bounds.set(0, 0, getWidth(), getHeight());
- outRects.add(bounds);
- }
-
- /**
- * @hide
- */
- @Override
protected void onSetLayoutParams(View child, ViewGroup.LayoutParams lp) {
/*
* Apps may set ActionBar.LayoutParams on their action bar custom views when
diff --git a/core/java/com/android/internal/widget/ActionBarContainer.java b/core/java/com/android/internal/widget/ActionBarContainer.java
index e8e2c8d..7937a95 100644
--- a/core/java/com/android/internal/widget/ActionBarContainer.java
+++ b/core/java/com/android/internal/widget/ActionBarContainer.java
@@ -227,18 +227,6 @@ public class ActionBarContainer extends FrameLayout {
return true;
}
- /**
- * @hide
- */
- @Override
- public void addClickableRectsForAccessibility(List<RectF> outRects) {
- // This class always consumes touch events, therefore if it
- // covers a view we do not want to send a click over it.
- RectF bounds = new RectF();
- bounds.set(0, 0, getWidth(), getHeight());
- outRects.add(bounds);
- }
-
@Override
public boolean onHoverEvent(MotionEvent ev) {
super.onHoverEvent(ev);