Transaction_test refactoring continued

Minor refactor

Bug: 140128949
Test: build, boot, SurfaceFlinger_test
Change-Id: Ibeed4b4feb102d8ee6cf57c2deabb53f41177f0a
diff --git a/services/surfaceflinger/tests/Transaction_test.cpp b/services/surfaceflinger/tests/Transaction_test.cpp
index acb263a..ece61df 100644
--- a/services/surfaceflinger/tests/Transaction_test.cpp
+++ b/services/surfaceflinger/tests/Transaction_test.cpp
@@ -136,7 +136,9 @@
                                            int32_t bufferWidth, int32_t bufferHeight) {
         ANativeWindow_Buffer buffer;
         ASSERT_NO_FATAL_FAILURE(buffer = getBufferQueueLayerBuffer(layer));
-        fillANativeWindowBufferColor(buffer, Rect(0, 0, bufferWidth, bufferHeight), color);
+        TransactionUtils::fillANativeWindowBufferColor(buffer,
+                                                       Rect(0, 0, bufferWidth, bufferHeight),
+                                                       color);
         postBufferQueueLayerBuffer(layer);
     }
 
@@ -147,7 +149,8 @@
                                   BufferUsage::CPU_READ_OFTEN | BufferUsage::CPU_WRITE_OFTEN |
                                           BufferUsage::COMPOSER_OVERLAY,
                                   "test");
-        fillGraphicBufferColor(buffer, Rect(0, 0, bufferWidth, bufferHeight), color);
+        TransactionUtils::fillGraphicBufferColor(buffer, Rect(0, 0, bufferWidth, bufferHeight),
+                                                 color);
         Transaction().setBuffer(layer, buffer).apply();
     }
 
@@ -193,11 +196,15 @@
 
         const int32_t halfW = bufferWidth / 2;
         const int32_t halfH = bufferHeight / 2;
-        fillANativeWindowBufferColor(buffer, Rect(0, 0, halfW, halfH), topLeft);
-        fillANativeWindowBufferColor(buffer, Rect(halfW, 0, bufferWidth, halfH), topRight);
-        fillANativeWindowBufferColor(buffer, Rect(0, halfH, halfW, bufferHeight), bottomLeft);
-        fillANativeWindowBufferColor(buffer, Rect(halfW, halfH, bufferWidth, bufferHeight),
-                                     bottomRight);
+        TransactionUtils::fillANativeWindowBufferColor(buffer, Rect(0, 0, halfW, halfH), topLeft);
+        TransactionUtils::fillANativeWindowBufferColor(buffer, Rect(halfW, 0, bufferWidth, halfH),
+                                                       topRight);
+        TransactionUtils::fillANativeWindowBufferColor(buffer, Rect(0, halfH, halfW, bufferHeight),
+                                                       bottomLeft);
+        TransactionUtils::fillANativeWindowBufferColor(buffer,
+                                                       Rect(halfW, halfH, bufferWidth,
+                                                            bufferHeight),
+                                                       bottomRight);
 
         postBufferQueueLayerBuffer(layer);
     }
@@ -216,10 +223,14 @@
 
         const int32_t halfW = bufferWidth / 2;
         const int32_t halfH = bufferHeight / 2;
-        fillGraphicBufferColor(buffer, Rect(0, 0, halfW, halfH), topLeft);
-        fillGraphicBufferColor(buffer, Rect(halfW, 0, bufferWidth, halfH), topRight);
-        fillGraphicBufferColor(buffer, Rect(0, halfH, halfW, bufferHeight), bottomLeft);
-        fillGraphicBufferColor(buffer, Rect(halfW, halfH, bufferWidth, bufferHeight), bottomRight);
+        TransactionUtils::fillGraphicBufferColor(buffer, Rect(0, 0, halfW, halfH), topLeft);
+        TransactionUtils::fillGraphicBufferColor(buffer, Rect(halfW, 0, bufferWidth, halfH),
+                                                 topRight);
+        TransactionUtils::fillGraphicBufferColor(buffer, Rect(0, halfH, halfW, bufferHeight),
+                                                 bottomLeft);
+        TransactionUtils::fillGraphicBufferColor(buffer,
+                                                 Rect(halfW, halfH, bufferWidth, bufferHeight),
+                                                 bottomRight);
 
         Transaction().setBuffer(layer, buffer).setSize(layer, bufferWidth, bufferHeight).apply();
     }
