Update frameworks/base to use newer SkRuntimeEffect::MakeForShader

This enforces stricter rules on the SkSL at effect creation time, and
ensures it's valid as an SkShader (vs. an SkColorFilter). Also updated
some SkSL that was already (or would become) illegal:

- Child shaders must be declared 'uniform', not 'in'
- sampling a child requires coordinates

Bug: skia:11813
Change-Id: I743b985b5012723186a43e58e9e3ccf29d809d2b
diff --git a/graphics/java/android/graphics/drawable/RippleShader.java b/graphics/java/android/graphics/drawable/RippleShader.java
index e7c1081..2b4d5b4 100644
--- a/graphics/java/android/graphics/drawable/RippleShader.java
+++ b/graphics/java/android/graphics/drawable/RippleShader.java
@@ -115,7 +115,7 @@
             + "    float fade = min(fadeIn, 1. - fadeOutRipple);\n"
             + "    vec4 circle = in_color * (softCircle(p, center, in_maxRadius "
             + "      * scaleIn, 0.2) * fade);\n"
-            + "    float mask = in_hasMask == 1. ? sample(in_shader).a > 0. ? 1. : 0. : 1.;\n"
+            + "    float mask = in_hasMask == 1. ? sample(in_shader, p).a > 0. ? 1. : 0. : 1.;\n"
             + "    return mix(circle, in_sparkleColor, sparkle) * mask;\n"
             + "}";
     private static final String SHADER = SHADER_UNIFORMS + SHADER_LIB + SHADER_MAIN;
diff --git a/libs/hwui/effects/StretchEffect.cpp b/libs/hwui/effects/StretchEffect.cpp
index c2642d3..6eb6e1e 100644
--- a/libs/hwui/effects/StretchEffect.cpp
+++ b/libs/hwui/effects/StretchEffect.cpp
@@ -237,7 +237,7 @@
 }
 
 sk_sp<SkRuntimeEffect> StretchEffect::getStretchEffect() {
-    const static SkRuntimeEffect::Result instance = SkRuntimeEffect::Make(stretchShader);
+    const static SkRuntimeEffect::Result instance = SkRuntimeEffect::MakeForShader(stretchShader);
     return instance.effect;
 }
 
diff --git a/libs/hwui/jni/Shader.cpp b/libs/hwui/jni/Shader.cpp
index 2e4d7f62..9018443 100644
--- a/libs/hwui/jni/Shader.cpp
+++ b/libs/hwui/jni/Shader.cpp
@@ -239,7 +239,8 @@
 
 static jlong RuntimeShader_createShaderBuilder(JNIEnv* env, jobject, jstring sksl) {
     ScopedUtfChars strSksl(env, sksl);
-    auto result = SkRuntimeEffect::Make(SkString(strSksl.c_str()), SkRuntimeEffect::Options{});
+    auto result = SkRuntimeEffect::MakeForShader(SkString(strSksl.c_str()),
+                                                 SkRuntimeEffect::Options{});
     if (result.effect.get() == nullptr) {
         doThrowIAE(env, result.errorText.c_str());
         return 0;
diff --git a/tests/HwAccelerationTest/src/com/android/test/hwui/ColorFiltersMutateActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/ColorFiltersMutateActivity.java
index 8be3b7e..c06f8fd 100644
--- a/tests/HwAccelerationTest/src/com/android/test/hwui/ColorFiltersMutateActivity.java
+++ b/tests/HwAccelerationTest/src/com/android/test/hwui/ColorFiltersMutateActivity.java
@@ -60,7 +60,7 @@
         private float mShaderParam1 = 0.0f;
 
         static final String sSkSL =
-                "in shader bitmapShader;\n"
+                "uniform shader bitmapShader;\n"
                 + "uniform float param1;\n"
                 + "half4 main(float2 xy) {\n"
                 + "  return half4(sample(bitmapShader, xy).rgb, param1);\n"
diff --git a/tests/HwAccelerationTest/src/com/android/test/hwui/RippleActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/RippleActivity.java
index 487c856..79410cf 100644
--- a/tests/HwAccelerationTest/src/com/android/test/hwui/RippleActivity.java
+++ b/tests/HwAccelerationTest/src/com/android/test/hwui/RippleActivity.java
@@ -89,7 +89,7 @@
                 + "    d = rand(float2(x, y)) > density ? d : d * .2;\n"
                 + "    d = d * rand(float2(fraction, x * y));\n"
                 + "    float alpha = 1. - pow(fraction, 3.);\n"
-                + "    return float4(sample(in_paintColor).rgb, d * alpha);\n"
+                + "    return float4(sample(in_paintColor, p).rgb, d * alpha);\n"
                 + "}";
 
         RippleView(Context c) {
diff --git a/tests/HwAccelerationTest/src/com/android/test/hwui/StretchShaderActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/StretchShaderActivity.java
index 912aee6..ade94a9 100644
--- a/tests/HwAccelerationTest/src/com/android/test/hwui/StretchShaderActivity.java
+++ b/tests/HwAccelerationTest/src/com/android/test/hwui/StretchShaderActivity.java
@@ -440,7 +440,7 @@
         }
     }
 
-    private static final String SKSL = "in shader uContentTexture;\n"
+    private static final String SKSL = "uniform shader uContentTexture;\n"
             + "uniform float uMaxStretchIntensity; // multiplier to apply to scale effect\n"
             + "uniform float uStretchAffectedDist; // Maximum percentage to stretch beyond bounds"
             + " of target\n"