Skip to content

Commit 9ac663e

Browse files
Jeff BrownAndroid (Google) Code Review
authored andcommitted
Merge "Disable input dispatch until boot finished." into jb-dev
2 parents c8ade15 + c042ee2 commit 9ac663e

File tree

5 files changed

+17
-7
lines changed

5 files changed

+17
-7
lines changed

core/java/android/view/WindowManagerPolicy.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1017,7 +1017,7 @@ interface OnKeyguardExitResult {
10171017

10181018
/**
10191019
* Called when we have finished booting and can now display the home
1020-
* screen to the user. This wilWl happen after systemReady(), and at
1020+
* screen to the user. This will happen after systemReady(), and at
10211021
* this point the display is active.
10221022
*/
10231023
public void enableScreenAfterBoot();

services/input/InputDispatcher.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ InputDispatcher::InputDispatcher(const sp<InputDispatcherPolicyInterface>& polic
185185
mPolicy(policy),
186186
mPendingEvent(NULL), mAppSwitchSawKeyDown(false), mAppSwitchDueTime(LONG_LONG_MAX),
187187
mNextUnblockedEvent(NULL),
188-
mDispatchEnabled(true), mDispatchFrozen(false), mInputFilterEnabled(false),
188+
mDispatchEnabled(false), mDispatchFrozen(false), mInputFilterEnabled(false),
189189
mInputTargetWaitCause(INPUT_TARGET_WAIT_CAUSE_NONE) {
190190
mLooper = new Looper(false);
191191

services/java/com/android/server/am/ActivityManagerService.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4098,6 +4098,10 @@ void enableScreenAfterBoot() {
40984098
EventLog.writeEvent(EventLogTags.BOOT_PROGRESS_ENABLE_SCREEN,
40994099
SystemClock.uptimeMillis());
41004100
mWindowManager.enableScreenAfterBoot();
4101+
4102+
synchronized (this) {
4103+
updateEventDispatchingLocked();
4104+
}
41014105
}
41024106

41034107
public void showBootMessage(final CharSequence msg, final boolean always) {
@@ -6686,7 +6690,7 @@ public void goingToSleep() {
66866690

66876691
synchronized(this) {
66886692
mWentToSleep = true;
6689-
mWindowManager.setEventDispatching(false);
6693+
updateEventDispatchingLocked();
66906694

66916695
if (!mSleeping) {
66926696
mSleeping = true;
@@ -6712,7 +6716,7 @@ public boolean shutdown(int timeout) {
67126716

67136717
synchronized(this) {
67146718
mShuttingDown = true;
6715-
mWindowManager.setEventDispatching(false);
6719+
updateEventDispatchingLocked();
67166720

67176721
if (mMainStack.mResumedActivity != null) {
67186722
mMainStack.stopIfSleepingLocked();
@@ -6776,11 +6780,15 @@ public void wakingUp() {
67766780

67776781
synchronized(this) {
67786782
mWentToSleep = false;
6779-
mWindowManager.setEventDispatching(true);
6783+
updateEventDispatchingLocked();
67806784
comeOutOfSleepIfNeededLocked();
67816785
}
67826786
}
67836787

6788+
private void updateEventDispatchingLocked() {
6789+
mWindowManager.setEventDispatching(mBooted && !mWentToSleep && !mShuttingDown);
6790+
}
6791+
67846792
public void setLockScreenShown(boolean shown) {
67856793
if (checkCallingPermission(android.Manifest.permission.DEVICE_POWER)
67866794
!= PackageManager.PERMISSION_GRANTED) {

services/java/com/android/server/wm/InputMonitor.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ final class InputMonitor implements InputManagerService.Callbacks {
4141
private boolean mInputDispatchFrozen;
4242

4343
// When true, input dispatch proceeds normally. Otherwise all events are dropped.
44-
private boolean mInputDispatchEnabled = true;
44+
// Initially false, so that input does not get dispatched until boot is finished at
45+
// which point the ActivityManager will enable dispatching.
46+
private boolean mInputDispatchEnabled;
4547

4648
// When true, need to call updateInputWindowsLw().
4749
private boolean mUpdateInputWindowsNeeded = true;

services/java/com/android/server/wm/WindowManagerService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5149,7 +5149,7 @@ public void performEnableScreen() {
51495149
//Slog.i(TAG, "******* TELLING SURFACE FLINGER WE ARE BOOTED!");
51505150
Parcel data = Parcel.obtain();
51515151
data.writeInterfaceToken("android.ui.ISurfaceComposer");
5152-
surfaceFlinger.transact(IBinder.FIRST_CALL_TRANSACTION,
5152+
surfaceFlinger.transact(IBinder.FIRST_CALL_TRANSACTION, // BOOT_FINISHED
51535153
data, null, 0);
51545154
data.recycle();
51555155
}

0 commit comments

Comments
 (0)