diff --git a/services/core/java/com/android/server/wm/DisplayContent.java b/services/core/java/com/android/server/wm/DisplayContent.java index a5ceee268fa26..fecc8da3d6450 100644 --- a/services/core/java/com/android/server/wm/DisplayContent.java +++ b/services/core/java/com/android/server/wm/DisplayContent.java @@ -2506,6 +2506,7 @@ class DisplayContent extends WindowContainer>>>>> ENTERED updateInputWindowsLw"); - - // Populate the input window list with information about all of the windows that - // could potentially receive input. - // As an optimization, we could try to prune the list of windows but this turns - // out to be difficult because only the native code knows for sure which window - // currently has touch focus. - - // If there's a drag in flight, provide a pseudo-window to catch drag input - final boolean inDrag = mService.mDragDropController.dragDropActiveLocked(); - if (inDrag) { - if (DEBUG_DRAG) { - Log.d(TAG_WM, "Inserting drag window"); - } - mService.mDragDropController.showInputSurface(mInputTransaction, mDisplayId); - } else { - mService.mDragDropController.hideInputSurface(mInputTransaction, mDisplayId); + private void scheduleUpdateInputWindows() { + if (mDisplayRemoved) { + return; } - final boolean inPositioning = mService.mTaskPositioningController.isPositioningLocked(); - if (inPositioning) { - if (DEBUG_TASK_POSITIONING) { - Log.d(TAG_WM, "Inserting window handle for repositioning"); - } - mService.mTaskPositioningController.showInputSurface(mInputTransaction, mDisplayId); - } else { - mService.mTaskPositioningController.hideInputSurface(mInputTransaction, mDisplayId); + if (!mUpdateInputWindowsPending) { + mUpdateInputWindowsPending = true; + mHandler.post(mUpdateInputWindows); } - - // Add all windows on the default display. - mUpdateInputForAllWindowsConsumer.updateInputWindows(inDrag); - - if (false) Slog.d(TAG_WM, "<<<<<<< EXITED updateInputWindowsLw"); } /* Called when the current input focus changes. @@ -385,19 +423,18 @@ final class InputMonitor { mTmpRect.setEmpty(); mDisableWallpaperTouchEvents = false; this.inDrag = inDrag; - final DisplayContent dc = mService.mRoot.getDisplayContent(mDisplayId); - wallpaperController = dc.mWallpaperController; + wallpaperController = mDisplayContent.mWallpaperController; resetInputConsumers(mInputTransaction); - dc.forAllWindows(this, + mDisplayContent.forAllWindows(this, true /* traverseTopToBottom */); if (mAddWallpaperInputConsumerHandle) { wallpaperInputConsumer.show(mInputTransaction, 0); } - dc.scheduleAnimation(); + mDisplayContent.scheduleAnimation(); Trace.traceEnd(Trace.TRACE_TAG_WINDOW_MANAGER); }