Exclude translation caused by surface insets from the matrix
The matrix returned from getTransformationMatrix is used by a11y controller for computing the touchable region. Since the touchable region doesn't include the surface insets area, the translation in the method should not be affected by surface insets. Fix: 151868913 Test: atest WindowStateTests Change-Id: I1ae58716d7270a58d527b807b74cdadc6e4624ab
This commit is contained in:
@@ -5118,17 +5118,18 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
||||
float9[Matrix.MSKEW_Y] = mWinAnimator.mDtDx;
|
||||
float9[Matrix.MSKEW_X] = mWinAnimator.mDtDy;
|
||||
float9[Matrix.MSCALE_Y] = mWinAnimator.mDsDy;
|
||||
int x = mSurfacePosition.x;
|
||||
int y = mSurfacePosition.y;
|
||||
transformSurfaceInsetsPosition(mTmpPoint, mAttrs.surfaceInsets);
|
||||
int x = mSurfacePosition.x + mTmpPoint.x;
|
||||
int y = mSurfacePosition.y + mTmpPoint.y;
|
||||
|
||||
// We might be on a display which has been re-parented to a view in another window, so here
|
||||
// computes the global location of our display.
|
||||
DisplayContent dc = getDisplayContent();
|
||||
while (dc != null && dc.getParentWindow() != null) {
|
||||
final WindowState displayParent = dc.getParentWindow();
|
||||
x += displayParent.mWindowFrames.mFrame.left - displayParent.mAttrs.surfaceInsets.left
|
||||
x += displayParent.mWindowFrames.mFrame.left
|
||||
+ (dc.getLocationInParentWindow().x * displayParent.mGlobalScale + 0.5f);
|
||||
y += displayParent.mWindowFrames.mFrame.top - displayParent.mAttrs.surfaceInsets.top
|
||||
y += displayParent.mWindowFrames.mFrame.top
|
||||
+ (dc.getLocationInParentWindow().y * displayParent.mGlobalScale + 0.5f);
|
||||
dc = displayParent.getDisplayContent();
|
||||
}
|
||||
|
||||
@@ -646,6 +646,7 @@ public class WindowStateTests extends WindowTestsBase {
|
||||
final WindowState win1 = createWindow(null, TYPE_APPLICATION, dc, "win1");
|
||||
win1.mHasSurface = true;
|
||||
win1.mSurfaceControl = mock(SurfaceControl.class);
|
||||
win1.mAttrs.surfaceInsets.set(1, 2, 3, 4);
|
||||
win1.getFrameLw().offsetTo(WINDOW_OFFSET, 0);
|
||||
win1.updateSurfacePosition(t);
|
||||
win1.getTransformationMatrix(values, matrix);
|
||||
|
||||
Reference in New Issue
Block a user