Fix window disappearing when docking a second app

When moving app1 to docked stack, the app2 is resized while in background
(fullscreen stack). Because of the config change, mWillReplaceWindow is 
marked true. But since the app2 is in GONE state, all updates of mFrame
are skipped. When it's made visible again, because mWillReplaceWindow is
set, update of mFrame in computeFrameLw() is still skipped, resulting in
wrong mFrame being used.

The fix here is to not set mWillReplaceWindow if the app is not visible,
as we don't need to preserve old window.

Also fix position change check.

bug: 25937471
Change-Id: Iea506296ebd5c2a108368fb2d1d77cdc31a36cdc
2 files changed