SurfaceFlinger: Fix final cropping of child layers.
Straightforward mistake documented by the test case. Not sure how it
made it this long.
Test: Included in Transaction_test.cpp. Manual from bug. go/wm-smoke.
Bug: 37511473
Change-Id: I87a57825cca879c5519fe72fef199168f7c23479
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index c21f0c2..6f430a3 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -399,6 +399,10 @@
Transform t = getTransform();
win = t.transform(win);
+ if (!s.finalCrop.isEmpty()) {
+ win.intersect(s.finalCrop, &win);
+ }
+
const sp<Layer>& p = getParent();
// Now we need to calculate the parent bounds, so we can clip ourselves to those.
// When calculating the parent bounds for purposes of clipping,