@@ -1093,8 +1104,10 @@
 
     ANativeWindow_Buffer buffer;
     ASSERT_NO_FATAL_FAILURE(buffer = getBufferQueueLayerBuffer(layer));
-    ASSERT_NO_FATAL_FAILURE(fillANativeWindowBufferColor(buffer, top, Color::TRANSPARENT));
-    ASSERT_NO_FATAL_FAILURE(fillANativeWindowBufferColor(buffer, bottom, Color::RED));
+    ASSERT_NO_FATAL_FAILURE(
+            TransactionUtils::fillANativeWindowBufferColor(buffer, top, Color::TRANSPARENT));
+    ASSERT_NO_FATAL_FAILURE(
+            TransactionUtils::fillANativeWindowBufferColor(buffer, bottom, Color::RED));
     // setTransparentRegionHint always applies to the following buffer
     Transaction().setTransparentRegionHint(layer, Region(top)).apply();
     ASSERT_NO_FATAL_FAILURE(postBufferQueueLayerBuffer(layer));
@@ -1114,8 +1127,10 @@
     }
 
     ASSERT_NO_FATAL_FAILURE(buffer = getBufferQueueLayerBuffer(layer));
-    ASSERT_NO_FATAL_FAILURE(fillANativeWindowBufferColor(buffer, top, Color::RED));
-    ASSERT_NO_FATAL_FAILURE(fillANativeWindowBufferColor(buffer, bottom, Color::TRANSPARENT));
+    ASSERT_NO_FATAL_FAILURE(
+            TransactionUtils::fillANativeWindowBufferColor(buffer, top, Color::RED));
+    ASSERT_NO_FATAL_FAILURE(
+            TransactionUtils::fillANativeWindowBufferColor(buffer, bottom, Color::TRANSPARENT));
     ASSERT_NO_FATAL_FAILURE(postBufferQueueLayerBuffer(layer));
     {
         SCOPED_TRACE("bottom transparent");
@@ -1138,8 +1153,9 @@
                                       BufferUsage::COMPOSER_OVERLAY,
                               "test");
 
-    ASSERT_NO_FATAL_FAILURE(fillGraphicBufferColor(buffer, top, Color::TRANSPARENT));
-    ASSERT_NO_FATAL_FAILURE(fillGraphicBufferColor(buffer, bottom, Color::RED));
+    ASSERT_NO_FATAL_FAILURE(
+            TransactionUtils::fillGraphicBufferColor(buffer, top, Color::TRANSPARENT));
+    ASSERT_NO_FATAL_FAILURE(TransactionUtils::fillGraphicBufferColor(buffer, bottom, Color::RED));
     Transaction()
             .setTransparentRegionHint(layer, Region(top))
             .setBuffer(layer, buffer)
@@ -1165,8 +1181,9 @@
                                        BufferUsage::COMPOSER_OVERLAY,
                                "test");
 
-    ASSERT_NO_FATAL_FAILURE(fillGraphicBufferColor(buffer, top, Color::RED));
-    ASSERT_NO_FATAL_FAILURE(fillGraphicBufferColor(buffer, bottom, Color::TRANSPARENT));
+    ASSERT_NO_FATAL_FAILURE(TransactionUtils::fillGraphicBufferColor(buffer, top, Color::RED));
+    ASSERT_NO_FATAL_FAILURE(
+            TransactionUtils::fillGraphicBufferColor(buffer, bottom, Color::TRANSPARENT));
     Transaction().setBuffer(layer, buffer).apply();
     {
         SCOPED_TRACE("bottom transparent");
@@ -1907,8 +1924,8 @@
                               BufferUsage::CPU_READ_OFTEN | BufferUsage::CPU_WRITE_OFTEN |
                                       BufferUsage::COMPOSER_OVERLAY,
                               "test");
-    fillGraphicBufferColor(buffer, Rect(0, 0, 32, 16), Color::BLUE);
-    fillGraphicBufferColor(buffer, Rect(0, 16, 32, 64), Color::RED);
+    TransactionUtils::fillGraphicBufferColor(buffer, Rect(0, 0, 32, 16), Color::BLUE);
+    TransactionUtils::fillGraphicBufferColor(buffer, Rect(0, 16, 32, 64), Color::RED);
 
     Transaction().setFrame(layer, Rect(0, 0, 64, 64)).apply();
 
@@ -2302,7 +2319,7 @@
                                            BufferUsage::COMPOSER_OVERLAY,
                                    "test");
         Color color = colors[idx % colors.size()];
