Flutter Engine
The Flutter Engine
Public Member Functions | Protected Member Functions | List of all members
dev.flutter.scenarios.TestActivity Class Referenceabstract
Inheritance diagram for dev.flutter.scenarios.TestActivity:
dev.flutter.scenarios.TestableFlutterActivity io.flutter.embedding.android.FlutterActivity io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.Host io.flutter.embedding.android.FlutterEngineProvider io.flutter.embedding.android.FlutterEngineConfigurator io.flutter.plugin.platform.PlatformPlugin.PlatformPluginDelegate dev.flutter.scenarios.ExternalTextureFlutterActivity dev.flutter.scenarios.GetBitmapActivity dev.flutter.scenarios.PlatformViewsActivity dev.flutter.scenarios.SpawnMultiEngineActivity dev.flutter.scenarios.SpawnedEngineActivity

Public Member Functions

FlutterShellArgs getFlutterShellArgs ()
 
void onFlutterUiDisplayed ()
 
- Public Member Functions inherited from dev.flutter.scenarios.TestableFlutterActivity
void configureFlutterEngine (@NonNull FlutterEngine flutterEngine)
 
void waitUntilFlutterRendered ()
 
- Public Member Functions inherited from io.flutter.embedding.android.FlutterActivity
 FlutterActivity ()
 
ExclusiveAppComponent< Activity > getExclusiveAppComponent ()
 
void registerOnBackInvokedCallback ()
 
void unregisterOnBackInvokedCallback ()
 
void setFrameworkHandlesBack (boolean frameworkHandlesBack)
 
void onPostResume ()
 
void release ()
 
void detachFromFlutterEngine ()
 
void onBackPressed ()
 
void startBackGesture (@NonNull BackEvent backEvent)
 
void updateBackGestureProgress (@NonNull BackEvent backEvent)
 
void commitBackGesture ()
 
void cancelBackGesture ()
 
void onRequestPermissionsResult (int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults)
 
void onUserLeaveHint ()
 
void onWindowFocusChanged (boolean hasFocus)
 
void onTrimMemory (int level)
 
Context getContext ()
 
Activity getActivity ()
 
Lifecycle getLifecycle ()
 
FlutterShellArgs getFlutterShellArgs ()
 
String getCachedEngineId ()
 
String getCachedEngineGroupId ()
 
boolean shouldDestroyEngineWithHost ()
 
String getDartEntrypointFunctionName ()
 
List< String > getDartEntrypointArgs ()
 
String getDartEntrypointLibraryUri ()
 
String getInitialRoute ()
 
String getAppBundlePath ()
 
RenderMode getRenderMode ()
 
TransparencyMode getTransparencyMode ()
 
FlutterEngine provideFlutterEngine (@NonNull Context context)
 
PlatformPlugin providePlatformPlugin ( @Nullable Activity activity, @NonNull FlutterEngine flutterEngine)
 
void configureFlutterEngine (@NonNull FlutterEngine flutterEngine)
 
void cleanUpFlutterEngine (@NonNull FlutterEngine flutterEngine)
 
boolean shouldAttachEngineToActivity ()
 
boolean shouldHandleDeeplinking ()
 
void onFlutterSurfaceViewCreated (@NonNull FlutterSurfaceView flutterSurfaceView)
 
void onFlutterTextureViewCreated (@NonNull FlutterTextureView flutterTextureView)
 
void onFlutterUiDisplayed ()
 
void onFlutterUiNoLongerDisplayed ()
 
boolean shouldRestoreAndSaveState ()
 
boolean shouldDispatchAppLifecycleState ()
 
boolean attachToEngineAutomatically ()
 
boolean popSystemNavigator ()
 
void updateSystemUiOverlays ()
 
Context getContext ()
 
boolean shouldHandleDeeplinking ()
 
Activity getActivity ()
 
Lifecycle getLifecycle ()
 
FlutterShellArgs getFlutterShellArgs ()
 
String getCachedEngineId ()
 
String getCachedEngineGroupId ()
 
boolean shouldDestroyEngineWithHost ()
 
void detachFromFlutterEngine ()
 
String getDartEntrypointFunctionName ()
 
String getDartEntrypointLibraryUri ()
 
List< String > getDartEntrypointArgs ()
 
String getAppBundlePath ()
 
