mirror of
https://github.com/encounter/engine.git
synced 2026-03-30 11:09:55 -07:00
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user