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

Commit a312f816 authored by bepheis gao's avatar bepheis gao Committed by Louis Chang
Browse files

Avoid deadlock during boot up

Cp from aosp/1382500 to fix merge conflict

Avoid a deadlock that may occurs during boosting time.
if we are starting system ui while another thread is executing
the enableScreenAfterBoot function at the same time,
the deadlock occurs

BUG: 162566198

Change-Id: Ief47cad91cbbc498179cd38e653bd1fa565cee2e
Merged-In: Ief47cad91cbbc498179cd38e653bd1fa565cee2e
parent 143f714e
Loading
Loading
Loading
Loading
+2 −11
Original line number Diff line number Diff line
@@ -5380,15 +5380,6 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
        return mAmInternal.isBackgroundActivityStartsEnabled();
    }

    void enableScreenAfterBoot(boolean booted) {
        writeBootProgressEnableScreen(SystemClock.uptimeMillis());
        mWindowManager.enableScreenAfterBoot();

        synchronized (mGlobalLock) {
            updateEventDispatchingLocked(booted);
        }
    }

    static long getInputDispatchingTimeoutLocked(ActivityRecord r) {
        if (r == null || !r.hasProcess()) {
            return KEY_DISPATCHING_TIMEOUT_MS;
@@ -6474,9 +6465,9 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {

        @Override
        public void enableScreenAfterBoot(boolean booted) {
            synchronized (mGlobalLock) {
            writeBootProgressEnableScreen(SystemClock.uptimeMillis());
            mWindowManager.enableScreenAfterBoot();
            synchronized (mGlobalLock) {
                updateEventDispatchingLocked(booted);
            }
        }