String getInitialRoute ()
 
RenderMode getRenderMode ()
 
TransparencyMode getTransparencyMode ()
 
ExclusiveAppComponent< Activity > getExclusiveAppComponent ()
 
FlutterEngine provideFlutterEngine (@NonNull Context context)
 
PlatformPlugin providePlatformPlugin ( @Nullable Activity activity, @NonNull FlutterEngine flutterEngine)
 
void configureFlutterEngine (@NonNull FlutterEngine flutterEngine)
 
void cleanUpFlutterEngine (@NonNull FlutterEngine flutterEngine)
 
boolean shouldAttachEngineToActivity ()
 
void onFlutterSurfaceViewCreated (@NonNull FlutterSurfaceView flutterSurfaceView)
 
void onFlutterTextureViewCreated (@NonNull FlutterTextureView flutterTextureView)
 
void onFlutterUiDisplayed ()
 
void onFlutterUiNoLongerDisplayed ()
 
boolean shouldRestoreAndSaveState ()
 
void updateSystemUiOverlays ()
 
boolean shouldDispatchAppLifecycleState ()
 
boolean attachToEngineAutomatically ()
 
FlutterEngine provideFlutterEngine (@NonNull Context context)
 
void configureFlutterEngine (@NonNull FlutterEngine flutterEngine)
 
void cleanUpFlutterEngine (@NonNull FlutterEngine flutterEngine)
 
boolean popSystemNavigator ()
 
default void setFrameworkHandlesBack (boolean frameworkHandlesBack)
 

Protected Member Functions

void onCreate (@Nullable Bundle savedInstanceState)
 
void onDestroy ()
 
void getScenarioParams (@NonNull Map< String, Object > args)
 
void testFlutterLoaderCallbackWhenInitializedTwice ()
 
- Protected Member Functions inherited from dev.flutter.scenarios.TestableFlutterActivity
void onCreate (@Nullable Bundle savedInstanceState)
 
void notifyFlutterRendered ()
 
- Protected Member Functions inherited from io.flutter.embedding.android.FlutterActivity
void onCreate (@Nullable Bundle savedInstanceState)
 
OnBackInvokedCallback getOnBackInvokedCallback ()
 
void onStart ()
 
void onResume ()
 
void onPause ()
 
void onStop ()
 
void onSaveInstanceState (Bundle outState)
 
void onDestroy ()
 
void onActivityResult (int requestCode, int resultCode, Intent data)
 
void onNewIntent (@NonNull Intent intent)
 
BackgroundMode getBackgroundMode ()
 
FlutterEngine getFlutterEngine ()
 
Bundle getMetaData () throws PackageManager.NameNotFoundException
 

Additional Inherited Members

- Static Public Member Functions inherited from io.flutter.embedding.android.FlutterActivity
static Intent createDefaultIntent (@NonNull Context launchContext)
 
static NewEngineIntentBuilder withNewEngine ()
 
static CachedEngineIntentBuilder withCachedEngine (@NonNull String cachedEngineId)
 
static NewEngineInGroupIntentBuilder withNewEngineInGroup (@NonNull String engineGroupId)
 
- Static Public Attributes inherited from io.flutter.embedding.android.FlutterActivity
static final int FLUTTER_VIEW_ID = View.generateViewId()
 
- Protected Attributes inherited from io.flutter.embedding.android.FlutterActivity
FlutterActivityAndFragmentDelegate delegate
 
- Package Functions inherited from io.flutter.embedding.android.FlutterActivity
void setDelegate (@NonNull FlutterActivityAndFragmentDelegate delegate)
 

Detailed Description

Definition at line 28 of file TestActivity.java.

Member Function Documentation

◆ getFlutterShellArgs()

FlutterShellArgs dev.flutter.scenarios.TestActivity.getFlutterShellArgs ( )
inline

FlutterActivityAndFragmentDelegate.Host method that is used by FlutterActivityAndFragmentDelegate to obtain Flutter shell arguments when initializing Flutter.

Reimplemented from io.flutter.embedding.android.FlutterActivity.

Definition at line 43 of file TestActivity.java.

43 {
44 FlutterShellArgs args = FlutterShellArgs.fromIntent(getIntent());
45 args.add(FlutterShellArgs.ARG_TRACE_STARTUP);
46 args.add(FlutterShellArgs.ARG_ENABLE_DART_PROFILING);
47 args.add(FlutterShellArgs.ARG_VERBOSE_LOGGING);
48 return args;
49 }
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args

