mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08: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:
parent
adc6685468
commit
68bd4f2c64
@ -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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user