From f057fb56f69f8cb1bdee086c73f9d4efe8e331c4 Mon Sep 17 00:00:00 2001 From: John Reck Date: Fri, 15 Apr 2016 13:46:29 -0700 Subject: [PATCH] Fix sw legacy compat path in SurfaceView Fixes: 28074239 Need to convert from scaled window to screen before updating position of the SurfaceView Change-Id: I75dec23408c32ec01e88193ea38b1fb253b3fd6f --- core/java/android/view/SurfaceView.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/core/java/android/view/SurfaceView.java b/core/java/android/view/SurfaceView.java index 8a8fb43cc3d41..ccb5ec467b1ef 100644 --- a/core/java/android/view/SurfaceView.java +++ b/core/java/android/view/SurfaceView.java @@ -648,13 +648,19 @@ public class SurfaceView extends View { transformFromViewToWindowSpace(mLocation); + mWinFrame.set(mWindowSpaceLeft, mWindowSpaceTop, + mLocation[0], mLocation[1]); + + if (mTranslator != null) { + mTranslator.translateRectInAppWindowToScreen(mWinFrame); + } + try { Log.d(TAG, String.format("updateWindowPosition UI, " + - "postion = [%d, %d, %d, %d]", mWindowSpaceLeft, mWindowSpaceTop, - mLocation[0], mLocation[1])); - mSession.repositionChild(mWindow, mWindowSpaceLeft, mWindowSpaceTop, - mLocation[0], mLocation[1], - -1, mWinFrame); + "postion = [%d, %d, %d, %d]", mWinFrame.left, mWinFrame.top, + mWinFrame.right, mWinFrame.bottom)); + mSession.repositionChild(mWindow, mWinFrame.left, mWinFrame.top, + mWinFrame.right, mWinFrame.bottom, -1, mWinFrame); } catch (RemoteException ex) { Log.e(TAG, "Exception from relayout", ex); }