diff options
| -rw-r--r-- | services/core/java/com/android/server/wm/InputMonitor.java | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/services/core/java/com/android/server/wm/InputMonitor.java b/services/core/java/com/android/server/wm/InputMonitor.java index d17c10906f06..83fd3fa3bbfe 100644 --- a/services/core/java/com/android/server/wm/InputMonitor.java +++ b/services/core/java/com/android/server/wm/InputMonitor.java @@ -497,12 +497,16 @@ final class InputMonitor { resetInputConsumers(mInputTransaction); // Update recents input consumer layer if active - if (mAddRecentsAnimationInputConsumerHandle - && getWeak(mActiveRecentsActivity) != null) { - final WindowContainer layer = getWeak(mActiveRecentsLayerRef); - mRecentsAnimationInputConsumer.show(mInputTransaction, - layer != null ? layer : getWeak(mActiveRecentsActivity)); - mAddRecentsAnimationInputConsumerHandle = false; + final ActivityRecord activeRecents = getWeak(mActiveRecentsActivity); + if (mAddRecentsAnimationInputConsumerHandle && activeRecents != null + && activeRecents.getSurfaceControl() != null) { + WindowContainer layer = getWeak(mActiveRecentsLayerRef); + layer = layer != null ? layer : activeRecents; + // Handle edge-case for SUW where windows don't exist yet + if (layer.getSurfaceControl() != null) { + mRecentsAnimationInputConsumer.show(mInputTransaction, layer); + mAddRecentsAnimationInputConsumerHandle = false; + } } mDisplayContent.forAllWindows(this, true /* traverseTopToBottom */); updateInputFocusRequest(mRecentsAnimationInputConsumer); |