From 04c355ad8efb0845fda7fa399c5b19f13fe859a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Ciche=C5=84ski?= Date: Wed, 13 Jul 2022 22:55:55 +0000 Subject: [PATCH] Ignore the Recents animation target when collecting keep clear areas. In phone it is possible that user e.g. swipes up to close full screen app / go home, and there could be underlying windows beneath it that are trying to register keep clear areas, but due to window ordering and top-to-bottom lookup, they would never get a chance to report them and trigger the onKeepClearAreasChanged, since the full screen app is still on top of the list and the loop exits early. However, that app is simply being animated and should no longer impact this logic. Test: atest DisplayContentTests#testKeepClearAreasMultipleWindows Test: atest WindowStateTests#testKeepClearAreas Bug: 183746978 Change-Id: I735a9cfbc9b069d22709e96c61f776104fea1501 --- .../core/java/com/android/server/wm/DisplayContent.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/services/core/java/com/android/server/wm/DisplayContent.java b/services/core/java/com/android/server/wm/DisplayContent.java index 124b8a654a785..85be10820044a 100644 --- a/services/core/java/com/android/server/wm/DisplayContent.java +++ b/services/core/java/com/android/server/wm/DisplayContent.java @@ -5689,7 +5689,16 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp void getKeepClearAreas(Set outRestricted, Set outUnrestricted) { final Matrix tmpMatrix = new Matrix(); final float[] tmpFloat9 = new float[9]; + final RecentsAnimationController recentsAnimationController = + mWmService.getRecentsAnimationController(); forAllWindows(w -> { + // Skip the window if it is part of Recents animation + final boolean ignoreRecentsAnimationTarget = recentsAnimationController != null + && recentsAnimationController.shouldApplyInputConsumer(w.getActivityRecord()); + if (ignoreRecentsAnimationTarget) { + return false; // continue traversal + } + if (w.isVisible() && !w.inPinnedWindowingMode()) { w.getKeepClearAreas(outRestricted, outUnrestricted, tmpMatrix, tmpFloat9); }