Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | List of all members
io.flutter.embedding.engine.plugins.activity.ActivityControlSurface Interface Reference

Public Member Functions

void attachToActivity ( @NonNull ExclusiveAppComponent< Activity > exclusiveActivity, @NonNull Lifecycle lifecycle)
 
void detachFromActivityForConfigChanges ()
 
void detachFromActivity ()
 
boolean onRequestPermissionsResult (int requestCode, @NonNull String[] permissions, @NonNull int[] grantResult)
 
boolean onActivityResult (int requestCode, int resultCode, @Nullable Intent data)
 
void onNewIntent (@NonNull Intent intent)
 
void onUserLeaveHint ()
 
void onSaveInstanceState (@NonNull Bundle bundle)
 
void onRestoreInstanceState (@Nullable Bundle bundle)
 

Detailed Description

Control surface through which an android.app.Activity attaches to a io.flutter.embedding.engine.FlutterEngine.

An android.app.Activity that contains a io.flutter.embedding.android.FlutterView and associated io.flutter.embedding.engine.FlutterEngine should coordinate itself with the io.flutter.embedding.engine.FlutterEngine's ActivityControlSurface.

  1. Once an android.app.Activity is created, and its associated io.flutter.embedding.engine.FlutterEngine is executing Dart code, the android.app.Activity should invoke attachToActivity( ExclusiveAppComponent, Lifecycle). At this point the io.flutter.embedding.engine.FlutterEngine is considered "attached" to the android.app.Activity and all ActivityAware plugins are given access to the android.app.Activity.
  2. Just before an attached android.app.Activity is destroyed for configuration change purposes, that android.app.Activity should invoke detachFromActivityForConfigChanges(), giving each ActivityAware plugin an opportunity to clean up its references before the is destroyed.
  3. When an android.app.Activity is destroyed for non-configuration-change purposes, or when the android.app.Activity is no longer interested in displaying a io.flutter.embedding.engine.FlutterEngine's content, the android.app.Activity should invoke detachFromActivity().
  4. When a android.app.Activity is being attached while an existing ExclusiveAppComponent is already attached, the existing ExclusiveAppComponent is given a chance to detach first via ExclusiveAppComponent#detachFromFlutterEngine() before the new activity attaches.

The attached android.app.Activity should also forward all android.app.Activity calls that this ActivityControlSurface supports, e.g., onRequestPermissionsResult(int, String[], int[]). These forwarded calls are made available to all ActivityAware plugins that are added to the attached io.flutter.embedding.engine.FlutterEngine.

Definition at line 52 of file ActivityControlSurface.java.

Member Function Documentation

◆ attachToActivity()

void io.flutter.embedding.engine.plugins.activity.ActivityControlSurface.attachToActivity ( @NonNull ExclusiveAppComponent< Activity >  exclusiveActivity,
@NonNull Lifecycle  lifecycle 
)

Call this method from the ExclusiveAppComponent that is displaying the visual content of the io.flutter.embedding.engine.FlutterEngine that is associated with this
ActivityControlSurface
.

Once an ExclusiveAppComponent is created, and its associated io.flutter.embedding.engine.FlutterEngine is executing Dart code, the ExclusiveAppComponent should invoke this method. At that point the io.flutter.embedding.engine.FlutterEngine is considered "attached" to the ExclusiveAppComponent and all ActivityAware plugins are given access to the ExclusiveAppComponent's android.app.Activity.

◆ detachFromActivity()

void io.flutter.embedding.engine.plugins.activity.ActivityControlSurface.detachFromActivity ( )

Call this method from the android.app.Activity that is attached to this
ActivityControlSurfaces
's io.flutter.embedding.engine.FlutterEngine when the android.app.Activity is about to be destroyed for non-configuration-change reasons.

This method gives each ActivityAware plugin an opportunity to clean up its references before the is destroyed.

◆ detachFromActivityForConfigChanges()

void io.flutter.embedding.engine.plugins.activity.ActivityControlSurface.detachFromActivityForConfigChanges ( )

Call this method from the android.app.Activity that is attached to this
ActivityControlSurfaces
's io.flutter.embedding.engine.FlutterEngine when the android.app.Activity is about to be destroyed due to configuration changes.

This method gives each ActivityAware plugin an opportunity to clean up its references before the is destroyed.

◆ onActivityResult()

boolean io.flutter.embedding.engine.plugins.activity.ActivityControlSurface.onActivityResult ( int  requestCode,
int  resultCode,
@Nullable Intent  data 
)

Call this method from the android.app.Activity that is attached to this
ActivityControlSurface
's io.flutter.embedding.engine.FlutterEngine and the associated method in the Activity is invoked.

Returns true if one or more plugins utilized this android.app.Activity result.

◆ onNewIntent()

void io.flutter.embedding.engine.plugins.activity.ActivityControlSurface.onNewIntent ( @NonNull Intent  intent)

Call this method from the android.app.Activity that is attached to this
ActivityControlSurface
's io.flutter.embedding.engine.FlutterEngine and the associated method in the Activity is invoked.

◆ onRequestPermissionsResult()

boolean io.flutter.embedding.engine.plugins.activity.ActivityControlSurface.onRequestPermissionsResult ( int  requestCode,
@NonNull String[]  permissions,
@NonNull int[]  grantResult 
)

Call this method from the android.app.Activity that is attached to this
ActivityControlSurface
's io.flutter.embedding.engine.FlutterEngine and the associated method in the Activity is invoked.

Returns true if one or more plugins utilized this permission result.

◆ onRestoreInstanceState()

void io.flutter.embedding.engine.plugins.activity.ActivityControlSurface.onRestoreInstanceState ( @Nullable Bundle  bundle)

Call this method from the android.app.Activity or Fragment that is attached to this ActivityControlSurface's io.flutter.embedding.engine.FlutterEngine when android.app.Activity#onCreate(Bundle) or Fragment#onCreate(Bundle) is invoked in the android.app.Activity or Fragment.

◆ onSaveInstanceState()

void io.flutter.embedding.engine.plugins.activity.ActivityControlSurface.onSaveInstanceState ( @NonNull Bundle  bundle)

Call this method from the android.app.Activity or Fragment that is attached to this ActivityControlSurface's io.flutter.embedding.engine.FlutterEngine when the associated method is invoked in the android.app.Activity or Fragment.

◆ onUserLeaveHint()

void io.flutter.embedding.engine.plugins.activity.ActivityControlSurface.onUserLeaveHint ( )

Call this method from the android.app.Activity that is attached to this
ActivityControlSurface
's io.flutter.embedding.engine.FlutterEngine and the associated method in the Activity is invoked.


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