Fix checking crop region for home/recents
Wasn't handling split-screen properly. Now it checks if the
home/recents is the top of its "visibility" stack vs top
of root-task. This means it must be the top sibling in either
the displayarea or the root-split. This check is necessary
for dealing with visible windows that are behind a translucent
task.
Bug: 159138687
Test: Enter split with 2 apps, close the top app, return to home
and verify that it receives touches in top half
Change-Id: Ie6fed2dd945952b83116721a98fc6d7c8396729f
diff --git a/services/core/java/com/android/server/wm/Task.java b/services/core/java/com/android/server/wm/Task.java
index c749125..6670dbf 100644
--- a/services/core/java/com/android/server/wm/Task.java
+++ b/services/core/java/com/android/server/wm/Task.java
@@ -2927,9 +2927,17 @@
// Don't crop HOME/RECENTS windows to stack bounds. This is because in split-screen
// they extend past their stack and sysui uses the stack surface to control cropping.
// TODO(b/158242495): get rid of this when drag/drop can use surface bounds.
- final boolean isTopHomeOrRecents = (isActivityTypeHome() || isActivityTypeRecents())
- && getRootTask().getTopMostTask() == this;
- return isResizeable() && !isTopHomeOrRecents;
+ if (isActivityTypeHome() || isActivityTypeRecents()) {
+ // Make sure this is the top-most non-organizer root task (if not top-most, it means
+ // another translucent task could be above this, so this needs to stay cropped.
+ final Task rootTask = getRootTask();
+ final Task topNonOrgTask =
+ rootTask.mCreatedByOrganizer ? rootTask.getTopMostTask() : rootTask;
+ if (isDescendantOf(topNonOrgTask)) {
+ return false;
+ }
+ }
+ return isResizeable();
}
/**
diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java
index 3532edf3..fb33f49 100644
--- a/services/core/java/com/android/server/wm/WindowState.java
+++ b/services/core/java/com/android/server/wm/WindowState.java
@@ -3412,6 +3412,7 @@
private void setTouchableRegionCropIfNeeded(InputWindowHandle handle) {
final Task task = getTask();
if (task == null || !task.cropWindowsToStackBounds()) {
+ handle.setTouchableRegionCrop(null);
return;
}