blast: negative display frames are invalid

SurfaceFlinger handles display frames that are outside of the bounds except
when they frames are negative. Just remove the negative part of the frame
when it is set.

Test: atest CtsViewTestCases:android.view.cts.ASurfaceControlTest
Bug: 80477568

Change-Id: I995ea3bc65ab3bb4057db4d8102950eb7cac5680
diff --git a/services/surfaceflinger/BufferStateLayer.cpp b/services/surfaceflinger/BufferStateLayer.cpp
index 0e46928..077be86 100644
--- a/services/surfaceflinger/BufferStateLayer.cpp
+++ b/services/surfaceflinger/BufferStateLayer.cpp
@@ -141,6 +141,16 @@
     int w = frame.getWidth();
     int h = frame.getHeight();
 
+    if (x < 0) {
+        x = 0;
+        w = frame.right;
+    }
+
+    if (y < 0) {
+        y = 0;
+        h = frame.bottom;
+    }
+
     Mutex::Autolock lock(mStateMutex);
     if (mState.current.active.transform.tx() == x && mState.current.active.transform.ty() == y &&
         mState.current.active.w == w && mState.current.active.h == h) {