OSDN Git Service

Serialize key eviction vs. user storage preparation
authorPavel Grafov <pgrafov@google.com>
Tue, 10 Apr 2018 18:19:01 +0000 (19:19 +0100)
committerPavel Grafov <pgrafov@google.com>
Wed, 18 Apr 2018 16:19:19 +0000 (17:19 +0100)
commit634c34ea179cf42507665e9f30d21acba8112992
tree32272d2ade06beca7dcf94cc46b6fabab1fefb5f
parent5037beea1c118ee9aa9d9d3f314a228d5f80c727
Serialize key eviction vs. user storage preparation

UserManagerService.onBeforeUnlockUser requires unlocked user key
and is executed on FgThread. Currently key may be locked from
a different thread: UserController.finishUserStopped is executed in
mHandler. This changes moves lockUserKey part to FgThread, so that
key state can be reliably checked before starting onBeforeUnlockUser.

In the worst case user will be RUNNING_LOCKED with "Some functionality
may be limited" warning and unable to start apps. But that seems
fairly harmless.

+ got rid of redundant boolean in finishUserStopped.

Fixes: 72334925
Test: Turn work mode on and off ad nauseam
Test cts-tradefed run commandAndExit cts-dev -m CtsDevicePolicyManagerTestCases
     -t com.android.cts.devicepolicy.ManagedProfileTest
Test: creating another user and swithching back and forth
Test: exercising DPMS.lockNow(FLAG_EVICT_CREDENTIAL_ENCRYPTION_KEY) via TestDPC

Change-Id: I01d4dea183fd1a35a2e47284c7a544725e8a871f
services/core/java/com/android/server/am/UserController.java