From 280cb21137da953ab3a8acae08ea33a4d381bb10 Mon Sep 17 00:00:00 2001 From: lumark Date: Mon, 9 Sep 2019 09:47:22 +0800 Subject: [PATCH] Make sure to clear previous display's last focus window when reparenting task This CL is to fix IME can't show up on reparented task in auto device with per-display focus enabled. When reparenting task from display A to display B, if the current display focus from display of the task changed to another display (i.e. received a pointer outside touch), It made in DisplayContent#reParentWindowToken logic won't clear prevDc#mLastFocus (the reparent task's window in previous display), since mCurrentFocus (the target display's window) is not the same as prevDc#mLastFocus during reparent, caused the client side will end up receive window focus lost change (this issue won't happen w/o per-display focus, since prevDc#mLastFocus will always null due to only single focus window), so IME can't show up when tapping the EditText of the reparented task. The fix is to consolide clear prevDc#mLastFocus check, if last focused window of previous display is contained in a reparented window token, which means the reparent task will end up to gain window focus on the target display & won't need to receive focus lost event from previous display & the state should be cleared. Bug: 136503036 Test: atest MultiDisplaySystemDecorationTests#testImeWindowCanShownWhenActivityMovedToDisplay Change-Id: Ifd5b7bbf381440c302194c9efff595bf51b5b42b --- .../core/java/com/android/server/wm/DisplayContent.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/services/core/java/com/android/server/wm/DisplayContent.java b/services/core/java/com/android/server/wm/DisplayContent.java index e099a4f0c91c8..bafb0d1e26a4e 100644 --- a/services/core/java/com/android/server/wm/DisplayContent.java +++ b/services/core/java/com/android/server/wm/DisplayContent.java @@ -1072,9 +1072,10 @@ class DisplayContent extends WindowContainer