5package dev.flutter.scenarios;
13import androidx.annotation.NonNull;
14import androidx.annotation.Nullable;
15import androidx.core.view.WindowCompat;
16import androidx.core.view.WindowInsetsCompat;
17import androidx.core.view.WindowInsetsControllerCompat;
18import io.flutter.FlutterInjector;
19import io.flutter.embedding.engine.FlutterShellArgs;
20import io.flutter.embedding.engine.loader.FlutterLoader;
21import io.flutter.plugin.common.JSONMethodCodec;
22import io.flutter.plugin.common.MethodChannel;
23import java.util.HashMap;
25import java.util.Objects;
26import java.util.concurrent.atomic.AtomicBoolean;
30 protected void onCreate(@Nullable Bundle savedInstanceState) {
31 super.onCreate(savedInstanceState);
32 hideSystemBars(getWindow());
53 final Intent launchIntent = getIntent();
59 Map<String, Object>
test =
new HashMap<>(2);
60 if (launchIntent.hasExtra(
"scenario_name")) {
61 test.put(
"name", launchIntent.getStringExtra(
"scenario_name"));
63 test.put(
"name",
"animated_color_square");
65 test.put(
"use_android_view", launchIntent.getBooleanExtra(
"use_android_view",
false));
67 "expect_android_view_fallback",
68 launchIntent.getBooleanExtra(
"expect_android_view_fallback",
false));
69 test.put(
"view_type", launchIntent.getStringExtra(
"view_type"));
97 Handler mainHandler =
new Handler(Looper.getMainLooper());
99 final AtomicBoolean didInvokeCallback =
new AtomicBoolean(
false);
102 getApplication(),
new String[] {}, mainHandler, () -> didInvokeCallback.set(
true));
106 if (!didInvokeCallback.get()) {
107 throw new RuntimeException(
108 "Failed test: FlutterLoader#ensureInitializationCompleteAsync() did not invoke its callback.");
113 private static void hideSystemBars(Window
window) {
114 final WindowInsetsControllerCompat insetController =
115 WindowCompat.getInsetsController(
window,
window.getDecorView());
116 assert insetController !=
null;
117 insetController.setSystemBarsBehavior(
118 WindowInsetsControllerCompat.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE);
119 insetController.hide(WindowInsetsCompat.Type.systemBars());
void testFlutterLoaderCallbackWhenInitializedTwice()
FlutterShellArgs getFlutterShellArgs()
void onFlutterUiDisplayed()
void onCreate(@Nullable Bundle savedInstanceState)
void getScenarioParams(@NonNull Map< String, Object > args)
FlutterEngine getFlutterEngine()
static final String ARG_ENABLE_DART_PROFILING
static final String ARG_TRACE_STARTUP
static final String ARG_VERBOSE_LOGGING
static FlutterShellArgs fromIntent(@NonNull Intent intent)
void ensureInitializationComplete( @NonNull Context applicationContext, @Nullable String[] args)
void startInitialization(@NonNull Context applicationContext)
void ensureInitializationCompleteAsync( @NonNull Context applicationContext, @Nullable String[] args, @NonNull Handler callbackHandler, @NonNull Runnable callback)
static final JSONMethodCodec INSTANCE
void invokeMethod(@NonNull String method, @Nullable Object arguments)
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args