mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Revert "onDisplayPlatformView JNI (#18786)" (flutter/engine#18826)
This reverts commit 24d7c5c16b1aa9bc263d1428cf228927e96da97b.
This commit is contained in:
parent
24d7c5c16b
commit
162a2c6370
@ -103,10 +103,6 @@ public class FlutterEngine {
|
||||
|
||||
platformViewsController.onPreEngineRestart();
|
||||
}
|
||||
|
||||
public void onDisplayPlatformView(int viewId, int x, int y, int width, int height) {
|
||||
platformViewsController.onDisplayPlatformView(viewId, x, y, width, height);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
@ -211,7 +207,6 @@ public class FlutterEngine {
|
||||
flutterLoader.ensureInitializationComplete(context, dartVmArgs);
|
||||
|
||||
flutterJNI.addEngineLifecycleListener(engineLifecycleListener);
|
||||
flutterJNI.setPlatformViewsController(platformViewsController);
|
||||
attachToJni();
|
||||
|
||||
this.dartExecutor = new DartExecutor(flutterJNI, context.getAssets());
|
||||
|
||||
@ -22,7 +22,6 @@ import io.flutter.embedding.engine.dart.PlatformMessageHandler;
|
||||
import io.flutter.embedding.engine.renderer.FlutterUiDisplayListener;
|
||||
import io.flutter.embedding.engine.renderer.RenderSurface;
|
||||
import io.flutter.plugin.common.StandardMessageCodec;
|
||||
import io.flutter.plugin.platform.PlatformViewsController;
|
||||
import io.flutter.view.AccessibilityBridge;
|
||||
import io.flutter.view.FlutterCallbackInformation;
|
||||
import java.nio.ByteBuffer;
|
||||
@ -169,7 +168,6 @@ public class FlutterJNI {
|
||||
@Nullable private Long nativePlatformViewId;
|
||||
@Nullable private AccessibilityDelegate accessibilityDelegate;
|
||||
@Nullable private PlatformMessageHandler platformMessageHandler;
|
||||
@Nullable private PlatformViewsController platformViewsController;
|
||||
|
||||
@NonNull
|
||||
private final Set<EngineLifecycleListener> engineLifecycleListeners = new CopyOnWriteArraySet<>();
|
||||
@ -417,12 +415,6 @@ public class FlutterJNI {
|
||||
long nativePlatformViewId, @NonNull ByteBuffer buffer, int position);
|
||||
// ------ End Touch Interaction Support ---
|
||||
|
||||
@UiThread
|
||||
public void setPlatformViewsController(@NonNull PlatformViewsController platformViewsController) {
|
||||
ensureRunningOnMainThread();
|
||||
this.platformViewsController = platformViewsController;
|
||||
}
|
||||
|
||||
// ------ Start Accessibility Support -----
|
||||
/**
|
||||
* Sets the {@link AccessibilityDelegate} for the attached Flutter context.
|
||||
@ -790,17 +782,6 @@ public class FlutterJNI {
|
||||
}
|
||||
// ----- End Engine Lifecycle Support ----
|
||||
|
||||
// @SuppressWarnings("unused")
|
||||
@UiThread
|
||||
public void onDisplayPlatformView(int viewId, int x, int y, int width, int height) {
|
||||
ensureRunningOnMainThread();
|
||||
if (platformViewsController == null) {
|
||||
throw new RuntimeException(
|
||||
"platformViewsController must be set before attempting to position a platform view");
|
||||
}
|
||||
platformViewsController.onDisplayPlatformView(viewId, x, y, width, height);
|
||||
}
|
||||
|
||||
// TODO(mattcarroll): determine if this is nonull or nullable
|
||||
@UiThread
|
||||
public Bitmap getBitmap() {
|
||||
|
||||
@ -533,8 +533,4 @@ public class PlatformViewsController implements PlatformViewsAccessibilityDelega
|
||||
}
|
||||
vdControllers.clear();
|
||||
}
|
||||
|
||||
public void onDisplayPlatformView(int viewId, int x, int y, int width, int height) {
|
||||
// TODO: Implement this method. https://github.com/flutter/flutter/issues/58288
|
||||
}
|
||||
}
|
||||
|
||||
@ -118,19 +118,6 @@ void FlutterViewOnPreEngineRestart(JNIEnv* env, jobject obj) {
|
||||
FML_CHECK(CheckException(env));
|
||||
}
|
||||
|
||||
static jmethodID g_on_display_platform_view_method = nullptr;
|
||||
void FlutterViewOnDisplayPlatformView(JNIEnv* env,
|
||||
jobject obj,
|
||||
jint view_id,
|
||||
jint x,
|
||||
jint y,
|
||||
jint width,
|
||||
jint height) {
|
||||
env->CallVoidMethod(obj, g_on_display_platform_view_method, view_id, x, y,
|
||||
width, height);
|
||||
FML_CHECK(CheckException(env));
|
||||
}
|
||||
|
||||
static jmethodID g_attach_to_gl_context_method = nullptr;
|
||||
void SurfaceTextureAttachToGLContext(JNIEnv* env, jobject obj, jint textureId) {
|
||||
env->CallVoidMethod(obj, g_attach_to_gl_context_method, textureId);
|
||||
@ -763,14 +750,6 @@ bool PlatformViewAndroid::Register(JNIEnv* env) {
|
||||
return false;
|
||||
}
|
||||
|
||||
g_on_display_platform_view_method = env->GetMethodID(
|
||||
g_flutter_jni_class->obj(), "onDisplayPlatformView", "(IIIII)V");
|
||||
|
||||
if (g_on_display_platform_view_method == nullptr) {
|
||||
FML_LOG(ERROR) << "Could not locate onDisplayPlatformView method";
|
||||
return false;
|
||||
}
|
||||
|
||||
g_surface_texture_class = new fml::jni::ScopedJavaGlobalRef<jclass>(
|
||||
env, env->FindClass("android/graphics/SurfaceTexture"));
|
||||
if (g_surface_texture_class->is_null()) {
|
||||
|
||||
@ -36,14 +36,6 @@ void FlutterViewOnFirstFrame(JNIEnv* env, jobject obj);
|
||||
|
||||
void FlutterViewOnPreEngineRestart(JNIEnv* env, jobject obj);
|
||||
|
||||
void FlutterViewOnDisplayPlatformView(JNIEnv* env,
|
||||
jobject obj,
|
||||
jint view_id,
|
||||
jint x,
|
||||
jint y,
|
||||
jint width,
|
||||
jint height);
|
||||
|
||||
void SurfaceTextureAttachToGLContext(JNIEnv* env, jobject obj, jint textureId);
|
||||
|
||||
void SurfaceTextureUpdateTexImage(JNIEnv* env, jobject obj);
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
package io.flutter.embedding.engine;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.mockito.Mockito.verify;
|
||||
|
||||
import io.flutter.embedding.engine.renderer.FlutterUiDisplayListener;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
@ -45,21 +44,4 @@ public class FlutterJNITest {
|
||||
// --- Verify Results ---
|
||||
assertEquals(1, callbackInvocationCount.get());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onDisplayPlatformView__callsPlatformViewsController() {
|
||||
PlatformViewsController platformViewsController = mock(PlatformViewsController.class);
|
||||
|
||||
FlutterJNI flutterJNI = new FlutterJNI();
|
||||
flutterJNI.setPlatformViewsController(platformViewsController);
|
||||
|
||||
// --- Execute Test ---
|
||||
flutterJNI.onDisplayPlatformView(
|
||||
/*viewId=*/ 1, /*x=*/ 10, /*y=*/ 20, /*width=*/ 100, /*height=*/ 200);
|
||||
|
||||
// --- Verify Results ---
|
||||
verify(platformViewsController, times(1))
|
||||
.onDisplayPlatformView(
|
||||
/*viewId=*/ 1, /*x=*/ 10, /*y=*/ 20, /*width=*/ 100, /*height=*/ 200);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user