Fix bug in magnification coordinate calculation.

We were checking if a coordinate was inside its window before
compensating for magnification.

Bug: 31054088
Change-Id: I4993d84e877fcf3d01382b3cf1c10e2fab58dbba
This commit is contained in:
Phil Weaver
2016-09-13 14:34:22 -07:00
parent cb443c529b
commit 87d96992ea

View File

@@ -3683,13 +3683,6 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
Rect boundsInScreen = mTempRect; Rect boundsInScreen = mTempRect;
focus.getBoundsInScreen(boundsInScreen); focus.getBoundsInScreen(boundsInScreen);
// Clip to the window bounds.
Rect windowBounds = mTempRect1;
getWindowBounds(focus.getWindowId(), windowBounds);
if (!boundsInScreen.intersect(windowBounds)) {
return false;
}
// Apply magnification if needed. // Apply magnification if needed.
MagnificationSpec spec = getCompatibleMagnificationSpecLocked(focus.getWindowId()); MagnificationSpec spec = getCompatibleMagnificationSpecLocked(focus.getWindowId());
if (spec != null && !spec.isNop()) { if (spec != null && !spec.isNop()) {
@@ -3697,6 +3690,13 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
boundsInScreen.scale(1 / spec.scale); boundsInScreen.scale(1 / spec.scale);
} }
// Clip to the window bounds.
Rect windowBounds = mTempRect1;
getWindowBounds(focus.getWindowId(), windowBounds);
if (!boundsInScreen.intersect(windowBounds)) {
return false;
}
// Clip to the screen bounds. // Clip to the screen bounds.
Point screenSize = mTempPoint; Point screenSize = mTempPoint;
mDefaultDisplay.getRealSize(screenSize); mDefaultDisplay.getRealSize(screenSize);