-        fillGraphicBufferColor(buffer, Rect(0, 0, 32, 32), color);
+        TransactionUtils::fillGraphicBufferColor(buffer, Rect(0, 0, 32, 32), color);
         idx++;
     }
 
@@ -2338,7 +2355,7 @@
                                            BufferUsage::COMPOSER_OVERLAY,
                                    "test");
         Color color = colors[idx % colors.size()];
-        fillGraphicBufferColor(buffer, Rect(0, 0, 32, 32), color);
+        TransactionUtils::fillGraphicBufferColor(buffer, Rect(0, 0, 32, 32), color);
         idx++;
     }
 
@@ -2374,7 +2391,7 @@
                                            BufferUsage::COMPOSER_OVERLAY,
                                    "test");
         Color color = colors[idx % colors.size()];
-        fillGraphicBufferColor(buffer, Rect(0, 0, 32, 32), color);
+        TransactionUtils::fillGraphicBufferColor(buffer, Rect(0, 0, 32, 32), color);
         idx++;
     }
 
@@ -2471,7 +2488,7 @@
                               BufferUsage::CPU_READ_OFTEN | BufferUsage::CPU_WRITE_OFTEN |
                                       BufferUsage::COMPOSER_OVERLAY,
                               "test");
-    fillGraphicBufferColor(buffer, Rect(0, 0, 32, 32), Color::RED);
+    TransactionUtils::fillGraphicBufferColor(buffer, Rect(0, 0, 32, 32), Color::RED);
 
     sp<Fence> fence;
     if (getBuffer(nullptr, &fence) != NO_ERROR) {
@@ -2500,7 +2517,7 @@
                               BufferUsage::CPU_READ_OFTEN | BufferUsage::CPU_WRITE_OFTEN |
                                       BufferUsage::COMPOSER_OVERLAY,
                               "test");
-    fillGraphicBufferColor(buffer, Rect(0, 0, 32, 32), Color::RED);
+    TransactionUtils::fillGraphicBufferColor(buffer, Rect(0, 0, 32, 32), Color::RED);
 
     sp<Fence> fence = Fence::NO_FENCE;
 
@@ -2524,7 +2541,7 @@
                               BufferUsage::CPU_READ_OFTEN | BufferUsage::CPU_WRITE_OFTEN |
                                       BufferUsage::COMPOSER_OVERLAY,
                               "test");
-    fillGraphicBufferColor(buffer, Rect(0, 0, 32, 32), Color::RED);
+    TransactionUtils::fillGraphicBufferColor(buffer, Rect(0, 0, 32, 32), Color::RED);
 
     Transaction()
             .setBuffer(layer, buffer)
@@ -2546,7 +2563,7 @@
                               BufferUsage::CPU_READ_OFTEN | BufferUsage::CPU_WRITE_OFTEN |
                                       BufferUsage::COMPOSER_OVERLAY,
                               "test");
-    fillGraphicBufferColor(buffer, Rect(0, 0, 32, 32), Color::RED);
+    TransactionUtils::fillGraphicBufferColor(buffer, Rect(0, 0, 32, 32), Color::RED);
 
     HdrMetadata hdrMetadata;
     hdrMetadata.validTypes = 0;
@@ -2570,7 +2587,7 @@
                               BufferUsage::CPU_READ_OFTEN | BufferUsage::CPU_WRITE_OFTEN |
                                       BufferUsage::COMPOSER_OVERLAY,
                               "test");
-    fillGraphicBufferColor(buffer, Rect(0, 0, 32, 32), Color::RED);
+    TransactionUtils::fillGraphicBufferColor(buffer, Rect(0, 0, 32, 32), Color::RED);
 
     Region region;
     region.set(32, 32);
@@ -2594,7 +2611,7 @@
                               BufferUsage::CPU_READ_OFTEN | BufferUsage::CPU_WRITE_OFTEN |
                                       BufferUsage::COMPOSER_OVERLAY,
                               "test");
-    fillGraphicBufferColor(buffer, Rect(0, 0, 32, 32), Color::RED);
+    TransactionUtils::fillGraphicBufferColor(buffer, Rect(0, 0, 32, 32), Color::RED);
 
     Transaction()
             .setBuffer(layer, buffer)
@@ -3661,7 +3678,7 @@
                                                displayHeight, 0);
         ASSERT_TRUE(mBGSurfaceControl != nullptr);
         ASSERT_TRUE(mBGSurfaceControl->isValid());
