Include finalCrop in setGeometryAppliesWithResize.
A refresher on this archaic function. Normally window crop and
position apply immediately. This is so the window manager can always
crop surfaces (e.g. while docked resizing) even if the app is lagging
behind. In some cases though the apps position or cropping may depend
on whether the resize has occured or not. For example when an app
gains shadows, we need to move expand the Surface and move it by a
negative offset for the content to remain in the same place. This
movement needs to be synchronized with the buffer latching for the
expansion.
We implemented setGeometryAppliesWithResize to take care of this. At
the time it wasn't clear if it was needed for finalCrop so we let it
be. Now that we are exclusively using final crop in the pinned stack
however it is required. The same way we have an issue with position
and shadows, we have an issue with expanding the crop rect (we may
have actually been cropping out part of a larger surface that is now
supposed to be shadows).
Also includes a test suite for setGeometryAppliesWithResize behavior
which was previously untested.
Bug: 35396882
Test: SurfaceFlinger_test
Change-Id: Ie4d32162eb21154496bb231161692d18341a1e1e
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index 2755206..adfff96 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -1753,11 +1753,15 @@
setTransactionFlags(eTransactionNeeded);
return true;
}
-bool Layer::setFinalCrop(const Rect& crop) {
+
+bool Layer::setFinalCrop(const Rect& crop, bool immediate) {
if (mCurrentState.finalCrop == crop)
return false;
mCurrentState.sequence++;
- mCurrentState.finalCrop = crop;
+ mCurrentState.requestedFinalCrop = crop;
+ if (immediate) {
+ mCurrentState.finalCrop = crop;
+ }
mCurrentState.modified = true;
setTransactionFlags(eTransactionNeeded);
return true;