From 92d9c818352fa893fc70c05c05eacc35cd0589cd Mon Sep 17 00:00:00 2001 From: "seunghyun85.lee" Date: Thu, 26 Feb 2015 11:24:08 +0900 Subject: Apply the scale to surfaceinsets when computing crop region While in computing surface crop region, magnification specs are not applied to surface insets from LayoutParams. So, in case magnification specs are set, surface crop region should be calculated considering scale factor. (For instance, using TouchZoom in Accessibility at AppsPermissionActivity in market app) Bug: 20863078 Change-Id: I9e7e21e502b29208f2856918d6fcda050f515595 Signed-off-by: Seunghyun Lee --- .../com/android/server/wm/WindowStateAnimator.java | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/services/core/java/com/android/server/wm/WindowStateAnimator.java b/services/core/java/com/android/server/wm/WindowStateAnimator.java index 1b5d0b8778ab..91e422f1de22 100644 --- a/services/core/java/com/android/server/wm/WindowStateAnimator.java +++ b/services/core/java/com/android/server/wm/WindowStateAnimator.java @@ -1417,10 +1417,21 @@ class WindowStateAnimator { // Adjust for surface insets. final LayoutParams attrs = w.getAttrs(); - width += attrs.surfaceInsets.left + attrs.surfaceInsets.right; - height += attrs.surfaceInsets.top + attrs.surfaceInsets.bottom; - left -= attrs.surfaceInsets.left; - top -= attrs.surfaceInsets.top; + final int displayId = w.getDisplayId(); + float scale = 1.0f; + // Magnification is supported only for the default display. + if (mService.mAccessibilityController != null && displayId == Display.DEFAULT_DISPLAY) { + MagnificationSpec spec = + mService.mAccessibilityController.getMagnificationSpecForWindowLocked(w); + if (spec != null && !spec.isNop()) { + scale = spec.scale; + } + } + + width += scale * (attrs.surfaceInsets.left + attrs.surfaceInsets.right); + height += scale * (attrs.surfaceInsets.top + attrs.surfaceInsets.bottom); + left -= scale * attrs.surfaceInsets.left; + top -= scale * attrs.surfaceInsets.top; final boolean surfaceMoved = mSurfaceX != left || mSurfaceY != top; if (surfaceMoved) { -- cgit v1.2.3-59-g8ed1b