Remove hwcomposer2.h

Previously SurfaceFlinger codebase uses hwcomposer2.h, which contains a
bunch of types that are not versioned. The usage of hwcomposer2.h has
been causing static casting here and there. This patch removes the usage
of hwcompoer2.h, creates a Hal.h to capture all composer hal stuff that
the codebase relies on.

Bug: b/77585359
Test: atest libsurfaceflinger_unittest
Test: atest SurfaceFlinger_test
Test: atest libcompositionengine_test
Change-Id: If9dfeb2a4a2c2f9df0b3ed300bfaca22c463038e
diff --git a/services/surfaceflinger/CompositionEngine/tests/DisplayTest.cpp b/services/surfaceflinger/CompositionEngine/tests/DisplayTest.cpp
index f73a6f7..59889b6 100644
--- a/services/surfaceflinger/CompositionEngine/tests/DisplayTest.cpp
+++ b/services/surfaceflinger/CompositionEngine/tests/DisplayTest.cpp
@@ -40,6 +40,8 @@
 namespace android::compositionengine {
 namespace {
 
+namespace hal = android::hardware::graphics::composer::hal;
+
 using testing::_;
 using testing::DoAll;
 using testing::Eq;
@@ -645,9 +647,9 @@
 
 TEST_F(DisplayChooseCompositionStrategyTest, normalOperationWithChanges) {
     android::HWComposer::DeviceRequestedChanges changes{
-            {{nullptr, HWC2::Composition::Client}},
-            HWC2::DisplayRequest::FlipClientTarget,
-            {{nullptr, HWC2::LayerRequest::ClearClientTarget}},
+            {{nullptr, hal::Composition::CLIENT}},
+            hal::DisplayRequest::FLIP_CLIENT_TARGET,
+            {{nullptr, hal::LayerRequest::CLEAR_CLIENT_TARGET}},
     };
 
     // Since two calls are made to anyLayersRequireClientComposition with different return
@@ -682,7 +684,7 @@
 using DisplayGetSkipColorTransformTest = DisplayWithLayersTestCommon;
 
 TEST_F(DisplayGetSkipColorTransformTest, checksCapabilityIfNonHwcDisplay) {
-    EXPECT_CALL(mHwComposer, hasCapability(HWC2::Capability::SkipClientColorTransform))
+    EXPECT_CALL(mHwComposer, hasCapability(hal::Capability::SKIP_CLIENT_COLOR_TRANSFORM))
             .WillOnce(Return(true));
     auto args = getDisplayCreationArgsForNonHWCVirtualDisplay();
     auto nonHwcDisplay{impl::createDisplay(mCompositionEngine, args)};
@@ -692,7 +694,7 @@
 TEST_F(DisplayGetSkipColorTransformTest, checksDisplayCapability) {
     EXPECT_CALL(mHwComposer,
                 hasDisplayCapability(DEFAULT_DISPLAY_ID,
-                                     HWC2::DisplayCapability::SkipClientColorTransform))
+                                     hal::DisplayCapability::SKIP_CLIENT_COLOR_TRANSFORM))
             .WillOnce(Return(true));
     EXPECT_TRUE(mDisplay->getSkipColorTransform());
 }
@@ -758,9 +760,9 @@
             .Times(1);
 
     mDisplay->applyChangedTypesToLayers(impl::Display::ChangedTypes{
-            {&mLayer1.hwc2Layer, HWC2::Composition::Client},
-            {&mLayer2.hwc2Layer, HWC2::Composition::Device},
-            {&hwc2LayerUnknown, HWC2::Composition::SolidColor},
+            {&mLayer1.hwc2Layer, hal::Composition::CLIENT},
+            {&mLayer2.hwc2Layer, hal::Composition::DEVICE},
+            {&hwc2LayerUnknown, hal::Composition::SOLID_COLOR},
     });
 }
 
@@ -771,28 +773,28 @@
 using DisplayApplyDisplayRequestsTest = DisplayWithLayersTestCommon;
 
 TEST_F(DisplayApplyDisplayRequestsTest, handlesNoRequests) {
-    mDisplay->applyDisplayRequests(static_cast<HWC2::DisplayRequest>(0));
+    mDisplay->applyDisplayRequests(static_cast<hal::DisplayRequest>(0));
 
     auto& state = mDisplay->getState();
     EXPECT_FALSE(state.flipClientTarget);
 }
 
 TEST_F(DisplayApplyDisplayRequestsTest, handlesFlipClientTarget) {
-    mDisplay->applyDisplayRequests(HWC2::DisplayRequest::FlipClientTarget);
+    mDisplay->applyDisplayRequests(hal::DisplayRequest::FLIP_CLIENT_TARGET);
 
     auto& state = mDisplay->getState();
     EXPECT_TRUE(state.flipClientTarget);
 }
 
 TEST_F(DisplayApplyDisplayRequestsTest, handlesWriteClientTargetToOutput) {
-    mDisplay->applyDisplayRequests(HWC2::DisplayRequest::WriteClientTargetToOutput);
+    mDisplay->applyDisplayRequests(hal::DisplayRequest::WRITE_CLIENT_TARGET_TO_OUTPUT);
 
     auto& state = mDisplay->getState();
     EXPECT_FALSE(state.flipClientTarget);
 }
 
 TEST_F(DisplayApplyDisplayRequestsTest, handlesAllRequestFlagsSet) {
-    mDisplay->applyDisplayRequests(static_cast<HWC2::DisplayRequest>(~0));
+    mDisplay->applyDisplayRequests(static_cast<hal::DisplayRequest>(~0));
 
     auto& state = mDisplay->getState();
     EXPECT_TRUE(state.flipClientTarget);
@@ -822,8 +824,8 @@
             .Times(1);
 
     mDisplay->applyLayerRequestsToLayers(impl::Display::LayerRequests{
-            {&mLayer1.hwc2Layer, HWC2::LayerRequest::ClearClientTarget},
-            {&hwc2LayerUnknown, HWC2::LayerRequest::ClearClientTarget},
+            {&mLayer1.hwc2Layer, hal::LayerRequest::CLEAR_CLIENT_TARGET},
+            {&hwc2LayerUnknown, hal::LayerRequest::CLEAR_CLIENT_TARGET},
     });
 }