SF: Calculate WindowInfo frame correctly for all layers
The old logic skipped transform calculation using an early return if the
layer bounds were invalid. This skipped the calculations which
transformed the WindowInfo frame into display space. This also resulted in
container layers being misconfigured, since they did not have their
input bounds calculated correctly.
Allow all layers to have their WindowInfo calculated correctly in
display space, even if their input bounds happen to be invalid.
Bug: 162194035
Test: atest libgui_test
Test: manual
Change-Id: I7b3c361bb9a12adf52586d3a940501e4d8a9e667
diff --git a/services/surfaceflinger/Layer.h b/services/surfaceflinger/Layer.h
index 4cdd8fa..9e10b4f 100644
--- a/services/surfaceflinger/Layer.h
+++ b/services/surfaceflinger/Layer.h
@@ -959,6 +959,19 @@
bool usingRelativeZ(LayerVector::StateSet) const;
virtual ui::Transform getInputTransform() const;
+ /**
+ * Get the bounds in layer space within which this layer can receive input.
+ *
+ * These bounds are used to:
+ * - Determine the input frame for the layer to be used for occlusion detection; and
+ * - Determine the coordinate space within which the layer will receive input. The top-left of
+ * this rect will be the origin of the coordinate space that the input events sent to the
+ * layer will be in (prior to accounting for surface insets).
+ *
+ * The layer can still receive touch input if these bounds are invalid if
+ * "replaceTouchableRegionWithCrop" is specified. In this case, the layer will receive input
+ * in this layer's space, regardless of the specified crop layer.
+ */
virtual Rect getInputBounds() const;
// constant