Take into account surface insets when replacing touch region.

When SurfaceFlinger computes window frames, the surface insets are
clamped to the input bounds. But when replacing the touchable region,
the surface insets are not taken into account.
This CL adds consideration for surface insets, so that touchable region
is computed correctly. This also fixes a ListPopupWindowTest on freeform
windowing devices.

Test: atest SurfaceFlinger_test on freeform windowing emulator and
aosp_cf_x86_64_phone target
Fixes: 272786078

Change-Id: Id8082cb1b39280e846c2bf5a36315df68d37d2e6
diff --git a/services/surfaceflinger/Layer.h b/services/surfaceflinger/Layer.h
index 2fb122c..9ed5899 100644
--- a/services/surfaceflinger/Layer.h
+++ b/services/surfaceflinger/Layer.h
@@ -570,6 +570,8 @@
 
     FloatRect getBounds(const Region& activeTransparentRegion) const;
     FloatRect getBounds() const;
+    Rect getInputBoundsInDisplaySpace(const FloatRect& insetBounds,
+                                      const ui::Transform& displayTransform);
 
     // Compute bounds for the layer and cache the results.
     void computeBounds(FloatRect parentBounds, ui::Transform parentTransform, float shadowRadius);
@@ -931,7 +933,7 @@
      * "replaceTouchableRegionWithCrop" is specified. In this case, the layer will receive input
      * in this layer's space, regardless of the specified crop layer.
      */
-    Rect getInputBounds() const;
+    std::pair<FloatRect, bool> getInputBounds(bool fillParentBounds) const;
 
     // constant
     sp<SurfaceFlinger> mFlinger;