Do not clear FlutterJNI state when a FlutterView is detached (flutter/engine#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
This commit is contained in:
Jason Simmons
2019-02-25 15:31:50 -08:00
committed by GitHub
parent 4a81a96859
commit 153bf88d71
4 changed files with 0 additions and 22 deletions

View File

@@ -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();
}
/**

View File

@@ -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();

View File

@@ -50,7 +50,6 @@ public class FlutterNativeView implements BinaryMessenger {
mPluginRegistry.detach();
dartExecutor.onDetachedFromJNI();
mFlutterView = null;
mFlutterJNI.detachFromNativeButKeepNativeResources();
}
public void destroy() {

View File

@@ -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",