diff --git a/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/FlutterShellArgs.java b/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/FlutterShellArgs.java index b064ef8f17..7b861171a1 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/FlutterShellArgs.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/FlutterShellArgs.java @@ -38,6 +38,8 @@ public class FlutterShellArgs { public static final String ARG_SKIA_DETERMINISTIC_RENDERING = "--skia-deterministic-rendering"; public static final String ARG_KEY_TRACE_SKIA = "trace-skia"; public static final String ARG_TRACE_SKIA = "--trace-skia"; + public static final String ARG_KEY_TRACE_SKIA_ALLOWLIST = "trace-skia-allowlist"; + public static final String ARG_TRACE_SKIA_ALLOWLIST = "--trace-skia-allowlist="; public static final String ARG_KEY_TRACE_SYSTRACE = "trace-systrace"; public static final String ARG_TRACE_SYSTRACE = "--trace-systrace"; public static final String ARG_KEY_DUMP_SHADER_SKP_ON_SHADER_COMPILATION = @@ -95,6 +97,10 @@ public class FlutterShellArgs { if (intent.getBooleanExtra(ARG_KEY_TRACE_SKIA, false)) { args.add(ARG_TRACE_SKIA); } + String traceSkiaAllowlist = intent.getStringExtra(ARG_KEY_TRACE_SKIA_ALLOWLIST); + if (traceSkiaAllowlist != null) { + args.add(ARG_TRACE_SKIA_ALLOWLIST + traceSkiaAllowlist); + } if (intent.getBooleanExtra(ARG_KEY_TRACE_SYSTRACE, false)) { args.add(ARG_TRACE_SYSTRACE); } diff --git a/engine/src/flutter/shell/platform/android/test/io/flutter/embedding/engine/FlutterShellArgsTest.java b/engine/src/flutter/shell/platform/android/test/io/flutter/embedding/engine/FlutterShellArgsTest.java index 6dfd65dc04..35d895a13b 100644 --- a/engine/src/flutter/shell/platform/android/test/io/flutter/embedding/engine/FlutterShellArgsTest.java +++ b/engine/src/flutter/shell/platform/android/test/io/flutter/embedding/engine/FlutterShellArgsTest.java @@ -1,9 +1,12 @@ package test.io.flutter.embedding.engine; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; import android.content.Intent; import io.flutter.embedding.engine.FlutterShellArgs; +import java.util.Arrays; +import java.util.HashSet; import org.junit.Test; import org.junit.runner.RunWith; import org.robolectric.RobolectricTestRunner; @@ -13,16 +16,19 @@ import org.robolectric.annotation.Config; @RunWith(RobolectricTestRunner.class) public class FlutterShellArgsTest { @Test - public void itProcessesDartFlags() { + public void itProcessesShellFlags() { // Setup the test. Intent intent = new Intent(); intent.putExtra("dart-flags", "--observe --no-hot --no-pub"); + intent.putExtra("trace-skia-allowlist", "skia.a,skia.b"); // Execute the behavior under test. FlutterShellArgs args = FlutterShellArgs.fromIntent(intent); + HashSet argValues = new HashSet(Arrays.asList(args.toArray())); // Verify results. - assertEquals(1, args.toArray().length); - assertEquals("--dart-flags=--observe --no-hot --no-pub", args.toArray()[0]); + assertEquals(2, argValues.size()); + assertTrue(argValues.contains("--dart-flags=--observe --no-hot --no-pub")); + assertTrue(argValues.contains("--trace-skia-allowlist=skia.a,skia.b")); } }