Skip to content

Commit 68bd4f2

Browse files
Do not drop the DartExecutor's message handler when a FlutterNativeView is detached from the FlutterView (flutter#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.
1 parent adc6685 commit 68bd4f2

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

shell/platform/android/io/flutter/view/FlutterNativeView.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,8 @@ public FlutterNativeView(@NonNull Context context, boolean isBackgroundView) {
4747
assertAttached();
4848
}
4949

50-
public void detach() {
50+
public void detachFromFlutterView() {
5151
mPluginRegistry.detach();
52-
dartExecutor.onDetachedFromJNI();
5352
mFlutterView = null;
5453
}
5554

shell/platform/android/io/flutter/view/FlutterView.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ public FlutterNativeView detach() {
346346
if (!isAttached())
347347
return null;
348348
getHolder().removeCallback(mSurfaceCallback);
349-
mNativeView.detach();
349+
mNativeView.detachFromFlutterView();
350350

351351
FlutterNativeView view = mNativeView;
352352
mNativeView = null;

0 commit comments

Comments
 (0)