5package dev.flutter.scenariosui;
7import androidx.annotation.NonNull;
8import dev.flutter.scenarios.TestableFlutterActivity;
9import java.io.IOException;
10import java.io.InputStream;
11import java.io.OutputStream;
12import java.net.Socket;
13import java.nio.ByteBuffer;
14import java.util.concurrent.CountDownLatch;
15import java.util.concurrent.Executor;
16import java.util.concurrent.Executors;
23 private static final String HOST =
"localhost";
24 private static final int PORT = 3000;
26 private static Connection conn;
27 private static Executor executor;
29 private static class Connection {
30 final Socket clientSocket;
31 final OutputStream
out;
34 Connection(Socket socket)
throws IOException {
35 clientSocket = socket;
36 out = socket.getOutputStream();
37 in = socket.getInputStream();
41 final ByteBuffer
buffer = ByteBuffer.allocate(
name.length() + 12);
47 final byte[] bytes =
buffer.array();
48 out.write(bytes, 0, bytes.length);
56 synchronized void close()
throws IOException {
63 if (executor ==
null) {
64 executor = Executors.newSingleThreadExecutor();
70 final Socket socket =
new Socket(HOST, PORT);
71 conn =
new Connection(socket);
72 }
catch (IOException
e) {
73 throw new RuntimeException(
e);
80 public static synchronized void finish() {
81 if (executor !=
null && conn !=
null) {
87 }
catch (IOException
e) {
88 throw new RuntimeException(
e);
101 @NonNull String filename, @NonNull CountDownLatch latch) {
102 if (executor !=
null && conn !=
null) {
106 conn.writeFile(filename);
107 }
catch (IOException
e) {
108 throw new RuntimeException(
e);
127 CountDownLatch latch =
new CountDownLatch(1);
128 activity.waitUntilFlutterRendered();
static synchronized void finish()
static synchronized void onCreate()
static void capture(@NonNull TestableFlutterActivity activity, @NonNull String captureName)
static synchronized void writeFile( @NonNull String filename, @NonNull CountDownLatch latch)
DEF_SWITCHES_START aot vmservice shared library name
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace buffer