-        fillSurfaceRGBA8(mBGSurfaceControl, 63, 63, 195);
+        TransactionUtils::fillSurfaceRGBA8(mBGSurfaceControl, 63, 63, 195);
 
         // Foreground surface
         mFGSurfaceControl = createLayer(String8("FG Test Surface"), 64, 64, 0);
@@ -3669,14 +3686,14 @@
         ASSERT_TRUE(mFGSurfaceControl != nullptr);
         ASSERT_TRUE(mFGSurfaceControl->isValid());
 
-        fillSurfaceRGBA8(mFGSurfaceControl, 195, 63, 63);
+        TransactionUtils::fillSurfaceRGBA8(mFGSurfaceControl, 195, 63, 63);
 
         // Synchronization surface
         mSyncSurfaceControl = createLayer(String8("Sync Test Surface"), 1, 1, 0);
         ASSERT_TRUE(mSyncSurfaceControl != nullptr);
         ASSERT_TRUE(mSyncSurfaceControl->isValid());
 
-        fillSurfaceRGBA8(mSyncSurfaceControl, 31, 31, 31);
+        TransactionUtils::fillSurfaceRGBA8(mSyncSurfaceControl, 31, 31, 31);
 
         asTransaction([&](Transaction& t) {
             t.setDisplayLayerStack(display, 0);
@@ -3705,9 +3722,9 @@
         // posting three buffers to it should ensure that at least two
         // SurfaceFlinger::handlePageFlip calls have been made, which should
         // guaranteed that a buffer posted to another Surface has been retired.
-        fillSurfaceRGBA8(mSyncSurfaceControl, 31, 31, 31);
-        fillSurfaceRGBA8(mSyncSurfaceControl, 31, 31, 31);
-        fillSurfaceRGBA8(mSyncSurfaceControl, 31, 31, 31);
+        TransactionUtils::fillSurfaceRGBA8(mSyncSurfaceControl, 31, 31, 31);
+        TransactionUtils::fillSurfaceRGBA8(mSyncSurfaceControl, 31, 31, 31);
+        TransactionUtils::fillSurfaceRGBA8(mSyncSurfaceControl, 31, 31, 31);
     }
 
 
@@ -3724,7 +3741,7 @@
     std::unique_ptr<ScreenCapture> sc;
 
     sp<SurfaceControl> relative = createLayer(String8("relativeTestSurface"), 10, 10, 0);
-    fillSurfaceRGBA8(relative, 10, 10, 10);
+    TransactionUtils::fillSurfaceRGBA8(relative, 10, 10, 10);
     waitForPostedBuffers();
 
     Transaction{}
@@ -3765,7 +3782,9 @@
         sc->expectBGColor(128, 128);
     }
 
-    void lockAndFillFGBuffer() { fillSurfaceRGBA8(mFGSurfaceControl, 195, 63, 63, false); }
+    void lockAndFillFGBuffer() {
+        TransactionUtils::fillSurfaceRGBA8(mFGSurfaceControl, 195, 63, 63, false);
+    }
 
     void unlockFGBuffer() {
         sp<Surface> s = mFGSurfaceControl->getSurface();
@@ -3774,7 +3793,7 @@
     }
 
     void completeFGResize() {
-        fillSurfaceRGBA8(mFGSurfaceControl, 195, 63, 63);
+        TransactionUtils::fillSurfaceRGBA8(mFGSurfaceControl, 195, 63, 63);
         waitForPostedBuffers();
     }
     void restoreInitialState() {
@@ -3842,7 +3861,7 @@
     }
 
     // should trigger the first deferred transaction, but not the second one
