Do not drop the DartExecutor's message handler when a FlutterNativeView is detached from the FlutterView (flutter/engine#8254)

An activity can use ViewFactory.retainNativeFlutterView to reuse a
FlutterNativeView across multiple instances of the activity.  In this
scenario, the FlutterNativeView should continue to handle incoming messages
sent from Dart.
This commit is contained in:
Jason Simmons
2019-03-21 18:08:58 -07:00
committed by GitHub
parent 12f29d32a1
commit 7405924bf1
2 changed files with 2 additions and 3 deletions

View File

@@ -47,9 +47,8 @@ public class FlutterNativeView implements BinaryMessenger {
assertAttached();
}
public void detach() {
public void detachFromFlutterView() {
mPluginRegistry.detach();
dartExecutor.onDetachedFromJNI();
mFlutterView = null;
}

View File

@@ -346,7 +346,7 @@ public class FlutterView extends SurfaceView implements BinaryMessenger, Texture
if (!isAttached())
return null;
getHolder().removeCallback(mSurfaceCallback);
mNativeView.detach();
mNativeView.detachFromFlutterView();
FlutterNativeView view = mNativeView;
mNativeView = null;