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
This commit is contained in:
bepheis gao
2020-08-11 16:09:18 +08:00
committed by Louis Chang
parent a8a2aa7765
commit d9c44734e7

View File

@@ -5347,15 +5347,6 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
return mAmInternal.isBackgroundActivityStartsEnabled(); return mAmInternal.isBackgroundActivityStartsEnabled();
} }
void enableScreenAfterBoot(boolean booted) {
writeBootProgressEnableScreen(SystemClock.uptimeMillis());
mWindowManager.enableScreenAfterBoot();
synchronized (mGlobalLock) {
updateEventDispatchingLocked(booted);
}
}
static long getInputDispatchingTimeoutMillisLocked(ActivityRecord r) { static long getInputDispatchingTimeoutMillisLocked(ActivityRecord r) {
if (r == null || !r.hasProcess()) { if (r == null || !r.hasProcess()) {
return DEFAULT_DISPATCHING_TIMEOUT_MILLIS; return DEFAULT_DISPATCHING_TIMEOUT_MILLIS;
@@ -6449,9 +6440,9 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
@Override @Override
public void enableScreenAfterBoot(boolean booted) { public void enableScreenAfterBoot(boolean booted) {
writeBootProgressEnableScreen(SystemClock.uptimeMillis());
mWindowManager.enableScreenAfterBoot();
synchronized (mGlobalLock) { synchronized (mGlobalLock) {
writeBootProgressEnableScreen(SystemClock.uptimeMillis());
mWindowManager.enableScreenAfterBoot();
updateEventDispatchingLocked(booted); updateEventDispatchingLocked(booted);
} }
} }