未验证 提交 fd6c3fc7 编写于 作者: J Jason Simmons 提交者: GitHub

Do not clear FlutterJNI state when a FlutterView is detached (#7929)

If an app is using retainFlutterNativeView or a plugin wants to keep the
FlutterNativeView active, then the FlutterNativeView should not drop its
handle to the corresponding native platform view.

Fixes https://github.com/flutter/flutter/issues/26931
上级 dff323d2
......@@ -109,8 +109,6 @@ public class FlutterEngine {
pluginRegistry.detach();
dartExecutor.onDetachedFromJNI();
flutterJNI.removeEngineLifecycleListener(engineLifecycleListener);
// TODO(mattcarroll): investigate detach vs destroy. document user-cases. update code if needed.
flutterJNI.detachFromNativeButKeepNativeResources();
}
/**
......
......@@ -392,15 +392,6 @@ public class FlutterJNI {
private native long nativeAttach(FlutterJNI flutterJNI, boolean isBackgroundView);
@UiThread
public void detachFromNativeButKeepNativeResources() {
ensureAttachedToNative();
nativeDetach(nativePlatformViewId);
nativePlatformViewId = null;
}
private native void nativeDetach(long nativePlatformViewId);
@UiThread
public void detachFromNativeAndReleaseResources() {
ensureAttachedToNative();
......
......@@ -50,7 +50,6 @@ public class FlutterNativeView implements BinaryMessenger {
mPluginRegistry.detach();
dartExecutor.onDetachedFromJNI();
mFlutterView = null;
mFlutterJNI.detachFromNativeButKeepNativeResources();
}
public void destroy() {
......
......@@ -160,11 +160,6 @@ static jlong AttachJNI(JNIEnv* env,
}
}
// TODO(mattcarroll): delete this method here and in FlutterJNI.java
static void DetachJNI(JNIEnv* env, jobject jcaller, jlong shell_holder) {
// Nothing to do.
}
static void DestroyJNI(JNIEnv* env, jobject jcaller, jlong shell_holder) {
delete ANDROID_SHELL_HOLDER;
}
......@@ -547,11 +542,6 @@ bool RegisterApi(JNIEnv* env) {
.signature = "(Lio/flutter/embedding/engine/FlutterJNI;Z)J",
.fnPtr = reinterpret_cast<void*>(&shell::AttachJNI),
},
{
.name = "nativeDetach",
.signature = "(J)V",
.fnPtr = reinterpret_cast<void*>(&shell::DetachJNI),
},
{
.name = "nativeDestroy",
.signature = "(J)V",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册