add onStart hook which places flutter in an inactive state (flutter/engine#5177)

This commit is contained in:
Jonah Williams
2018-05-04 14:46:57 -07:00
committed by GitHub
parent 0a7c29f01c
commit 92e3517650
4 changed files with 22 additions and 0 deletions

View File

@@ -81,6 +81,12 @@ public class FlutterActivity extends Activity implements FlutterView.Provider, P
eventDelegate.onCreate(savedInstanceState);
}
@Override
protected void onStart() {
super.onStart();
eventDelegate.onStart();
}
@Override
protected void onResume() {
super.onResume();

View File

@@ -206,6 +206,13 @@ public final class FlutterActivityDelegate
}
}
@Override
public void onStart() {
if (flutterView != null) {
flutterView.onStart();
}
}
@Override
public void onResume() {
Application app = (Application) activity.getApplicationContext();

View File

@@ -39,6 +39,11 @@ public interface FlutterActivityEvents
*/
void onPause();
/**
* @see android.app.Activity#onStart()
*/
void onStart();
/**
* @see android.app.Activity#onResume()
*/

View File

@@ -266,6 +266,10 @@ public class FlutterView extends SurfaceView
mActivityLifecycleListeners.add(listener);
}
public void onStart() {
mFlutterLifecycleChannel.send("AppLifecycleState.inactive");
}
public void onPause() {
mFlutterLifecycleChannel.send("AppLifecycleState.inactive");
}