Restart the user only after the key is evicted.

This solves a race condition that occurs during
DMP.lockNow(FLAG_EVICT_CREDENTIAL_ENCRYPTION_KEY) when the user is
restarted too early and key eviction is skipped to avoid data
corruption in the user startup.

Fixes: 130337379
Test: atest com.android.cts.devicepolicy.ManagedProfileTest#testLockNowWithKeyEviction
Change-Id: Ie411b502a44201726b18314204ec78ee90d204d0
3 files changed