diff options
| author | 2017-12-12 19:50:57 +0000 | |
|---|---|---|
| committer | 2017-12-12 21:45:45 +0000 | |
| commit | 553b99751c44f8b5bbba26b05e92a0854c654f0a (patch) | |
| tree | 530356fb1a6a51d5ccb2bbbfea072e1caf6afd0f | |
| parent | 7d37e95d5475dd0575232439ce9bf036a9df2b6d (diff) | |
Fix trySetQuietModeDisabled may introduce deadlock
1. UserController.mLock is held
2. mUnlockProgress.addListener
3. Find that it is unlocked and hence, call the onFinished callback
right away.
4. Trying to call the callback in UMS, which calls startIntentSender.
5. startIntentSender requires AMS lock.
So, if there is another thread is holding AMS lock and
waiting for UserController.mLock, deadlock happens.
Test: Try turning on / off work mode
Change-Id: I341c2f1572302863d7972742142aa0f3948cd524
| -rw-r--r-- | services/core/java/com/android/server/am/UserController.java | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/services/core/java/com/android/server/am/UserController.java b/services/core/java/com/android/server/am/UserController.java index 6bd599bb0198..14260c5fb105 100644 --- a/services/core/java/com/android/server/am/UserController.java +++ b/services/core/java/com/android/server/am/UserController.java @@ -926,10 +926,9 @@ class UserController implements Handler.Callback { final Integer userIdInt = userId; mUserLru.remove(userIdInt); mUserLru.add(userIdInt); - - if (unlockListener != null) { - uss.mUnlockProgress.addListener(unlockListener); - } + } + if (unlockListener != null) { + uss.mUnlockProgress.addListener(unlockListener); } if (updateUmState) { mInjector.getUserManagerInternal().setUserState(userId, uss.state); |