Disable input dispatch until boot finished.
Bug: 6263070
Change-Id: I25e15e3d8af8eb3343c7b684fec345337d9f6aab
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java
index 4b40107..736118e 100644
--- a/services/java/com/android/server/am/ActivityManagerService.java
+++ b/services/java/com/android/server/am/ActivityManagerService.java
@@ -4098,6 +4098,10 @@
EventLog.writeEvent(EventLogTags.BOOT_PROGRESS_ENABLE_SCREEN,
SystemClock.uptimeMillis());
mWindowManager.enableScreenAfterBoot();
+
+ synchronized (this) {
+ updateEventDispatchingLocked();
+ }
}
public void showBootMessage(final CharSequence msg, final boolean always) {
@@ -6686,7 +6690,7 @@
synchronized(this) {
mWentToSleep = true;
- mWindowManager.setEventDispatching(false);
+ updateEventDispatchingLocked();
if (!mSleeping) {
mSleeping = true;
@@ -6712,7 +6716,7 @@
synchronized(this) {
mShuttingDown = true;
- mWindowManager.setEventDispatching(false);
+ updateEventDispatchingLocked();
if (mMainStack.mResumedActivity != null) {
mMainStack.stopIfSleepingLocked();
@@ -6776,11 +6780,15 @@
synchronized(this) {
mWentToSleep = false;
- mWindowManager.setEventDispatching(true);
+ updateEventDispatchingLocked();
comeOutOfSleepIfNeededLocked();
}
}
+ private void updateEventDispatchingLocked() {
+ mWindowManager.setEventDispatching(mBooted && !mWentToSleep && !mShuttingDown);
+ }
+
public void setLockScreenShown(boolean shown) {
if (checkCallingPermission(android.Manifest.permission.DEVICE_POWER)
!= PackageManager.PERMISSION_GRANTED) {