Add HWC2::setBlockingRegion

Implement from here down: the blocking region is passed to
HidlComposerHal (which ignores it) and AidlComposerHal (which respects
it).

Depends on Ib0fa41e56196feeff201637d5599830d2565da2b.

Bug: 212736475
Test: TODO (b/213361853)
Change-Id: I991c8e1beca22075ec831f96dff218e6af3d9a08
diff --git a/services/surfaceflinger/DisplayHardware/HWC2.cpp b/services/surfaceflinger/DisplayHardware/HWC2.cpp
index 6778438..cd36eea 100644
--- a/services/surfaceflinger/DisplayHardware/HWC2.cpp
+++ b/services/surfaceflinger/DisplayHardware/HWC2.cpp
@@ -932,6 +932,21 @@
     return static_cast<Error>(intError);
 }
 
+Error Layer::setBlockingRegion(const Region& region) {
+    if (CC_UNLIKELY(!mDisplay)) {
+        return Error::BAD_DISPLAY;
+    }
+
+    if (region.isRect() && mBlockingRegion.isRect() &&
+        (region.getBounds() == mBlockingRegion.getBounds())) {
+        return Error::NONE;
+    }
+    mBlockingRegion = region;
+    const auto hwcRects = convertRegionToHwcRects(region);
+    const auto intError = mComposer.setLayerBlockingRegion(mDisplay->getId(), mId, hwcRects);
+    return static_cast<Error>(intError);
+}
+
 } // namespace impl
 } // namespace HWC2
 } // namespace android