Only set client hidden if both hidden and hiddenRequested

This fixes a bug where clientHidden of Launcher was set to true
too early because of the following flow:
- Open app, then press home
- During the transition relaunch the app

This leads to a new transition being started for which
hiddenRequested=true for Launcher. Then, the old animation
finishes, before the new one gets stared, and Launcher gets client
hidden too early.

More generally this is correct because:
- if (hidden && hiddenRequested) both states agree
- if (!hidden && !hiddenRequested) both states agree as well
- if (hidden && !hiddenRequested): App is becoming visible before
transition has started, so we shouldn't set it to client hidden
- if (!hidden && hiddenRequested): App is becoming invisible before
transition has started. However we need to defer client hidden
until the transition is done.

Bug: 74220420
Test: Open/close apps quickly repeatedly
Test: go/wm-smoke
Change-Id: I6df107fb0be9d2d779c997f0ddf1315bf53d27a5
This commit is contained in:
Jorim Jaggi
2018-03-29 16:29:18 +02:00
parent 0859b46d9d
commit 752cd826b9

View File

@@ -1887,7 +1887,7 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree
"AppWindowToken");
clearThumbnail();
setClientHidden(hiddenRequested);
setClientHidden(isHidden() && hiddenRequested);
if (mService.mInputMethodTarget != null && mService.mInputMethodTarget.mAppToken == this) {
getDisplayContent().computeImeTarget(true /* updateImeTarget */);