Only clear mInputMethodInputTarget if it is moved to the new display

onDisplayChanged can also be invoked when the configuration is
changed on the display. In this case, we should not clear
mInputMethodInputTarget.

Bug: 154108034
Test: atest MultiDisplayClientTests
Change-Id: Ic6d9bcb12fde5f7718f9475f228bab33aac49d25
This commit is contained in:
Tiger Huang
2020-04-16 19:25:11 +08:00
parent ee35eba00e
commit 2a8931a2f3

View File

@@ -1469,7 +1469,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
@Override
void onDisplayChanged(DisplayContent dc) {
if (dc != null && mDisplayContent != null
if (dc != null && mDisplayContent != null && dc != mDisplayContent
&& mDisplayContent.mInputMethodInputTarget == this) {
dc.setInputMethodInputTarget(mDisplayContent.mInputMethodInputTarget);
mDisplayContent.mInputMethodInputTarget = null;