Add trace-skia-allowlist to the Android intent flags (flutter/engine#26454)
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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<String> argValues = new HashSet<String>(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"));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user