diff options
author | 2014-07-25 19:30:05 -0700 | |
---|---|---|
committer | 2014-07-25 19:31:47 -0700 | |
commit | 4b4971b8a31f29e9dd3d27d54a49914a7c3ec1fb (patch) | |
tree | 9ffd8fb6b6052b4877adc518bfa7a31b72482dcd | |
parent | 82379ba8ddc04116a40aa177df4ef6c2aa428a69 (diff) |
Fix a deadlock due to AMS calling into WMS with its lock held.
The full deadlock cycle involved ActivityManagerService,
WindowManagerService, and DevicePolicyManagerService.
Fixed by posting the work of enabling the screen to the handler
instead of doing it immediately while holding the activity manager
lock.
Bug: 16578860
Change-Id: I10514cd2df993c7193747ae823e1990a2c34e196
-rwxr-xr-x | services/core/java/com/android/server/am/ActivityManagerService.java | 9 | ||||
-rw-r--r-- | services/core/java/com/android/server/am/ActivityStackSupervisor.java | 2 |
2 files changed, 10 insertions, 1 deletions
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java index 3f95ae2b3c49..36093c00f133 100755 --- a/services/core/java/com/android/server/am/ActivityManagerService.java +++ b/services/core/java/com/android/server/am/ActivityManagerService.java @@ -1159,6 +1159,7 @@ public final class ActivityManagerService extends ActivityManagerNative static final int SYSTEM_USER_START_MSG = 42; static final int SYSTEM_USER_CURRENT_MSG = 43; static final int ENTER_ANIMATION_COMPLETE_MSG = 44; + static final int ENABLE_SCREEN_AFTER_BOOT_MSG = 45; static final int FIRST_ACTIVITY_STACK_MSG = 100; static final int FIRST_BROADCAST_QUEUE_MSG = 200; @@ -1826,6 +1827,10 @@ public final class ActivityManagerService extends ActivityManagerNative } break; } + case ENABLE_SCREEN_AFTER_BOOT_MSG: { + enableScreenAfterBoot(); + break; + } } } }; @@ -5525,6 +5530,10 @@ public final class ActivityManagerService extends ActivityManagerNative Binder.restoreCallingIdentity(origId); } + void postEnableScreenAfterBootLocked() { + mHandler.sendEmptyMessage(ENABLE_SCREEN_AFTER_BOOT_MSG); + } + void enableScreenAfterBoot() { EventLog.writeEvent(EventLogTags.BOOT_PROGRESS_ENABLE_SCREEN, SystemClock.uptimeMillis()); diff --git a/services/core/java/com/android/server/am/ActivityStackSupervisor.java b/services/core/java/com/android/server/am/ActivityStackSupervisor.java index 690b90a1f56e..48ed5ea6f120 100644 --- a/services/core/java/com/android/server/am/ActivityStackSupervisor.java +++ b/services/core/java/com/android/server/am/ActivityStackSupervisor.java @@ -2176,7 +2176,7 @@ public final class ActivityStackSupervisor implements DisplayListener { //mWindowManager.dump(); if (enableScreen) { - mService.enableScreenAfterBoot(); + mService.postEnableScreenAfterBootLocked(); } if (activityRemoved) { |