Fix IME screenshot position in 3-button landscape mode

CL[1] offsetted the IME screenshot position with the
IME layering target frame {left, top} when the window is
in fullscreen windowing mode.

As IME screenshot has been positioned according the IME frame
position with fiting navigation/status bar,
offseted with the layering target position again will result
the IME screenshot been shifted when in 3-button landscape mode.

[1]: I9228740cbf060a01fe985eb37c94c6abae6f79f8

Bug: 201139553
Test: manual as steps:
    0) Go to Settings > Gestures > System navigation > 3-button
    1) Launch an app with showing IME by tapping the editor.
    2) Rotate the device to landscape mode
    3) Pressing home key and expect the IME snapshot should not shifted

Change-Id: I81b584254b2c4daf864ed3e13063310ceeda467a
This commit is contained in:
Ming-Shin Lu
2022-03-18 21:42:15 +08:00
parent 4f75d8cc24
commit efeee0fdaa

View File

@@ -4076,12 +4076,12 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
t.setColorSpace(activity.mSurfaceControl, ColorSpace.get(ColorSpace.Named.SRGB));
t.setLayer(imeSurface, 1);
final Point surfacePosition = new Point(
imeWindow.getFrame().left - mImeTarget.getFrame().left,
imeWindow.getFrame().top - mImeTarget.getFrame().top);
final Point surfacePosition = new Point(imeWindow.getFrame().left,
imeWindow.getFrame().top);
if (imeParent == activity.getSurfaceControl()) {
t.setPosition(imeSurface, surfacePosition.x, surfacePosition.y);
} else {
surfacePosition.offset(-mImeTarget.getFrame().left, -mImeTarget.getFrame().top);
surfacePosition.offset(mImeTarget.mAttrs.surfaceInsets.left,
mImeTarget.mAttrs.surfaceInsets.top);
t.setPosition(imeSurface, surfacePosition.x, surfacePosition.y);