Do not drop the DartExecutor's message handler when a FlutterNativeView is detached from the FlutterView (#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 adc6685468
commit 68bd4f2c64
2 changed files with 2 additions and 3 deletions
@@ -47,9 +47,8 @@ public class FlutterNativeView implements BinaryMessenger {
assertAttached();
}
public void detach() {
public void detachFromFlutterView() {
mPluginRegistry.detach();
dartExecutor.onDetachedFromJNI();
mFlutterView = null;
}
@@ -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;