Fix: Release skia resources when RenderNode layer is configured

-Updated StretchEffect to null out the child texture
of the SkRuntimeEffectBuilder after the shader is created
-Release optional mask surface used for
stretching the hole punch
-Release SkRuntimeEffectBuilder instance on RenderNode's
StretchEffect

Fixes: 183592264
Test: manual + re-ran cts tests
Change-Id: I90952666d7489985de9ce798ab792cf3fd7f6087
diff --git a/libs/hwui/effects/StretchEffect.cpp b/libs/hwui/effects/StretchEffect.cpp
index 43f805d..17cd3ce 100644
--- a/libs/hwui/effects/StretchEffect.cpp
+++ b/libs/hwui/effects/StretchEffect.cpp
@@ -186,6 +186,7 @@
 
 static const float ZERO = 0.f;
 static const float INTERPOLATION_STRENGTH_VALUE = 0.7f;
+static const char CONTENT_TEXTURE[] = "uContentTexture";
 
 sk_sp<SkShader> StretchEffect::getShader(float width, float height,
                                          const sk_sp<SkImage>& snapshotImage,
@@ -207,7 +208,7 @@
         mBuilder = std::make_unique<SkRuntimeShaderBuilder>(getStretchEffect());
     }
 
-    mBuilder->child("uContentTexture") =
+    mBuilder->child(CONTENT_TEXTURE) =
             snapshotImage->makeShader(SkTileMode::kClamp, SkTileMode::kClamp,
                                       SkSamplingOptions(SkFilterMode::kLinear), matrix);
     mBuilder->uniform("uInterpolationStrength").set(&INTERPOLATION_STRENGTH_VALUE, 1);
@@ -226,7 +227,9 @@
     mBuilder->uniform("viewportWidth").set(&width, 1);
     mBuilder->uniform("viewportHeight").set(&height, 1);
 
-    return mBuilder->makeShader(nullptr, false);
+    auto result = mBuilder->makeShader(nullptr, false);
+    mBuilder->child(CONTENT_TEXTURE) = nullptr;
+    return result;
 }
 
 sk_sp<SkRuntimeEffect> StretchEffect::getStretchEffect() {