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
1 file changed