Remove ActivityRecord#okToShowLocked

ActivityRecord#showToCurrentUser also checks show-for-all-users flag
and current user/profile, so replace it by showToCurrentUser() that
will be consistent with the condition for window.

This eliminates unnecessary clearing binder identity and massive
invocations to StorageManagerService that acquires another lock.
In general the check becomes 10x faster.

The encryption check was added in commit 8558ec7. Since start process
is changed to async, and the lock in handling user switch and
activities are separated, the recursive restart case no longer happens.
So it can be removed now.

Bug: 193661576
Test: atest RootWindowContainerTests
Test: Create a profile user with credential.
      Launch some activities of the profile user.
      Invoke UserManager#evictCredentialEncryptionKey and observe
      there should be no crash and exception from apps.

Change-Id: If088cf1712c7f784826ccbcf6c38aeff84f22e7e
9 files changed