diff options
| author | 2015-05-30 00:31:45 +0000 | |
|---|---|---|
| committer | 2015-05-30 00:31:47 +0000 | |
| commit | 1501da4bae9b50be885de4480d0f318b7e8da27d (patch) | |
| tree | dc98b124e3c50dabf753c6394b37ee0e89c17d55 | |
| parent | 67f0df07381a08cc4a733e7fae58d3156da12bea (diff) | |
| parent | 9607fbe9d70dd350e5f4a5f3862fa95816780c94 (diff) | |
Merge "Fix calls to Rect.intersect() in package android.view" into mnc-dev
| -rw-r--r-- | core/java/android/view/AccessibilityInteractionController.java | 5 | ||||
| -rw-r--r-- | core/java/android/view/ViewGroup.java | 12 | ||||
| -rw-r--r-- | core/java/android/view/ViewRootImpl.java | 6 |
3 files changed, 19 insertions, 4 deletions
diff --git a/core/java/android/view/AccessibilityInteractionController.java b/core/java/android/view/AccessibilityInteractionController.java index 3781d404ff42..6e2d11061bb2 100644 --- a/core/java/android/view/AccessibilityInteractionController.java +++ b/core/java/android/view/AccessibilityInteractionController.java @@ -758,7 +758,10 @@ final class AccessibilityInteractionController { Rect visibleDisplayFrame = mTempRect2; visibleDisplayFrame.set(0, 0, displayWidth, displayHeight); - visibleWinFrame.intersect(visibleDisplayFrame); + if (!visibleWinFrame.intersect(visibleDisplayFrame)) { + // If there's no intersection with display, set visibleWinFrame empty. + visibleDisplayFrame.setEmpty(); + } if (!visibleWinFrame.intersects(boundsInScreen.left, boundsInScreen.top, boundsInScreen.right, boundsInScreen.bottom)) { diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java index 59f6d9dc12dc..aa9fd9b8c6c6 100644 --- a/core/java/android/view/ViewGroup.java +++ b/core/java/android/view/ViewGroup.java @@ -5225,12 +5225,20 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager descendant.mTop - descendant.mScrollY); if (clipToBounds) { View p = (View) theParent; - rect.intersect(0, 0, p.mRight - p.mLeft, p.mBottom - p.mTop); + boolean intersected = rect.intersect(0, 0, p.mRight - p.mLeft, + p.mBottom - p.mTop); + if (!intersected) { + rect.setEmpty(); + } } } else { if (clipToBounds) { View p = (View) theParent; - rect.intersect(0, 0, p.mRight - p.mLeft, p.mBottom - p.mTop); + boolean intersected = rect.intersect(0, 0, p.mRight - p.mLeft, + p.mBottom - p.mTop); + if (!intersected) { + rect.setEmpty(); + } } rect.offset(descendant.mScrollX - descendant.mLeft, descendant.mScrollY - descendant.mTop); diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java index 89b91f19a741..8d94de3a3f5c 100644 --- a/core/java/android/view/ViewRootImpl.java +++ b/core/java/android/view/ViewRootImpl.java @@ -2791,7 +2791,11 @@ public final class ViewRootImpl implements ViewParent, final AttachInfo attachInfo = mAttachInfo; bounds.offset(0, attachInfo.mViewRootImpl.mScrollY); bounds.offset(-attachInfo.mWindowLeft, -attachInfo.mWindowTop); - bounds.intersect(0, 0, attachInfo.mViewRootImpl.mWidth, attachInfo.mViewRootImpl.mHeight); + if (!bounds.intersect(0, 0, attachInfo.mViewRootImpl.mWidth, + attachInfo.mViewRootImpl.mHeight)) { + // If no intersection, set bounds to empty. + bounds.setEmpty(); + } return !bounds.isEmpty(); } |