From 7405924bf13df7fca7dbc509190d75e2d153ecc3 Mon Sep 17 00:00:00 2001 From: Jason Simmons Date: Thu, 21 Mar 2019 18:08:58 -0700 Subject: [PATCH] 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. --- .../platform/android/io/flutter/view/FlutterNativeView.java | 3 +-- .../shell/platform/android/io/flutter/view/FlutterView.java | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/engine/src/flutter/shell/platform/android/io/flutter/view/FlutterNativeView.java b/engine/src/flutter/shell/platform/android/io/flutter/view/FlutterNativeView.java index 580612a146..2c2b57a5f1 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/view/FlutterNativeView.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/view/FlutterNativeView.java @@ -47,9 +47,8 @@ public class FlutterNativeView implements BinaryMessenger { assertAttached(); } - public void detach() { + public void detachFromFlutterView() { mPluginRegistry.detach(); - dartExecutor.onDetachedFromJNI(); mFlutterView = null; } diff --git a/engine/src/flutter/shell/platform/android/io/flutter/view/FlutterView.java b/engine/src/flutter/shell/platform/android/io/flutter/view/FlutterView.java index f8f38abbd4..7ba5256757 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/view/FlutterView.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/view/FlutterView.java @@ -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;