Add onDisplayOverlaySurface JNI (flutter/engine#18859)
This commit is contained in:
@@ -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);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -788,6 +788,17 @@ public class FlutterJNI {
|
||||
listener.onPreEngineRestart();
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@UiThread
|
||||
public void onDisplayOverlaySurface(int id, int x, int y, int width, int height) {
|
||||
ensureRunningOnMainThread();
|
||||
if (platformViewsController == null) {
|
||||
throw new RuntimeException(
|
||||
"platformViewsController must be set before attempting to position an overlay surface");
|
||||
}
|
||||
platformViewsController.onDisplayOverlaySurface(id, x, y, width, height);
|
||||
}
|
||||
// ----- End Engine Lifecycle Support ----
|
||||
|
||||
// @SuppressWarnings("unused")
|
||||
|
||||
@@ -537,4 +537,8 @@ public class PlatformViewsController implements PlatformViewsAccessibilityDelega
|
||||
public void onDisplayPlatformView(int viewId, int x, int y, int width, int height) {
|
||||
// TODO: Implement this method. https://github.com/flutter/flutter/issues/58288
|
||||
}
|
||||
|
||||
public void onDisplayOverlaySurface(int id, int x, int y, int width, int height) {
|
||||
// TODO: Implement this method. https://github.com/flutter/flutter/issues/58288
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,6 +44,14 @@ void FlutterViewOnDisplayPlatformView(JNIEnv* env,
|
||||
jint width,
|
||||
jint height);
|
||||
|
||||
void FlutterViewDisplayOverlaySurface(JNIEnv* env,
|
||||
jobject obj,
|
||||
jint id,
|
||||
jint x,
|
||||
jint y,
|
||||
jint width,
|
||||
jint height);
|
||||
|
||||
void SurfaceTextureAttachToGLContext(JNIEnv* env, jobject obj, jint textureId);
|
||||
|
||||
void SurfaceTextureUpdateTexImage(JNIEnv* env, jobject obj);
|
||||
|
||||
@@ -65,4 +65,20 @@ public class FlutterJNITest {
|
||||
.onDisplayPlatformView(
|
||||
/*viewId=*/ 1, /*x=*/ 10, /*y=*/ 20, /*width=*/ 100, /*height=*/ 200);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onDisplayOverlaySurface__callsPlatformViewsController() {
|
||||
PlatformViewsController platformViewsController = mock(PlatformViewsController.class);
|
||||
|
||||
FlutterJNI flutterJNI = new FlutterJNI();
|
||||
flutterJNI.setPlatformViewsController(platformViewsController);
|
||||
|
||||
// --- Execute Test ---
|
||||
flutterJNI.onDisplayOverlaySurface(
|
||||
/*id=*/ 1, /*x=*/ 10, /*y=*/ 20, /*width=*/ 100, /*height=*/ 200);
|
||||
|
||||
// --- Verify Results ---
|
||||
verify(platformViewsController, times(1))
|
||||
.onDisplayOverlaySurface(/*id=*/ 1, /*x=*/ 10, /*y=*/ 20, /*width=*/ 100, /*height=*/ 200);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user