Merge "Fix calls to Rect.intersect(Rect)" into mnc-dev
diff --git a/media/java/android/media/Image.java b/media/java/android/media/Image.java
index e18e9a3..045216b 100644
--- a/media/java/android/media/Image.java
+++ b/media/java/android/media/Image.java
@@ -228,7 +228,9 @@
if (cropRect != null) {
cropRect = new Rect(cropRect); // make a copy
- cropRect.intersect(0, 0, getWidth(), getHeight());
+ if (!cropRect.intersect(0, 0, getWidth(), getHeight())) {
+ cropRect.setEmpty();
+ }
}
mCropRect = cropRect;
}
diff --git a/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java b/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java
index 860939c..d4c3194 100644
--- a/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java
+++ b/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java
@@ -3240,8 +3240,7 @@
// Clip to the window bounds.
Rect windowBounds = mTempRect1;
getWindowBounds(focus.getWindowId(), windowBounds);
- boundsInScreen.intersect(windowBounds);
- if (boundsInScreen.isEmpty()) {
+ if (!boundsInScreen.intersect(windowBounds)) {
return false;
}
@@ -3255,8 +3254,7 @@
// Clip to the screen bounds.
Point screenSize = mTempPoint;
mDefaultDisplay.getRealSize(screenSize);
- boundsInScreen.intersect(0, 0, screenSize.x, screenSize.y);
- if (boundsInScreen.isEmpty()) {
+ if (!boundsInScreen.intersect(0, 0, screenSize.x, screenSize.y)) {
return false;
}