Avoid applying closing animation for invisible activity.

In case an invisible activity requests to become invisible, we don't
apply app transition animation on it. We already have a logic to prevent
this in ActivityRecord#setVisibility, but it cannot handle the following
scenario.

1. Activity is initially invisible.
2. Activity requests to become visible.
3. Activity requests to become invisible (so this override the second
   step).

So this change fills the gap.

Test: atest ActivityRecordTests
Bug: 184107777
Merged-In: I50a0f3a8ea49beb5c86fff0f6bb8c005db581a6d
Change-Id: I50a0f3a8ea49beb5c86fff0f6bb8c005db581a6d
3 files changed