Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4b4971b8 authored by Jeff Brown's avatar Jeff Brown
Browse files

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
parent 82379ba8
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -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());
+1 −1
Original line number Diff line number Diff line
@@ -2176,7 +2176,7 @@ public final class ActivityStackSupervisor implements DisplayListener {
        //mWindowManager.dump();

        if (enableScreen) {
            mService.enableScreenAfterBoot();
            mService.postEnableScreenAfterBootLocked();
        }

        if (activityRemoved) {