-    fillSurfaceRGBA8(mSyncSurfaceControl, 31, 31, 31);
+    TransactionUtils::fillSurfaceRGBA8(mSyncSurfaceControl, 31, 31, 31);
     {
         SCOPED_TRACE("after first trigger");
         ScreenCapture::captureScreen(&sc);
@@ -3855,7 +3874,7 @@
     asTransaction([&](Transaction& t) { t.setAlpha(mFGSurfaceControl, 1.0); });
 
     // trigger the second deferred transaction
-    fillSurfaceRGBA8(mSyncSurfaceControl, 31, 31, 31);
+    TransactionUtils::fillSurfaceRGBA8(mSyncSurfaceControl, 31, 31, 31);
     {
         SCOPED_TRACE("after second trigger");
         ScreenCapture::captureScreen(&sc);
@@ -3873,7 +3892,7 @@
                           PIXEL_FORMAT_RGBA_8888, 0, mFGSurfaceControl.get());
     sp<SurfaceControl> childBuffer = createSurface(mClient, "Buffered child", 20, 20,
                                                    PIXEL_FORMAT_RGBA_8888, 0, childNoBuffer.get());
-    fillSurfaceRGBA8(childBuffer, 200, 200, 200);
+    TransactionUtils::fillSurfaceRGBA8(childBuffer, 200, 200, 200);
     SurfaceComposerClient::Transaction{}
             .setCrop_legacy(childNoBuffer, Rect(0, 0, 10, 10))
             .show(childNoBuffer)
@@ -3948,7 +3967,7 @@
         LayerUpdateTest::SetUp();
         mChild = createSurface(mClient, "Child surface", 10, 15, PIXEL_FORMAT_RGBA_8888, 0,
                                mFGSurfaceControl.get());
-        fillSurfaceRGBA8(mChild, 200, 200, 200);
+        TransactionUtils::fillSurfaceRGBA8(mChild, 200, 200, 200);
 
         {
             SCOPED_TRACE("before anything");
@@ -4079,9 +4098,9 @@
 }
 
 TEST_F(ChildLayerTest, ChildLayerAlpha) {
-    fillSurfaceRGBA8(mBGSurfaceControl, 0, 0, 254);
-    fillSurfaceRGBA8(mFGSurfaceControl, 254, 0, 0);
-    fillSurfaceRGBA8(mChild, 0, 254, 0);
+    TransactionUtils::fillSurfaceRGBA8(mBGSurfaceControl, 0, 0, 254);
+    TransactionUtils::fillSurfaceRGBA8(mFGSurfaceControl, 254, 0, 0);
+    TransactionUtils::fillSurfaceRGBA8(mChild, 0, 254, 0);
     waitForPostedBuffers();
 
     asTransaction([&](Transaction& t) {
@@ -4149,7 +4168,7 @@
 TEST_F(ChildLayerTest, ChildrenSurviveParentDestruction) {
     sp<SurfaceControl> mGrandChild =
             createSurface(mClient, "Grand Child", 10, 10, PIXEL_FORMAT_RGBA_8888, 0, mChild.get());
-    fillSurfaceRGBA8(mGrandChild, 111, 111, 111);
+    TransactionUtils::fillSurfaceRGBA8(mGrandChild, 111, 111, 111);
 
     {
         SCOPED_TRACE("Grandchild visible");
@@ -4179,7 +4198,7 @@
 TEST_F(ChildLayerTest, ChildrenRelativeZSurvivesParentDestruction) {
     sp<SurfaceControl> mGrandChild =
             createSurface(mClient, "Grand Child", 10, 10, PIXEL_FORMAT_RGBA_8888, 0, mChild.get());
-    fillSurfaceRGBA8(mGrandChild, 111, 111, 111);
+    TransactionUtils::fillSurfaceRGBA8(mGrandChild, 111, 111, 111);
 
     // draw grand child behind the foreground surface
     asTransaction([&](Transaction& t) {
@@ -4244,7 +4263,7 @@
 
     ASSERT_TRUE(mChildNewClient->isValid());
 
-    fillSurfaceRGBA8(mChildNewClient, 200, 200, 200);
+    TransactionUtils::fillSurfaceRGBA8(mChildNewClient, 200, 200, 200);
 
     asTransaction([&](Transaction& t) {
         t.hide(mChild);
@@ -4285,7 +4304,7 @@
     ASSERT_TRUE(childNewClient != nullptr);
     ASSERT_TRUE(childNewClient->isValid());
 
-    fillSurfaceRGBA8(childNewClient, 200, 200, 200);
+    TransactionUtils::fillSurfaceRGBA8(childNewClient, 200, 200, 200);
 
     Transaction()
             .hide(mChild)
@@ -4339,7 +4358,7 @@
     ASSERT_TRUE(childNewClient != nullptr);
     ASSERT_TRUE(childNewClient->isValid());
 
-    fillSurfaceRGBA8(childNewClient, 200, 200, 200);
+    TransactionUtils::fillSurfaceRGBA8(childNewClient, 200, 200, 200);
 
     Transaction()
             .hide(mChild)
@@ -4428,7 +4447,7 @@
     auto anw = static_cast<ANativeWindow*>(s.get());
     native_window_set_buffers_transform(anw, NATIVE_WINDOW_TRANSFORM_ROT_90);
     native_window_set_buffers_dimensions(anw, 64, 128);
-    fillSurfaceRGBA8(mFGSurfaceControl, 195, 63, 63);
+    TransactionUtils::fillSurfaceRGBA8(mFGSurfaceControl, 195, 63, 63);
     waitForPostedBuffers();
 
     {
@@ -4448,7 +4467,7 @@
         t.setPosition(mFGSurfaceControl, 0, 0);
         t.setSize(mChild, 100, 100);
     });
-    fillSurfaceRGBA8(mChild, 200, 200, 200);
+    TransactionUtils::fillSurfaceRGBA8(mChild, 200, 200, 200);
 
     {
         mCapture = screenshot();
@@ -4464,7 +4483,7 @@
     // Apply a 90 transform on the buffer.
     native_window_set_buffers_transform(anw, NATIVE_WINDOW_TRANSFORM_ROT_90);
     native_window_set_buffers_dimensions(anw, 64, 128);
-    fillSurfaceRGBA8(mFGSurfaceControl, 195, 63, 63);
+    TransactionUtils::fillSurfaceRGBA8(mFGSurfaceControl, 195, 63, 63);
     waitForPostedBuffers();
 
     // The child should be cropped by the new parent bounds.
@@ -4485,7 +4504,7 @@
         t.setPosition(mFGSurfaceControl, 0, 0);
         t.setSize(mChild, 200, 200);
     });
-    fillSurfaceRGBA8(mChild, 200, 200, 200);
+    TransactionUtils::fillSurfaceRGBA8(mChild, 200, 200, 200);
 
     {
         mCapture = screenshot();
@@ -4537,7 +4556,7 @@
     // have an effective scale of 2.0 applied to the buffer along with a rotation transform.
     native_window_set_buffers_transform(anw, NATIVE_WINDOW_TRANSFORM_ROT_90);
     native_window_set_buffers_dimensions(anw, 32, 64);
-    fillSurfaceRGBA8(mFGSurfaceControl, 195, 63, 63);
+    TransactionUtils::fillSurfaceRGBA8(mFGSurfaceControl, 195, 63, 63);
     waitForPostedBuffers();
 
     // The child should ignore the buffer transform but apply the 2.0 scale from parent.
@@ -4570,13 +4589,13 @@
     // frame because SurfaceFlinger would never process the deferred transaction and would therefore
     // never acquire/release the first buffer
     ALOGI("Filling 1");
-    fillSurfaceRGBA8(mFGSurfaceControl, 0, 255, 0);
+    TransactionUtils::fillSurfaceRGBA8(mFGSurfaceControl, 0, 255, 0);
     ALOGI("Filling 2");
-    fillSurfaceRGBA8(mFGSurfaceControl, 0, 0, 255);
+    TransactionUtils::fillSurfaceRGBA8(mFGSurfaceControl, 0, 0, 255);
     ALOGI("Filling 3");
-    fillSurfaceRGBA8(mFGSurfaceControl, 255, 0, 0);
+    TransactionUtils::fillSurfaceRGBA8(mFGSurfaceControl, 255, 0, 0);
     ALOGI("Filling 4");
-    fillSurfaceRGBA8(mFGSurfaceControl, 0, 255, 0);
+    TransactionUtils::fillSurfaceRGBA8(mFGSurfaceControl, 0, 255, 0);
 }
 
 TEST_F(ChildLayerTest, Reparent) {
@@ -4641,7 +4660,7 @@
     ASSERT_TRUE(newSurface != nullptr);
     ASSERT_TRUE(newSurface->isValid());
 
-    fillSurfaceRGBA8(newSurface, 63, 195, 63);
+    TransactionUtils::fillSurfaceRGBA8(newSurface, 63, 195, 63);
     asTransaction([&](Transaction& t) {
         t.hide(mChild);
         t.show(newSurface);
@@ -4673,7 +4692,7 @@
 TEST_F(ChildLayerTest, NestedChildren) {
     sp<SurfaceControl> grandchild = createSurface(mClient, "Grandchild surface", 10, 10,
                                                   PIXEL_FORMAT_RGBA_8888, 0, mChild.get());
-    fillSurfaceRGBA8(grandchild, 50, 50, 50);
+    TransactionUtils::fillSurfaceRGBA8(grandchild, 50, 50, 50);
 
     {
         mCapture = screenshot();
@@ -4685,7 +4704,7 @@
 
 TEST_F(ChildLayerTest, ChildLayerRelativeLayer) {
     sp<SurfaceControl> relative = createLayer(String8("Relative surface"), 128, 128, 0);
-    fillSurfaceRGBA8(relative, 255, 255, 255);
+    TransactionUtils::fillSurfaceRGBA8(relative, 255, 255, 255);
 
     Transaction t;
     t.setLayer(relative, INT32_MAX)
@@ -4922,7 +4941,7 @@
 
     sp<SurfaceControl> child = createSurface(mClient, "Child surface", 10, 10,
                                              PIXEL_FORMAT_RGBA_8888, 0, mFGSurfaceControl.get());
-    fillSurfaceRGBA8(child, 200, 200, 200);
+    TransactionUtils::fillSurfaceRGBA8(child, 200, 200, 200);
 
     SurfaceComposerClient::Transaction().show(child).apply(true);
 
@@ -4937,7 +4956,7 @@
 
     sp<SurfaceControl> child = createSurface(mClient, "Child surface", 10, 10,
                                              PIXEL_FORMAT_RGBA_8888, 0, mFGSurfaceControl.get());
-    fillSurfaceRGBA8(child, 200, 200, 200);
+    TransactionUtils::fillSurfaceRGBA8(child, 200, 200, 200);
 
     SurfaceComposerClient::Transaction().show(child).apply(true);
 
@@ -4952,10 +4971,10 @@
 
     sp<SurfaceControl> child = createSurface(mClient, "Child surface", 10, 10,
                                              PIXEL_FORMAT_RGBA_8888, 0, mFGSurfaceControl.get());
-    fillSurfaceRGBA8(child, 200, 200, 200);
+    TransactionUtils::fillSurfaceRGBA8(child, 200, 200, 200);
     sp<SurfaceControl> child2 = createSurface(mClient, "Child surface", 10, 10,
                                               PIXEL_FORMAT_RGBA_8888, 0, mFGSurfaceControl.get());
-    fillSurfaceRGBA8(child2, 200, 0, 200);
+    TransactionUtils::fillSurfaceRGBA8(child2, 200, 0, 200);
 
     SurfaceComposerClient::Transaction()
             .show(child)
@@ -4976,13 +4995,13 @@
 
     sp<SurfaceControl> child = createSurface(mClient, "Child surface", 10, 10,
                                              PIXEL_FORMAT_RGBA_8888, 0, mFGSurfaceControl.get());
-    fillSurfaceRGBA8(child, 200, 200, 200);
+    TransactionUtils::fillSurfaceRGBA8(child, 200, 200, 200);
     sp<SurfaceControl> child2 = createSurface(mClient, "Child surface", 10, 10,
                                               PIXEL_FORMAT_RGBA_8888, 0, mFGSurfaceControl.get());
-    fillSurfaceRGBA8(child2, 200, 0, 200);
+    TransactionUtils::fillSurfaceRGBA8(child2, 200, 0, 200);
     sp<SurfaceControl> child3 = createSurface(mClient, "Child surface", 10, 10,
                                               PIXEL_FORMAT_RGBA_8888, 0, child2.get());
-    fillSurfaceRGBA8(child2, 200, 0, 200);
+    TransactionUtils::fillSurfaceRGBA8(child2, 200, 0, 200);
 
     SurfaceComposerClient::Transaction()
             .show(child)
@@ -5002,7 +5021,7 @@
     sp<SurfaceControl> child = createSurface(mClient, "Child surface", 10, 10,
                                              PIXEL_FORMAT_RGBA_8888, 0, mFGSurfaceControl.get());
 
-    fillSurfaceRGBA8(child, 200, 200, 200);
+    TransactionUtils::fillSurfaceRGBA8(child, 200, 200, 200);
 
     SurfaceComposerClient::Transaction().show(child).apply(true);
 
@@ -5022,8 +5041,8 @@
                                              PIXEL_FORMAT_RGBA_8888, 0, mFGSurfaceControl.get());
     ASSERT_NE(nullptr, child.get()) << "failed to create surface";
     sp<SurfaceControl> relative = createLayer(String8("Relative surface"), 10, 10, 0);
-    fillSurfaceRGBA8(child, 200, 200, 200);
-    fillSurfaceRGBA8(relative, 100, 100, 100);
+    TransactionUtils::fillSurfaceRGBA8(child, 200, 200, 200);
+    TransactionUtils::fillSurfaceRGBA8(relative, 100, 100, 100);
 
     SurfaceComposerClient::Transaction()
             .show(child)
@@ -5045,8 +5064,8 @@
                                              PIXEL_FORMAT_RGBA_8888, 0, mFGSurfaceControl.get());
     sp<SurfaceControl> relative = createSurface(mClient, "Relative surface", 10, 10,
                                                 PIXEL_FORMAT_RGBA_8888, 0, mFGSurfaceControl.get());
-    fillSurfaceRGBA8(child, 200, 200, 200);
-    fillSurfaceRGBA8(relative, 100, 100, 100);
+    TransactionUtils::fillSurfaceRGBA8(child, 200, 200, 200);
+    TransactionUtils::fillSurfaceRGBA8(relative, 100, 100, 100);
 
     SurfaceComposerClient::Transaction()
             .show(child)
@@ -5075,7 +5094,7 @@
 
         mChild = createSurface(mClient, "Child surface", 10, 10, PIXEL_FORMAT_RGBA_8888, 0,
                                mFGSurfaceControl.get());
-        fillSurfaceRGBA8(mChild, 200, 200, 200);
+        TransactionUtils::fillSurfaceRGBA8(mChild, 200, 200, 200);
 
         SurfaceComposerClient::Transaction().show(mChild).apply(true);
     }
@@ -5138,12 +5157,12 @@
 
     sp<SurfaceControl> child = createSurface(mClient, "Child surface", 10, 10,
                                              PIXEL_FORMAT_RGBA_8888, 0, mFGSurfaceControl.get());
-    fillSurfaceRGBA8(child, 200, 200, 200);
+    TransactionUtils::fillSurfaceRGBA8(child, 200, 200, 200);
 
     sp<SurfaceControl> grandchild = createSurface(mClient, "Grandchild surface", 5, 5,
                                                   PIXEL_FORMAT_RGBA_8888, 0, child.get());
 
-    fillSurfaceRGBA8(grandchild, 50, 50, 50);
+    TransactionUtils::fillSurfaceRGBA8(grandchild, 50, 50, 50);
     SurfaceComposerClient::Transaction()
             .show(child)
             .setPosition(grandchild, 5, 5)
@@ -5160,7 +5179,7 @@
 TEST_F(ScreenCaptureTest, CaptureChildOnly) {
     sp<SurfaceControl> child = createSurface(mClient, "Child surface", 10, 10,
                                              PIXEL_FORMAT_RGBA_8888, 0, mFGSurfaceControl.get());
-    fillSurfaceRGBA8(child, 200, 200, 200);
+    TransactionUtils::fillSurfaceRGBA8(child, 200, 200, 200);
     auto childHandle = child->getHandle();
 
     SurfaceComposerClient::Transaction().setPosition(child, 5, 5).show(child).apply(true);
@@ -5174,12 +5193,12 @@
 TEST_F(ScreenCaptureTest, CaptureGrandchildOnly) {
     sp<SurfaceControl> child = createSurface(mClient, "Child surface", 10, 10,
                                              PIXEL_FORMAT_RGBA_8888, 0, mFGSurfaceControl.get());
-    fillSurfaceRGBA8(child, 200, 200, 200);
+    TransactionUtils::fillSurfaceRGBA8(child, 200, 200, 200);
     auto childHandle = child->getHandle();
 
     sp<SurfaceControl> grandchild = createSurface(mClient, "Grandchild surface", 5, 5,
                                                   PIXEL_FORMAT_RGBA_8888, 0, child.get());
-    fillSurfaceRGBA8(grandchild, 50, 50, 50);
+    TransactionUtils::fillSurfaceRGBA8(grandchild, 50, 50, 50);
 
     SurfaceComposerClient::Transaction()
             .show(child)
@@ -5674,8 +5693,8 @@
         ASSERT_NO_FATAL_FAILURE(slotToBuffer(slot1, &buf1));
         sp<GraphicBuffer> buf2;
         ASSERT_NO_FATAL_FAILURE(slotToBuffer(slot2, &buf2));
-        fillGraphicBufferColor(buf1, Rect(width, height), color);
-        fillGraphicBufferColor(buf2, Rect(width, height), color);
+        TransactionUtils::fillGraphicBufferColor(buf1, Rect(width, height), color);
+        TransactionUtils::fillGraphicBufferColor(buf2, Rect(width, height), color);
 
         const auto displayTime = systemTime() + milliseconds_to_nanoseconds(100);
         ASSERT_NO_FATAL_FAILURE(queue(slot1, Region::INVALID_REGION, displayTime));