Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 83754537 authored by Tiger Huang's avatar Tiger Huang
Browse files

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
parent 1e5e8eca
Loading
Loading
Loading
Loading
+5 −4
Original line number Original line Diff line number Diff line
@@ -5118,17 +5118,18 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
        float9[Matrix.MSKEW_Y] = mWinAnimator.mDtDx;
        float9[Matrix.MSKEW_Y] = mWinAnimator.mDtDx;
        float9[Matrix.MSKEW_X] = mWinAnimator.mDtDy;
        float9[Matrix.MSKEW_X] = mWinAnimator.mDtDy;
        float9[Matrix.MSCALE_Y] = mWinAnimator.mDsDy;
        float9[Matrix.MSCALE_Y] = mWinAnimator.mDsDy;
        int x = mSurfacePosition.x;
        transformSurfaceInsetsPosition(mTmpPoint, mAttrs.surfaceInsets);
        int y = mSurfacePosition.y;
        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
        // 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.
        // computes the global location of our display.
        DisplayContent dc = getDisplayContent();
        DisplayContent dc = getDisplayContent();
        while (dc != null && dc.getParentWindow() != null) {
        while (dc != null && dc.getParentWindow() != null) {
            final WindowState displayParent = dc.getParentWindow();
            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);
                    + (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.getLocationInParentWindow().y * displayParent.mGlobalScale + 0.5f);
            dc = displayParent.getDisplayContent();
            dc = displayParent.getDisplayContent();
        }
        }
+1 −0
Original line number Original line Diff line number Diff line
@@ -646,6 +646,7 @@ public class WindowStateTests extends WindowTestsBase {
        final WindowState win1 = createWindow(null, TYPE_APPLICATION, dc, "win1");
        final WindowState win1 = createWindow(null, TYPE_APPLICATION, dc, "win1");
        win1.mHasSurface = true;
        win1.mHasSurface = true;
        win1.mSurfaceControl = mock(SurfaceControl.class);
        win1.mSurfaceControl = mock(SurfaceControl.class);
        win1.mAttrs.surfaceInsets.set(1, 2, 3, 4);
        win1.getFrameLw().offsetTo(WINDOW_OFFSET, 0);
        win1.getFrameLw().offsetTo(WINDOW_OFFSET, 0);
        win1.updateSurfacePosition(t);
        win1.updateSurfacePosition(t);
        win1.getTransformationMatrix(values, matrix);
        win1.getTransformationMatrix(values, matrix);