From ba8dcb848bff4ad0c56dc36ed847493cb95d572b Mon Sep 17 00:00:00 2001 From: cg021 Date: Sat, 6 Jun 2020 14:11:41 -0500 Subject: [PATCH 1/7] onBeginFrame JNI --- .../flutter/embedding/engine/FlutterJNI.java | 19 +++++++++++++++++++ .../platform/PlatformViewsController.java | 4 ++++ .../android/platform_view_android_jni.cc | 14 ++++++++++++++ .../android/platform_view_android_jni.h | 2 ++ .../embedding/engine/FlutterJNITest.java | 19 +++++++++++++++++++ 5 files changed, 58 insertions(+) diff --git a/shell/platform/android/io/flutter/embedding/engine/FlutterJNI.java b/shell/platform/android/io/flutter/embedding/engine/FlutterJNI.java index b0d5ad9ba19e2..321dfd1cbde5d 100644 --- a/shell/platform/android/io/flutter/embedding/engine/FlutterJNI.java +++ b/shell/platform/android/io/flutter/embedding/engine/FlutterJNI.java @@ -22,6 +22,7 @@ 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; @@ -168,6 +169,7 @@ public static native void nativeOnVsync( @Nullable private Long nativePlatformViewId; @Nullable private AccessibilityDelegate accessibilityDelegate; @Nullable private PlatformMessageHandler platformMessageHandler; + @Nullable private PlatformViewsController platformViewsController; @NonNull private final Set engineLifecycleListeners = new CopyOnWriteArraySet<>(); @@ -415,6 +417,12 @@ private native void nativeDispatchPointerDataPacket( 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. @@ -780,6 +788,17 @@ private void onPreEngineRestart() { listener.onPreEngineRestart(); } } + + @SuppressWarnings("unused") + @UiThread + public void onBeginFrame() { + ensureRunningOnMainThread(); + if (platformViewsController == null) { + throw new RuntimeException( + "platformViewsController must be set before attempting to begin the frame"); + } + platformViewsController.onBeginFrame(); + } // ----- End Engine Lifecycle Support ---- // TODO(mattcarroll): determine if this is nonull or nullable diff --git a/shell/platform/android/io/flutter/plugin/platform/PlatformViewsController.java b/shell/platform/android/io/flutter/plugin/platform/PlatformViewsController.java index bc36210e4c9b7..c9e04dfb6747c 100644 --- a/shell/platform/android/io/flutter/plugin/platform/PlatformViewsController.java +++ b/shell/platform/android/io/flutter/plugin/platform/PlatformViewsController.java @@ -533,4 +533,8 @@ private void flushAllViews() { } vdControllers.clear(); } + + public void onBeginFrame() { + // TODO: Implement this method. https://github.com/flutter/flutter/issues/58288 + } } diff --git a/shell/platform/android/platform_view_android_jni.cc b/shell/platform/android/platform_view_android_jni.cc index 4f6f9258b3e11..53b0ac71c1df5 100644 --- a/shell/platform/android/platform_view_android_jni.cc +++ b/shell/platform/android/platform_view_android_jni.cc @@ -118,6 +118,12 @@ void FlutterViewOnPreEngineRestart(JNIEnv* env, jobject obj) { FML_CHECK(CheckException(env)); } +static jmethodID g_on_begin_frame_method = nullptr; +void FlutterViewBeginFrame(JNIEnv* env, jobject obj) { + env->CallVoidMethod(obj, g_on_begin_frame_method); + 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); @@ -750,6 +756,14 @@ bool PlatformViewAndroid::Register(JNIEnv* env) { return false; } + g_on_begin_frame_method = + env->GetMethodID(g_flutter_jni_class->obj(), "onBeginFrame", "()V"); + + if (g_on_begin_frame_method == nullptr) { + FML_LOG(ERROR) << "Could not locate onBeginFrame method"; + return false; + } + g_surface_texture_class = new fml::jni::ScopedJavaGlobalRef( env, env->FindClass("android/graphics/SurfaceTexture")); if (g_surface_texture_class->is_null()) { diff --git a/shell/platform/android/platform_view_android_jni.h b/shell/platform/android/platform_view_android_jni.h index 07c70b2a45b50..ec6e8542f998b 100644 --- a/shell/platform/android/platform_view_android_jni.h +++ b/shell/platform/android/platform_view_android_jni.h @@ -36,6 +36,8 @@ void FlutterViewOnFirstFrame(JNIEnv* env, jobject obj); void FlutterViewOnPreEngineRestart(JNIEnv* env, jobject obj); +void FlutterViewBeginFrame(JNIEnv* env, jobject obj); + void SurfaceTextureAttachToGLContext(JNIEnv* env, jobject obj, jint textureId); void SurfaceTextureUpdateTexImage(JNIEnv* env, jobject obj); diff --git a/shell/platform/android/test/io/flutter/embedding/engine/FlutterJNITest.java b/shell/platform/android/test/io/flutter/embedding/engine/FlutterJNITest.java index 98b8660683837..51a5c046b8a5e 100644 --- a/shell/platform/android/test/io/flutter/embedding/engine/FlutterJNITest.java +++ b/shell/platform/android/test/io/flutter/embedding/engine/FlutterJNITest.java @@ -1,8 +1,12 @@ package io.flutter.embedding.engine; import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; import io.flutter.embedding.engine.renderer.FlutterUiDisplayListener; +import io.flutter.plugin.platform.PlatformViewsController; import java.util.concurrent.atomic.AtomicInteger; import org.junit.Test; import org.junit.runner.RunWith; @@ -44,4 +48,19 @@ public void onFlutterUiNoLongerDisplayed() {} // --- Verify Results --- assertEquals(1, callbackInvocationCount.get()); } + + @Test + public void onBeginFrame__callsPlatformViewsController() { + PlatformViewsController platformViewsController = mock(PlatformViewsController.class); + + // --- Test Setup --- + FlutterJNI flutterJNI = new FlutterJNI(); + flutterJNI.setPlatformViewsController(platformViewsController); + + // --- Execute Test --- + flutterJNI.onBeginFrame(); + + // --- Verify Results --- + verify(platformViewsController, times(1)).onBeginFrame(); + } } From e37f96ee0609c2d5dadf69574fc25f3317626845 Mon Sep 17 00:00:00 2001 From: cg021 Date: Tue, 9 Jun 2020 19:42:45 -0500 Subject: [PATCH 2/7] sync with master --- .../embedding/engine/FlutterEngine.java | 4 --- .../flutter/embedding/engine/FlutterJNI.java | 11 +++++++ .../platform/PlatformViewsController.java | 8 +++++ .../android/platform_view_android_jni.h | 16 +++++++++ .../embedding/engine/FlutterJNITest.java | 33 +++++++++++++++++++ 5 files changed, 68 insertions(+), 4 deletions(-) diff --git a/shell/platform/android/io/flutter/embedding/engine/FlutterEngine.java b/shell/platform/android/io/flutter/embedding/engine/FlutterEngine.java index 71a93c0a04330..3b007172b80ad 100644 --- a/shell/platform/android/io/flutter/embedding/engine/FlutterEngine.java +++ b/shell/platform/android/io/flutter/embedding/engine/FlutterEngine.java @@ -103,10 +103,6 @@ public void onPreEngineRestart() { platformViewsController.onPreEngineRestart(); } - - public void onDisplayPlatformView(int viewId, int x, int y, int width, int height) { - platformViewsController.onDisplayPlatformView(viewId, x, y, width, height); - } }; /** diff --git a/shell/platform/android/io/flutter/embedding/engine/FlutterJNI.java b/shell/platform/android/io/flutter/embedding/engine/FlutterJNI.java index c582ff000ecee..c6678ef478ce8 100644 --- a/shell/platform/android/io/flutter/embedding/engine/FlutterJNI.java +++ b/shell/platform/android/io/flutter/embedding/engine/FlutterJNI.java @@ -789,6 +789,17 @@ private void 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); + } + @SuppressWarnings("unused") @UiThread public void onBeginFrame() { diff --git a/shell/platform/android/io/flutter/plugin/platform/PlatformViewsController.java b/shell/platform/android/io/flutter/plugin/platform/PlatformViewsController.java index c9e04dfb6747c..ff5747bd5dcf1 100644 --- a/shell/platform/android/io/flutter/plugin/platform/PlatformViewsController.java +++ b/shell/platform/android/io/flutter/plugin/platform/PlatformViewsController.java @@ -534,6 +534,14 @@ private void flushAllViews() { 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 + } + + public void onDisplayOverlaySurface(int id, int x, int y, int width, int height) { + // TODO: Implement this method. https://github.com/flutter/flutter/issues/58288 + } + public void onBeginFrame() { // TODO: Implement this method. https://github.com/flutter/flutter/issues/58288 } diff --git a/shell/platform/android/platform_view_android_jni.h b/shell/platform/android/platform_view_android_jni.h index ec6e8542f998b..113dfb1414714 100644 --- a/shell/platform/android/platform_view_android_jni.h +++ b/shell/platform/android/platform_view_android_jni.h @@ -42,6 +42,22 @@ void SurfaceTextureAttachToGLContext(JNIEnv* env, jobject obj, jint textureId); void SurfaceTextureUpdateTexImage(JNIEnv* env, jobject obj); +void FlutterViewOnDisplayPlatformView(JNIEnv* env, + jobject obj, + jint view_id, + jint x, + jint y, + jint width, + jint height); + +void FlutterViewDisplayOverlaySurface(JNIEnv* env, + jobject obj, + jint id, + jint x, + jint y, + jint width, + jint height); + void SurfaceTextureGetTransformMatrix(JNIEnv* env, jobject obj, jfloatArray result); diff --git a/shell/platform/android/test/io/flutter/embedding/engine/FlutterJNITest.java b/shell/platform/android/test/io/flutter/embedding/engine/FlutterJNITest.java index 51a5c046b8a5e..cee3e985d4224 100644 --- a/shell/platform/android/test/io/flutter/embedding/engine/FlutterJNITest.java +++ b/shell/platform/android/test/io/flutter/embedding/engine/FlutterJNITest.java @@ -49,6 +49,39 @@ public void onFlutterUiNoLongerDisplayed() {} 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); + } + + @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); + } + @Test public void onBeginFrame__callsPlatformViewsController() { PlatformViewsController platformViewsController = mock(PlatformViewsController.class); From 3777b63a9a4043b37e2574acf3ff108f9d57d148 Mon Sep 17 00:00:00 2001 From: cg021 Date: Wed, 10 Jun 2020 15:52:24 -0500 Subject: [PATCH 3/7] add onDisplayPlatformView for merging --- .../android/io/flutter/embedding/engine/FlutterEngine.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/shell/platform/android/io/flutter/embedding/engine/FlutterEngine.java b/shell/platform/android/io/flutter/embedding/engine/FlutterEngine.java index 3b007172b80ad..71a93c0a04330 100644 --- a/shell/platform/android/io/flutter/embedding/engine/FlutterEngine.java +++ b/shell/platform/android/io/flutter/embedding/engine/FlutterEngine.java @@ -103,6 +103,10 @@ public void onPreEngineRestart() { platformViewsController.onPreEngineRestart(); } + + public void onDisplayPlatformView(int viewId, int x, int y, int width, int height) { + platformViewsController.onDisplayPlatformView(viewId, x, y, width, height); + } }; /** From 07b052096319afe5147e06a48bfd607d8d0abf96 Mon Sep 17 00:00:00 2001 From: cg021 Date: Wed, 10 Jun 2020 21:17:44 -0500 Subject: [PATCH 4/7] license error --- ci/licenses_golden/licenses_flutter | 1 + 1 file changed, 1 insertion(+) diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter index c92af1d5b02b9..f13ea8ef9ffa5 100755 --- a/ci/licenses_golden/licenses_flutter +++ b/ci/licenses_golden/licenses_flutter @@ -789,6 +789,7 @@ FILE: ../../../flutter/shell/platform/android/platform_message_response_android. FILE: ../../../flutter/shell/platform/android/platform_message_response_android.h FILE: ../../../flutter/shell/platform/android/platform_view_android.cc FILE: ../../../flutter/shell/platform/android/platform_view_android.h +FILE: ../../../flutter/shell/platform/android/platform_view_android_jni.h FILE: ../../../flutter/shell/platform/android/platform_view_android_jni_impl.cc FILE: ../../../flutter/shell/platform/android/platform_view_android_jni_impl.h FILE: ../../../flutter/shell/platform/android/robolectric.properties From de1467a07afc3989703dc14629f39d4990c10630 Mon Sep 17 00:00:00 2001 From: cg021 Date: Thu, 11 Jun 2020 16:14:12 -0500 Subject: [PATCH 5/7] migrate to interface --- .../android/jni/platform_view_android_jni.h | 7 +++++ .../android/platform_view_android_jni_impl.cc | 27 +++++++++++++++---- .../android/platform_view_android_jni_impl.h | 3 +++ 3 files changed, 32 insertions(+), 5 deletions(-) diff --git a/shell/platform/android/jni/platform_view_android_jni.h b/shell/platform/android/jni/platform_view_android_jni.h index eed89a1347845..3107d1b06d457 100644 --- a/shell/platform/android/jni/platform_view_android_jni.h +++ b/shell/platform/android/jni/platform_view_android_jni.h @@ -130,6 +130,13 @@ class PlatformViewAndroidJNI { int y, int width, int height) = 0; + //---------------------------------------------------------------------------- + /// @brief Initiates the initialization of a frame if using hybrid + /// composition. + /// + /// @note Must be called from the platform thread. + /// + virtual void FlutterViewBeginFrame() = 0; }; } // namespace flutter diff --git a/shell/platform/android/platform_view_android_jni_impl.cc b/shell/platform/android/platform_view_android_jni_impl.cc index 2c49d1c0298b2..91272b209f2fa 100644 --- a/shell/platform/android/platform_view_android_jni_impl.cc +++ b/shell/platform/android/platform_view_android_jni_impl.cc @@ -79,10 +79,6 @@ static jmethodID g_update_custom_accessibility_actions_method = nullptr; static jmethodID g_on_first_frame_method = nullptr; static jmethodID g_on_engine_restart_method = nullptr; -void FlutterViewOnPreEngineRestart(JNIEnv* env, jobject obj) { - env->CallVoidMethod(obj, g_on_engine_restart_method); - FML_CHECK(CheckException(env)); -} static jmethodID g_on_begin_frame_method = nullptr; void FlutterViewBeginFrame(JNIEnv* env, jobject obj) { @@ -720,8 +716,16 @@ 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_on_begin_frame_method = - env->GetMethodID(g_flutter_jni_class->obj(), "onBeginFrame", "()V"); + env->GetMethodID(g_flutter_jni_class->obj(), "onBeginFrame", "()V"); if (g_on_begin_frame_method == nullptr) { FML_LOG(ERROR) << "Could not locate onBeginFrame method"; @@ -1044,4 +1048,17 @@ void PlatformViewAndroidJNIImpl::FlutterViewDisplayOverlaySurface( FML_CHECK(CheckException(env)); } +void PlatformViewAndroidJNIImpl::FlutterViewBeginFrame() { + JNIEnv* env = fml::jni::AttachCurrentThread(); + + auto java_object = java_object_.get(env); + if (java_object.is_null()) { + return; + } + + env->CallVoidMethod(java_object.obj(), g_on_begin_frame_method); + + FML_CHECK(CheckException(env)); +} + } // namespace flutter diff --git a/shell/platform/android/platform_view_android_jni_impl.h b/shell/platform/android/platform_view_android_jni_impl.h index db0441036b6f1..b0a644b517553 100644 --- a/shell/platform/android/platform_view_android_jni_impl.h +++ b/shell/platform/android/platform_view_android_jni_impl.h @@ -62,6 +62,9 @@ class PlatformViewAndroidJNIImpl final : public PlatformViewAndroidJNI { int width, int height) override; + void FlutterViewBeginFrame() override; + + private: // Reference to FlutterJNI object. const fml::jni::JavaObjectWeakGlobalRef java_object_; From 12f2df5a8d7071e0e5562939c597d674fefeda70 Mon Sep 17 00:00:00 2001 From: cg021 Date: Thu, 11 Jun 2020 16:25:04 -0500 Subject: [PATCH 6/7] revert license --- ci/licenses_golden/licenses_flutter | 34 ++++----- .../android/platform_view_android_jni.h | 73 ------------------- .../android/platform_view_android_jni_impl.cc | 4 - 3 files changed, 14 insertions(+), 97 deletions(-) delete mode 100644 shell/platform/android/platform_view_android_jni.h diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter index f13ea8ef9ffa5..2854e04c45e07 100755 --- a/ci/licenses_golden/licenses_flutter +++ b/ci/licenses_golden/licenses_flutter @@ -28,9 +28,6 @@ FILE: ../../../flutter/flow/compositor_context.cc FILE: ../../../flutter/flow/compositor_context.h FILE: ../../../flutter/flow/embedded_views.cc FILE: ../../../flutter/flow/embedded_views.h -FILE: ../../../flutter/flow/gl_context_switch.cc -FILE: ../../../flutter/flow/gl_context_switch.h -FILE: ../../../flutter/flow/gl_context_switch_unittests.cc FILE: ../../../flutter/flow/instrumentation.cc FILE: ../../../flutter/flow/instrumentation.h FILE: ../../../flutter/flow/layers/backdrop_filter_layer.cc @@ -105,10 +102,6 @@ FILE: ../../../flutter/flow/scene_update_context.h FILE: ../../../flutter/flow/skia_gpu_object.cc FILE: ../../../flutter/flow/skia_gpu_object.h FILE: ../../../flutter/flow/skia_gpu_object_unittests.cc -FILE: ../../../flutter/flow/surface.cc -FILE: ../../../flutter/flow/surface.h -FILE: ../../../flutter/flow/surface_frame.cc -FILE: ../../../flutter/flow/surface_frame.h FILE: ../../../flutter/flow/texture.cc FILE: ../../../flutter/flow/texture.h FILE: ../../../flutter/flow/texture_unittests.cc @@ -461,6 +454,7 @@ FILE: ../../../flutter/lib/web_ui/lib/src/engine/plugins.dart FILE: ../../../flutter/lib/web_ui/lib/src/engine/pointer_binding.dart FILE: ../../../flutter/lib/web_ui/lib/src/engine/pointer_converter.dart FILE: ../../../flutter/lib/web_ui/lib/src/engine/profiler.dart +FILE: ../../../flutter/lib/web_ui/lib/src/engine/render_vertices.dart FILE: ../../../flutter/lib/web_ui/lib/src/engine/rrect_renderer.dart FILE: ../../../flutter/lib/web_ui/lib/src/engine/semantics/accessibility.dart FILE: ../../../flutter/lib/web_ui/lib/src/engine/semantics/checkable.dart @@ -480,7 +474,6 @@ FILE: ../../../flutter/lib/web_ui/lib/src/engine/services/serialization.dart FILE: ../../../flutter/lib/web_ui/lib/src/engine/shader.dart FILE: ../../../flutter/lib/web_ui/lib/src/engine/shadow.dart FILE: ../../../flutter/lib/web_ui/lib/src/engine/surface/backdrop_filter.dart -FILE: ../../../flutter/lib/web_ui/lib/src/engine/surface/canvas.dart FILE: ../../../flutter/lib/web_ui/lib/src/engine/surface/clip.dart FILE: ../../../flutter/lib/web_ui/lib/src/engine/surface/debug_canvas_reuse_overlay.dart FILE: ../../../flutter/lib/web_ui/lib/src/engine/surface/image_filter.dart @@ -492,7 +485,6 @@ FILE: ../../../flutter/lib/web_ui/lib/src/engine/surface/path_metrics.dart FILE: ../../../flutter/lib/web_ui/lib/src/engine/surface/picture.dart FILE: ../../../flutter/lib/web_ui/lib/src/engine/surface/platform_view.dart FILE: ../../../flutter/lib/web_ui/lib/src/engine/surface/recording_canvas.dart -FILE: ../../../flutter/lib/web_ui/lib/src/engine/surface/render_vertices.dart FILE: ../../../flutter/lib/web_ui/lib/src/engine/surface/scene.dart FILE: ../../../flutter/lib/web_ui/lib/src/engine/surface/scene_builder.dart FILE: ../../../flutter/lib/web_ui/lib/src/engine/surface/surface.dart @@ -583,15 +575,20 @@ FILE: ../../../flutter/shell/common/engine.cc FILE: ../../../flutter/shell/common/engine.h FILE: ../../../flutter/shell/common/fixtures/shell_test.dart FILE: ../../../flutter/shell/common/fixtures/shelltest_screenshot.png +FILE: ../../../flutter/shell/common/gl_context_switch.cc +FILE: ../../../flutter/shell/common/gl_context_switch.h +FILE: ../../../flutter/shell/common/gl_context_switch_test.cc +FILE: ../../../flutter/shell/common/gl_context_switch_test.h +FILE: ../../../flutter/shell/common/gl_context_switch_unittests.cc FILE: ../../../flutter/shell/common/input_events_unittests.cc FILE: ../../../flutter/shell/common/isolate_configuration.cc FILE: ../../../flutter/shell/common/isolate_configuration.h -FILE: ../../../flutter/shell/common/layer_tree_holder.cc -FILE: ../../../flutter/shell/common/layer_tree_holder.h -FILE: ../../../flutter/shell/common/layer_tree_holder_unittests.cc FILE: ../../../flutter/shell/common/persistent_cache.cc FILE: ../../../flutter/shell/common/persistent_cache.h FILE: ../../../flutter/shell/common/persistent_cache_unittests.cc +FILE: ../../../flutter/shell/common/pipeline.cc +FILE: ../../../flutter/shell/common/pipeline.h +FILE: ../../../flutter/shell/common/pipeline_unittests.cc FILE: ../../../flutter/shell/common/platform_view.cc FILE: ../../../flutter/shell/common/platform_view.h FILE: ../../../flutter/shell/common/pointer_data_dispatcher.cc @@ -618,6 +615,10 @@ FILE: ../../../flutter/shell/common/shell_test_platform_view_vulkan.h FILE: ../../../flutter/shell/common/shell_unittests.cc FILE: ../../../flutter/shell/common/skia_event_tracer_impl.cc FILE: ../../../flutter/shell/common/skia_event_tracer_impl.h +FILE: ../../../flutter/shell/common/surface.cc +FILE: ../../../flutter/shell/common/surface.h +FILE: ../../../flutter/shell/common/surface_frame.cc +FILE: ../../../flutter/shell/common/surface_frame.h FILE: ../../../flutter/shell/common/switches.cc FILE: ../../../flutter/shell/common/switches.h FILE: ../../../flutter/shell/common/thread_host.cc @@ -782,16 +783,13 @@ FILE: ../../../flutter/shell/platform/android/io/flutter/view/FlutterRunArgument FILE: ../../../flutter/shell/platform/android/io/flutter/view/FlutterView.java FILE: ../../../flutter/shell/platform/android/io/flutter/view/TextureRegistry.java FILE: ../../../flutter/shell/platform/android/io/flutter/view/VsyncWaiter.java -FILE: ../../../flutter/shell/platform/android/jni/platform_view_android_jni.cc -FILE: ../../../flutter/shell/platform/android/jni/platform_view_android_jni.h FILE: ../../../flutter/shell/platform/android/library_loader.cc FILE: ../../../flutter/shell/platform/android/platform_message_response_android.cc FILE: ../../../flutter/shell/platform/android/platform_message_response_android.h FILE: ../../../flutter/shell/platform/android/platform_view_android.cc FILE: ../../../flutter/shell/platform/android/platform_view_android.h +FILE: ../../../flutter/shell/platform/android/platform_view_android_jni.cc FILE: ../../../flutter/shell/platform/android/platform_view_android_jni.h -FILE: ../../../flutter/shell/platform/android/platform_view_android_jni_impl.cc -FILE: ../../../flutter/shell/platform/android/platform_view_android_jni_impl.h FILE: ../../../flutter/shell/platform/android/robolectric.properties FILE: ../../../flutter/shell/platform/android/vsync_waiter_android.cc FILE: ../../../flutter/shell/platform/android/vsync_waiter_android.h @@ -1228,10 +1226,6 @@ FILE: ../../../flutter/shell/platform/linux/fl_method_codec_private.h FILE: ../../../flutter/shell/platform/linux/fl_method_codec_test.cc FILE: ../../../flutter/shell/platform/linux/fl_method_response.cc FILE: ../../../flutter/shell/platform/linux/fl_method_response_test.cc -FILE: ../../../flutter/shell/platform/linux/fl_mouse_cursor_plugin.cc -FILE: ../../../flutter/shell/platform/linux/fl_mouse_cursor_plugin.h -FILE: ../../../flutter/shell/platform/linux/fl_platform_plugin.cc -FILE: ../../../flutter/shell/platform/linux/fl_platform_plugin.h FILE: ../../../flutter/shell/platform/linux/fl_plugin_registrar.cc FILE: ../../../flutter/shell/platform/linux/fl_plugin_registrar_private.h FILE: ../../../flutter/shell/platform/linux/fl_plugin_registry.cc diff --git a/shell/platform/android/platform_view_android_jni.h b/shell/platform/android/platform_view_android_jni.h deleted file mode 100644 index 73819305b7214..0000000000000 --- a/shell/platform/android/platform_view_android_jni.h +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright 2013 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef FLUTTER_SHELL_PLATFORM_ANDROID_PLATFORM_VIEW_ANDROID_JNI_H_ -#define FLUTTER_SHELL_PLATFORM_ANDROID_PLATFORM_VIEW_ANDROID_JNI_H_ - -#include -#include "flutter/fml/macros.h" -#include "flutter/shell/platform/android/platform_view_android.h" - -namespace flutter { - -void FlutterViewHandlePlatformMessage(JNIEnv* env, - jobject obj, - jstring channel, - jobject message, - jint responseId); - -void FlutterViewHandlePlatformMessageResponse(JNIEnv* env, - jobject obj, - jint responseId, - jobject response); - -void FlutterViewUpdateSemantics(JNIEnv* env, - jobject obj, - jobject buffer, - jobjectArray strings); - -void FlutterViewUpdateCustomAccessibilityActions(JNIEnv* env, - jobject obj, - jobject buffer, - jobjectArray strings); - -void FlutterViewOnFirstFrame(JNIEnv* env, jobject obj); - -void FlutterViewOnPreEngineRestart(JNIEnv* env, jobject obj); - -void FlutterViewBeginFrame(JNIEnv* env, jobject obj); - -void SurfaceTextureAttachToGLContext(JNIEnv* env, jobject obj, jint textureId); - -void SurfaceTextureUpdateTexImage(JNIEnv* env, jobject obj); - -void FlutterViewOnDisplayPlatformView(JNIEnv* env, - jobject obj, - jint view_id, - jint x, - jint y, - 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); - -void SurfaceTextureGetTransformMatrix(JNIEnv* env, - jobject obj, - jfloatArray result); - -void SurfaceTextureDetachFromGLContext(JNIEnv* env, jobject obj); - -} // namespace flutter - -#endif // FLUTTER_SHELL_PLATFORM_ANDROID_PLATFORM_VIEW_ANDROID_JNI_H_ diff --git a/shell/platform/android/platform_view_android_jni_impl.cc b/shell/platform/android/platform_view_android_jni_impl.cc index 91272b209f2fa..4d5bc982c703c 100644 --- a/shell/platform/android/platform_view_android_jni_impl.cc +++ b/shell/platform/android/platform_view_android_jni_impl.cc @@ -81,10 +81,6 @@ static jmethodID g_on_first_frame_method = nullptr; static jmethodID g_on_engine_restart_method = nullptr; static jmethodID g_on_begin_frame_method = nullptr; -void FlutterViewBeginFrame(JNIEnv* env, jobject obj) { - env->CallVoidMethod(obj, g_on_begin_frame_method); - FML_CHECK(CheckException(env)); -} static jmethodID g_attach_to_gl_context_method = nullptr; From 127151ecb1a1a7b1c1756062b85c4882444df4a3 Mon Sep 17 00:00:00 2001 From: cg021 Date: Thu, 11 Jun 2020 16:36:02 -0500 Subject: [PATCH 7/7] license --- ci/licenses_golden/licenses_flutter | 36 +++++++++++-------- .../android/jni/platform_view_android_jni.h | 4 +-- .../android/platform_view_android_jni_impl.cc | 2 +- .../android/platform_view_android_jni_impl.h | 1 - 4 files changed, 24 insertions(+), 19 deletions(-) diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter index 2854e04c45e07..2770d2953015b 100755 --- a/ci/licenses_golden/licenses_flutter +++ b/ci/licenses_golden/licenses_flutter @@ -28,6 +28,9 @@ FILE: ../../../flutter/flow/compositor_context.cc FILE: ../../../flutter/flow/compositor_context.h FILE: ../../../flutter/flow/embedded_views.cc FILE: ../../../flutter/flow/embedded_views.h +FILE: ../../../flutter/flow/gl_context_switch.cc +FILE: ../../../flutter/flow/gl_context_switch.h +FILE: ../../../flutter/flow/gl_context_switch_unittests.cc FILE: ../../../flutter/flow/instrumentation.cc FILE: ../../../flutter/flow/instrumentation.h FILE: ../../../flutter/flow/layers/backdrop_filter_layer.cc @@ -102,6 +105,10 @@ FILE: ../../../flutter/flow/scene_update_context.h FILE: ../../../flutter/flow/skia_gpu_object.cc FILE: ../../../flutter/flow/skia_gpu_object.h FILE: ../../../flutter/flow/skia_gpu_object_unittests.cc +FILE: ../../../flutter/flow/surface.cc +FILE: ../../../flutter/flow/surface.h +FILE: ../../../flutter/flow/surface_frame.cc +FILE: ../../../flutter/flow/surface_frame.h FILE: ../../../flutter/flow/texture.cc FILE: ../../../flutter/flow/texture.h FILE: ../../../flutter/flow/texture_unittests.cc @@ -381,6 +388,7 @@ FILE: ../../../flutter/lib/ui/text/paragraph_builder.cc FILE: ../../../flutter/lib/ui/text/paragraph_builder.h FILE: ../../../flutter/lib/ui/text/text_box.h FILE: ../../../flutter/lib/ui/ui.dart +FILE: ../../../flutter/lib/ui/ui_benchmarks.cc FILE: ../../../flutter/lib/ui/ui_dart_state.cc FILE: ../../../flutter/lib/ui/ui_dart_state.h FILE: ../../../flutter/lib/ui/window.dart @@ -454,7 +462,6 @@ FILE: ../../../flutter/lib/web_ui/lib/src/engine/plugins.dart FILE: ../../../flutter/lib/web_ui/lib/src/engine/pointer_binding.dart FILE: ../../../flutter/lib/web_ui/lib/src/engine/pointer_converter.dart FILE: ../../../flutter/lib/web_ui/lib/src/engine/profiler.dart -FILE: ../../../flutter/lib/web_ui/lib/src/engine/render_vertices.dart FILE: ../../../flutter/lib/web_ui/lib/src/engine/rrect_renderer.dart FILE: ../../../flutter/lib/web_ui/lib/src/engine/semantics/accessibility.dart FILE: ../../../flutter/lib/web_ui/lib/src/engine/semantics/checkable.dart @@ -474,6 +481,7 @@ FILE: ../../../flutter/lib/web_ui/lib/src/engine/services/serialization.dart FILE: ../../../flutter/lib/web_ui/lib/src/engine/shader.dart FILE: ../../../flutter/lib/web_ui/lib/src/engine/shadow.dart FILE: ../../../flutter/lib/web_ui/lib/src/engine/surface/backdrop_filter.dart +FILE: ../../../flutter/lib/web_ui/lib/src/engine/surface/canvas.dart FILE: ../../../flutter/lib/web_ui/lib/src/engine/surface/clip.dart FILE: ../../../flutter/lib/web_ui/lib/src/engine/surface/debug_canvas_reuse_overlay.dart FILE: ../../../flutter/lib/web_ui/lib/src/engine/surface/image_filter.dart @@ -485,6 +493,7 @@ FILE: ../../../flutter/lib/web_ui/lib/src/engine/surface/path_metrics.dart FILE: ../../../flutter/lib/web_ui/lib/src/engine/surface/picture.dart FILE: ../../../flutter/lib/web_ui/lib/src/engine/surface/platform_view.dart FILE: ../../../flutter/lib/web_ui/lib/src/engine/surface/recording_canvas.dart +FILE: ../../../flutter/lib/web_ui/lib/src/engine/surface/render_vertices.dart FILE: ../../../flutter/lib/web_ui/lib/src/engine/surface/scene.dart FILE: ../../../flutter/lib/web_ui/lib/src/engine/surface/scene_builder.dart FILE: ../../../flutter/lib/web_ui/lib/src/engine/surface/surface.dart @@ -575,20 +584,15 @@ FILE: ../../../flutter/shell/common/engine.cc FILE: ../../../flutter/shell/common/engine.h FILE: ../../../flutter/shell/common/fixtures/shell_test.dart FILE: ../../../flutter/shell/common/fixtures/shelltest_screenshot.png -FILE: ../../../flutter/shell/common/gl_context_switch.cc -FILE: ../../../flutter/shell/common/gl_context_switch.h -FILE: ../../../flutter/shell/common/gl_context_switch_test.cc -FILE: ../../../flutter/shell/common/gl_context_switch_test.h -FILE: ../../../flutter/shell/common/gl_context_switch_unittests.cc FILE: ../../../flutter/shell/common/input_events_unittests.cc FILE: ../../../flutter/shell/common/isolate_configuration.cc FILE: ../../../flutter/shell/common/isolate_configuration.h +FILE: ../../../flutter/shell/common/layer_tree_holder.cc +FILE: ../../../flutter/shell/common/layer_tree_holder.h +FILE: ../../../flutter/shell/common/layer_tree_holder_unittests.cc FILE: ../../../flutter/shell/common/persistent_cache.cc FILE: ../../../flutter/shell/common/persistent_cache.h FILE: ../../../flutter/shell/common/persistent_cache_unittests.cc -FILE: ../../../flutter/shell/common/pipeline.cc -FILE: ../../../flutter/shell/common/pipeline.h -FILE: ../../../flutter/shell/common/pipeline_unittests.cc FILE: ../../../flutter/shell/common/platform_view.cc FILE: ../../../flutter/shell/common/platform_view.h FILE: ../../../flutter/shell/common/pointer_data_dispatcher.cc @@ -615,10 +619,6 @@ FILE: ../../../flutter/shell/common/shell_test_platform_view_vulkan.h FILE: ../../../flutter/shell/common/shell_unittests.cc FILE: ../../../flutter/shell/common/skia_event_tracer_impl.cc FILE: ../../../flutter/shell/common/skia_event_tracer_impl.h -FILE: ../../../flutter/shell/common/surface.cc -FILE: ../../../flutter/shell/common/surface.h -FILE: ../../../flutter/shell/common/surface_frame.cc -FILE: ../../../flutter/shell/common/surface_frame.h FILE: ../../../flutter/shell/common/switches.cc FILE: ../../../flutter/shell/common/switches.h FILE: ../../../flutter/shell/common/thread_host.cc @@ -783,13 +783,15 @@ FILE: ../../../flutter/shell/platform/android/io/flutter/view/FlutterRunArgument FILE: ../../../flutter/shell/platform/android/io/flutter/view/FlutterView.java FILE: ../../../flutter/shell/platform/android/io/flutter/view/TextureRegistry.java FILE: ../../../flutter/shell/platform/android/io/flutter/view/VsyncWaiter.java +FILE: ../../../flutter/shell/platform/android/jni/platform_view_android_jni.cc +FILE: ../../../flutter/shell/platform/android/jni/platform_view_android_jni.h FILE: ../../../flutter/shell/platform/android/library_loader.cc FILE: ../../../flutter/shell/platform/android/platform_message_response_android.cc FILE: ../../../flutter/shell/platform/android/platform_message_response_android.h FILE: ../../../flutter/shell/platform/android/platform_view_android.cc FILE: ../../../flutter/shell/platform/android/platform_view_android.h -FILE: ../../../flutter/shell/platform/android/platform_view_android_jni.cc -FILE: ../../../flutter/shell/platform/android/platform_view_android_jni.h +FILE: ../../../flutter/shell/platform/android/platform_view_android_jni_impl.cc +FILE: ../../../flutter/shell/platform/android/platform_view_android_jni_impl.h FILE: ../../../flutter/shell/platform/android/robolectric.properties FILE: ../../../flutter/shell/platform/android/vsync_waiter_android.cc FILE: ../../../flutter/shell/platform/android/vsync_waiter_android.h @@ -1226,6 +1228,10 @@ FILE: ../../../flutter/shell/platform/linux/fl_method_codec_private.h FILE: ../../../flutter/shell/platform/linux/fl_method_codec_test.cc FILE: ../../../flutter/shell/platform/linux/fl_method_response.cc FILE: ../../../flutter/shell/platform/linux/fl_method_response_test.cc +FILE: ../../../flutter/shell/platform/linux/fl_mouse_cursor_plugin.cc +FILE: ../../../flutter/shell/platform/linux/fl_mouse_cursor_plugin.h +FILE: ../../../flutter/shell/platform/linux/fl_platform_plugin.cc +FILE: ../../../flutter/shell/platform/linux/fl_platform_plugin.h FILE: ../../../flutter/shell/platform/linux/fl_plugin_registrar.cc FILE: ../../../flutter/shell/platform/linux/fl_plugin_registrar_private.h FILE: ../../../flutter/shell/platform/linux/fl_plugin_registry.cc diff --git a/shell/platform/android/jni/platform_view_android_jni.h b/shell/platform/android/jni/platform_view_android_jni.h index 3107d1b06d457..ff87ee382cb11 100644 --- a/shell/platform/android/jni/platform_view_android_jni.h +++ b/shell/platform/android/jni/platform_view_android_jni.h @@ -131,8 +131,8 @@ class PlatformViewAndroidJNI { int width, int height) = 0; //---------------------------------------------------------------------------- - /// @brief Initiates the initialization of a frame if using hybrid - /// composition. + /// @brief Initiates a frame if using hybrid composition. + /// /// /// @note Must be called from the platform thread. /// diff --git a/shell/platform/android/platform_view_android_jni_impl.cc b/shell/platform/android/platform_view_android_jni_impl.cc index 4d5bc982c703c..331f0350230d0 100644 --- a/shell/platform/android/platform_view_android_jni_impl.cc +++ b/shell/platform/android/platform_view_android_jni_impl.cc @@ -721,7 +721,7 @@ bool PlatformViewAndroid::Register(JNIEnv* env) { } g_on_begin_frame_method = - env->GetMethodID(g_flutter_jni_class->obj(), "onBeginFrame", "()V"); + env->GetMethodID(g_flutter_jni_class->obj(), "onBeginFrame", "()V"); if (g_on_begin_frame_method == nullptr) { FML_LOG(ERROR) << "Could not locate onBeginFrame method"; diff --git a/shell/platform/android/platform_view_android_jni_impl.h b/shell/platform/android/platform_view_android_jni_impl.h index b0a644b517553..2a53e307ca12a 100644 --- a/shell/platform/android/platform_view_android_jni_impl.h +++ b/shell/platform/android/platform_view_android_jni_impl.h @@ -64,7 +64,6 @@ class PlatformViewAndroidJNIImpl final : public PlatformViewAndroidJNI { void FlutterViewBeginFrame() override; - private: // Reference to FlutterJNI object. const fml::jni::JavaObjectWeakGlobalRef java_object_;