Update visibility in moveTaskToBack if nothing is resumed

If it's possible that nothing will be resumed by moveTaskToBack (ie.
moving a freeform window to back in a multi-resume environment), then
we need to ensure that visibility is updated after re-ordering since
there will be no lifecycle changes to do it.

Bug: 134182971
Test: Open an app in freeform and move it to back. Observe it
      going invisible with a transition.

Change-Id: Iee7457ba7b8a7dc8385bed3a9434ab7c2490f14a
This commit is contained in:
Evan Rosky
2019-05-31 20:18:02 -07:00
parent 26fdabb9a0
commit 80b2cb7080

View File

@@ -4979,6 +4979,17 @@ class ActivityStack extends ConfigurationContainer {
return true;
}
ActivityRecord topActivity = getDisplay().topRunningActivity();
ActivityStack topStack = topActivity.getActivityStack();
if (topStack != null && topStack != this && topActivity.isState(RESUMED)) {
// The new top activity is already resumed, so there's a good chance that nothing will
// get resumed below. So, update visibility now in case the transition is closed
// prematurely.
mRootActivityContainer.ensureVisibilityAndConfig(null /* starting */,
getDisplay().mDisplayId, false /* markFrozenIfConfigChanged */,
false /* deferResume */);
}
mRootActivityContainer.resumeFocusedStacksTopActivities();
return true;
}