Add IActivityManager.stopUserWithDelayedLocking

- Only allow delayed locking for the explicit call, stopUserWithDelayedLocking()
  or for implicit user stopping caused by user switching.
- All other explicit user stopping should immediately lock the user. This allows
  immediate locking from component like DevicePolicy.
- Product still should enable delayed locking explicitly and if it is disabled,
  IActivityManager.stopUserWithDelayedLocking will behave the same with
  IActivityManager.stopUser.
- Once user is stopped in delayed locking mode, one of following steps can completely
  lock the user (this is not a complete list):
  1. User is asked to be stopped with IActivityManager.stopUser call.
  2. User is restarted through IActivityManager.restartUserInBackground call.
  3. UserManager.evictCredentialEncryptyionKey (involves restartUserInBackground call)
  4. When user is removed (involves IActivityManager.stopUser call).

Bug: 131757355
Test: run unit tests
      check user locking in car device where delayed locking is enabled.

Change-Id: I663ffde3a5b74738a6f59b4282ff562146f22662
4 files changed