◆ getScenarioParams()

void dev.flutter.scenarios.TestActivity.getScenarioParams ( @NonNull Map< String, Object >  args)
inlineprotected

Populates test-specific parameters that are sent to the Dart test scenario.

Parameters
argsThe map of test arguments

Reimplemented in dev.flutter.scenarios.ExternalTextureFlutterActivity.

Definition at line 79 of file TestActivity.java.

79{}

◆ onCreate()

void dev.flutter.scenarios.TestActivity.onCreate ( @Nullable Bundle  savedInstanceState)
inlineprotected

Reimplemented from dev.flutter.scenarios.TestableFlutterActivity.

Reimplemented in dev.flutter.scenarios.ExternalTextureFlutterActivity.

Definition at line 30 of file TestActivity.java.

30 {
31 super.onCreate(savedInstanceState);
32 hideSystemBars(getWindow());
34 }

◆ onDestroy()

void dev.flutter.scenarios.TestActivity.onDestroy ( )
inlineprotected

Reimplemented from io.flutter.embedding.android.FlutterActivity.

Definition at line 37 of file TestActivity.java.

37 {
38 super.onDestroy();
39 }

◆ onFlutterUiDisplayed()

void dev.flutter.scenarios.TestActivity.onFlutterUiDisplayed ( )
inline

Invoked by this delegate when its FlutterView starts painting pixels.

Reimplemented from io.flutter.embedding.android.FlutterActivity.

Reimplemented in dev.flutter.scenarios.ExternalTextureFlutterActivity.

Definition at line 52 of file TestActivity.java.

52 {
53 final Intent launchIntent = getIntent();
54 MethodChannel channel =
55 new MethodChannel(
56 Objects.requireNonNull(getFlutterEngine()).getDartExecutor(),
57 "driver",
58 JSONMethodCodec.INSTANCE);
59 Map<String, Object> test = new HashMap<>(2);
60 if (launchIntent.hasExtra("scenario_name")) {
61 test.put("name", launchIntent.getStringExtra("scenario_name"));
62 } else {
63 test.put("name", "animated_color_square");
64 }
65 test.put("use_android_view", launchIntent.getBooleanExtra("use_android_view", false));
66 test.put(
67 "expect_android_view_fallback",
68 launchIntent.getBooleanExtra("expect_android_view_fallback", false));
69 test.put("view_type", launchIntent.getStringExtra("view_type"));
71 channel.invokeMethod("set_scenario", test);
72 }
void getScenarioParams(@NonNull Map< String, Object > args)

◆ testFlutterLoaderCallbackWhenInitializedTwice()

void dev.flutter.scenarios.TestActivity.testFlutterLoaderCallbackWhenInitializedTwice ( )
inlineprotected

This method verifies that io.flutter.embedding.engine.loader.FlutterLoader#ensureInitializationCompleteAsync(Context, String[], Handler, Runnable) invokes its callback when called after initialization.

Definition at line 86 of file TestActivity.java.

86 {
87 FlutterLoader flutterLoader = FlutterInjector.instance().flutterLoader();
88
89 // Flutter is probably already loaded in this app based on
90 // code that ran before this method. Nonetheless, invoke the
91 // blocking initialization here to ensure it's initialized.
92 flutterLoader.startInitialization(getApplicationContext());
93 flutterLoader.ensureInitializationComplete(getApplication(), new String[] {});
94
95 // Now that Flutter is loaded, invoke ensureInitializationCompleteAsync with
96 // a callback and verify that the callback is invoked.
97 Handler mainHandler = new Handler(Looper.getMainLooper());
98
99 final AtomicBoolean didInvokeCallback = new AtomicBoolean(false);
100
101 flutterLoader.ensureInitializationCompleteAsync(
102 getApplication(), new String[] {}, mainHandler, () -> didInvokeCallback.set(true));
103
104 mainHandler.post(
105 () -> {
106 if (!didInvokeCallback.get()) {
107 throw new RuntimeException(
108 "Failed test: FlutterLoader#ensureInitializationCompleteAsync() did not invoke its callback.");
109 }
110 });
111 }

The documentation for this class was generated from the following file: