33 {
34
36 nullptr;
37
39
41 nullptr;
42
44
47
49
51
53
55
57
58
59
61
63
64#define FLUTTER_FOR_EACH_JNI_METHOD(V) \
65 V(g_handle_platform_message_method, handlePlatformMessage, \
66 "(Ljava/lang/String;Ljava/nio/ByteBuffer;IJ)V") \
67 V(g_handle_platform_message_response_method, handlePlatformMessageResponse, \
68 "(ILjava/nio/ByteBuffer;)V") \
69 V(g_update_semantics_method, updateSemantics, \
70 "(Ljava/nio/ByteBuffer;[Ljava/lang/String;[Ljava/nio/ByteBuffer;)V") \
71 V(g_set_application_locale_method, setApplicationLocale, \
72 "(Ljava/lang/String;)V") \
73 V(g_set_semantics_tree_enabled_method, setSemanticsTreeEnabled, "(Z)V") \
74 V(g_on_display_platform_view_method, onDisplayPlatformView, \
75 "(IIIIIIILio/flutter/embedding/engine/mutatorsstack/" \
76 "FlutterMutatorsStack;)V") \
77 V(g_on_begin_frame_method, onBeginFrame, "()V") \
78 V(g_on_end_frame_method, onEndFrame, "()V") \
79 V(g_on_display_overlay_surface_method, onDisplayOverlaySurface, "(IIIII)V") \
80 V(g_create_transaction_method, createTransaction, \
81 "()Landroid/view/SurfaceControl$Transaction;") \
82 V(g_swap_transaction_method, swapTransactions, "()V") \
83 V(g_apply_transaction_method, applyTransactions, "()V") \
84 V(g_create_overlay_surface2_method, createOverlaySurface2, \
85 "()Lio/flutter/embedding/engine/FlutterOverlaySurface;") \
86 V(g_destroy_overlay_surface2_method, destroyOverlaySurface2, "()V") \
87 V(g_on_display_platform_view2_method, onDisplayPlatformView2, \
88 "(IIIIIIILio/flutter/embedding/engine/mutatorsstack/" \
89 "FlutterMutatorsStack;)V") \
90 V(g_hide_platform_view2_method, hidePlatformView2, "(I)V") \
91 V(g_on_end_frame2_method, endFrame2, "()V") \
92 V(g_show_overlay_surface2_method, showOverlaySurface2, "()V") \
93 V(g_hide_overlay_surface2_method, hideOverlaySurface2, "()V") \
94 V(g_get_scaled_font_size_method, getScaledFontSize, "(FI)F") \
95 V(g_update_custom_accessibility_actions_method, \
96 updateCustomAccessibilityActions, \
97 "(Ljava/nio/ByteBuffer;[Ljava/lang/String;)V") \
98 V(g_on_first_frame_method, onFirstFrame, "()V") \
99 V(g_on_engine_restart_method, onPreEngineRestart, "()V") \
100 V(g_create_overlay_surface_method, createOverlaySurface, \
101 "()Lio/flutter/embedding/engine/FlutterOverlaySurface;") \
102 V(g_destroy_overlay_surfaces_method, destroyOverlaySurfaces, "()V") \
103 V(g_maybe_resize_surface_view, maybeResizeSurfaceView, "(II)V") \
104
105
106#define FLUTTER_DECLARE_JNI(global_field, jni_name, jni_arg) \
107 static jmethodID global_field = nullptr;
108
109#define FLUTTER_BIND_JNI(global_field, jni_name, jni_arg) \
110 global_field = \
111 env->GetMethodID(g_flutter_jni_class->obj(), #jni_name, jni_arg); \
112 if (global_field == nullptr) { \
113 FML_LOG(ERROR) << "Could not locate " << #jni_name << " method."; \
114 return false; \
115 }
116
118
120
122
124
126
128
130
132
134
136
138
140
142
144
146
147
148
150
152
154
156
158
159
167
168
178
182
183
184static jlong
AttachJNI(JNIEnv* env, jclass clazz, jobject flutterJNI) {
186 std::shared_ptr<PlatformViewAndroidJNI> jni_facade =
187 std::make_shared<PlatformViewAndroidJNIImpl>(java_object);
188 auto shell_holder = std::make_unique<AndroidShellHolder>(
189 FlutterMain::Get().GetSettings(), jni_facade,
190 FlutterMain::Get().GetAndroidRenderingAPI());
191 if (shell_holder->IsValid()) {
192 return reinterpret_cast<jlong>(shell_holder.release());
193 } else {
194 return 0;
195 }
196}
197
198static void DestroyJNI(JNIEnv* env, jobject jcaller, jlong shell_holder) {
200}
201
202
203
204
205
206
207
208
209
210
211
213 jobject jcaller,
214 jlong shell_holder,
215 jstring jEntrypoint,
216 jstring jLibraryUrl,
217 jstring jInitialRoute,
218 jobject jEntrypointArgs,
219 jlong engineId) {
221 if (jni == nullptr) {
222 FML_LOG(ERROR) <<
"Could not create a FlutterJNI instance";
223 return nullptr;
224 }
225
227 std::shared_ptr<PlatformViewAndroidJNI> jni_facade =
228 std::make_shared<PlatformViewAndroidJNIImpl>(java_jni);
229
234
235 auto spawned_shell_holder =
237 initial_route, entrypoint_args, engineId);
238
239 if (spawned_shell_holder == nullptr || !spawned_shell_holder->IsValid()) {
240 FML_LOG(ERROR) <<
"Could not spawn Shell";
241 return nullptr;
242 }
243
244 jobject javaLong = env->CallStaticObjectMethod(
246 reinterpret_cast<jlong>(spawned_shell_holder.release()));
247 if (javaLong == nullptr) {
248 FML_LOG(ERROR) <<
"Could not create a Long instance";
249 return nullptr;
250 }
251
252 env->SetObjectField(jni, g_jni_shell_holder_field, javaLong);
253
254 return jni;
255}
256
258 jobject jcaller,
259 jlong shell_holder,
260 jobject jsurface) {
261
262
263
265 auto window = fml::MakeRefCounted<AndroidNativeWindow>(
266 ANativeWindow_fromSurface(env, jsurface));
268}
269
271 jobject jcaller,
272 jlong shell_holder,
273 jobject jsurface) {
274
275
276
278 auto window = fml::MakeRefCounted<AndroidNativeWindow>(
279 ANativeWindow_fromSurface(env, jsurface));
282}
283
285 jobject jcaller,
286 jlong shell_holder,
291}
292
293static void SurfaceDestroyed(JNIEnv* env, jobject jcaller, jlong shell_holder) {
295}
296
298 jobject jcaller,
299 jlong shell_holder,
300 jstring jBundlePath,
301 jstring jEntrypoint,
302 jstring jLibraryUrl,
303 jobject jAssetManager,
304 jobject jEntrypointArgs,
305 jlong engineId) {
306 auto apk_asset_provider = std::make_unique<flutter::APKAssetProvider>(
307 env,
308 jAssetManager,
310 );
314
316 libraryUrl, entrypoint_args, engineId);
317}
318
320 jobject,
321 jlong handle) {
323 if (cbInfo == nullptr) {
324 return nullptr;
325 }
327 g_flutter_callback_info_constructor,
328 env->NewStringUTF(cbInfo->name.c_str()),
329 env->NewStringUTF(cbInfo->class_name.c_str()),
330 env->NewStringUTF(cbInfo->library_path.c_str()));
331}
332
334 jobject jcaller,
335 jlong shell_holder,
336 jfloat devicePixelRatio,
337 jint physicalWidth,
338 jint physicalHeight,
339 jint physicalPaddingTop,
340 jint physicalPaddingRight,
341 jint physicalPaddingBottom,
342 jint physicalPaddingLeft,
343 jint physicalViewInsetTop,
344 jint physicalViewInsetRight,
345 jint physicalViewInsetBottom,
346 jint physicalViewInsetLeft,
347 jint systemGestureInsetTop,
348 jint systemGestureInsetRight,
349 jint systemGestureInsetBottom,
350 jint systemGestureInsetLeft,
351 jint physicalTouchSlop,
352 jintArray javaDisplayFeaturesBounds,
353 jintArray javaDisplayFeaturesType,
354 jintArray javaDisplayFeaturesState,
355 jint physicalMinWidth,
356 jint physicalMaxWidth,
357 jint physicalMinHeight,
358 jint physicalMaxHeight,
359 jint physicalDisplayCornerRadiusTopLeft,
360 jint physicalDisplayCornerRadiusTopRight,
361 jint physicalDisplayCornerRadiusBottomRight,
362 jint physicalDisplayCornerRadiusBottomLeft) {
363
364
365 jsize rectSize = env->GetArrayLength(javaDisplayFeaturesBounds);
366 std::vector<int> boundsIntVector(rectSize);
367 if (rectSize > 0) {
368 env->GetIntArrayRegion(javaDisplayFeaturesBounds, 0, rectSize,
369 &boundsIntVector[0]);
370 }
371 std::vector<double> displayFeaturesBounds(boundsIntVector.begin(),
372 boundsIntVector.end());
373 jsize typeSize = env->GetArrayLength(javaDisplayFeaturesType);
374 std::vector<int> displayFeaturesType(typeSize);
375 if (typeSize > 0) {
376 env->GetIntArrayRegion(javaDisplayFeaturesType, 0, typeSize,
377 &displayFeaturesType[0]);
378 }
379
380 jsize stateSize = env->GetArrayLength(javaDisplayFeaturesState);
381 std::vector<int> displayFeaturesState(stateSize);
382 if (stateSize > 0) {
383 env->GetIntArrayRegion(javaDisplayFeaturesState, 0, stateSize,
384 &displayFeaturesState[0]);
385 }
386
388 static_cast<double>(devicePixelRatio),
389 static_cast<double>(physicalWidth),
390 static_cast<double>(physicalHeight),
391 static_cast<double>(physicalMinWidth),
392 static_cast<double>(physicalMaxWidth),
393 static_cast<double>(
394 physicalMinHeight),
395 static_cast<double>(
396 physicalMaxHeight),
397 static_cast<double>(physicalPaddingTop),
398 static_cast<double>(physicalPaddingRight),
399 static_cast<double>(physicalPaddingBottom),
400 static_cast<double>(physicalPaddingLeft),
401 static_cast<double>(physicalViewInsetTop),
402 static_cast<double>(
403 physicalViewInsetRight),
404 static_cast<double>(
405 physicalViewInsetBottom),
406 static_cast<double>(physicalViewInsetLeft),
407 static_cast<double>(
408 systemGestureInsetTop),
409 static_cast<double>(
410 systemGestureInsetRight),
411 static_cast<double>(
412 systemGestureInsetBottom),
413 static_cast<double>(
414 systemGestureInsetLeft),
415 static_cast<double>(physicalTouchSlop),
416 displayFeaturesBounds,
417 displayFeaturesType,
418 displayFeaturesState,
419 0,
420 static_cast<double>(
421 physicalDisplayCornerRadiusTopLeft),
422 static_cast<double>(
423 physicalDisplayCornerRadiusTopRight),
424 static_cast<double>(
425 physicalDisplayCornerRadiusBottomRight),
426 static_cast<double>(
427 physicalDisplayCornerRadiusBottomLeft),
428 };
429
431 kFlutterImplicitViewId, metrics);
432}
433
435 jobject jcaller,
436 jlong shell_holder) {
438}
439
441 jobject jcaller,
442 jlong shell_holder) {
444}
445
446static jobject
GetBitmap(JNIEnv* env, jobject jcaller, jlong shell_holder) {
448 Rasterizer::ScreenshotType::UncompressedImage, false);
449 if (screenshot.data == nullptr) {
450 return nullptr;
451 }
452
453 jstring argb = env->NewStringUTF("ARGB_8888");
454 if (argb == nullptr) {
455 return nullptr;
456 }
457
458 jobject bitmap_config = env->CallStaticObjectMethod(
460 if (bitmap_config == nullptr) {
461 return nullptr;
462 }
463
464 auto bitmap = env->CallStaticObjectMethod(
466 screenshot.frame_size.width, screenshot.frame_size.height, bitmap_config);
467
469 env,
470 env->NewDirectByteBuffer(const_cast<uint8_t*>(screenshot.data->bytes()),
471 screenshot.data->size()));
472
473 env->CallVoidMethod(
bitmap, g_bitmap_copy_pixels_from_buffer_method,
475
477}
478
480 jobject jcaller,
481 jlong shell_holder,
484 jint position,
485 jint responseId) {
487 env,
490 position,
491 responseId
492 );
493}
494
496 jobject jcaller,
497 jlong shell_holder,
499 jint responseId) {
501 env,
503 responseId
504 );
505}
506
508 jobject jcaller,
509 jlong message_data) {
510
511 free(reinterpret_cast<void*>(message_data));
512}
513
515 jobject jcaller,
516 jlong shell_holder,
517 jobject buffer,
518 jint position) {
519 uint8_t*
data =
static_cast<uint8_t*
>(env->GetDirectBufferAddress(buffer));
520 auto packet = std::make_unique<flutter::PointerDataPacket>(data, position);
522 std::move(packet));
523}
524
526 jobject jcaller,
527 jlong shell_holder,
528 jint id,
531 jint args_position) {
533 env,
534 id,
537 args_position
538 );
539}
540
542 jobject jcaller,
543 jlong shell_holder,
544 jboolean enabled) {
546}
547
549 jobject jcaller,
550 jlong shell_holder,
551 jint flags) {
553}
554
556 return FlutterMain::Get().GetSettings().enable_software_rendering;
557}
558
560 jobject jcaller,
561 jlong shell_holder,
563 jobject surface_texture) {
567 );
568}
569
571 jobject jcaller,
572 jlong shell_holder,
574 jobject image_texture_entry,
575 jboolean reset_on_background) {
576 ImageExternalTexture::ImageLifecycle lifecycle =
577 reset_on_background ? ImageExternalTexture::ImageLifecycle::kReset
578 : ImageExternalTexture::ImageLifecycle::kKeepAlive;
579
583 lifecycle
584 );
585}
586
588 jobject jcaller,
589 jlong shell_holder,
593}
594
596 jobject jcaller,
597 jlong shell_holder,
601}
602
603static void ScheduleFrame(JNIEnv* env, jobject jcaller, jlong shell_holder) {
605}
606
608 jobject jcaller,
609 jlong shell_holder,
610 jint responseId,
612 jint position) {
613 uint8_t* response_data =
614 static_cast<uint8_t*
>(env->GetDirectBufferAddress(
message));
616 auto mapping = std::make_unique<fml::MallocMapping>(
619 ->InvokePlatformMessageResponseCallback(responseId, std::move(mapping));
620}
621
623 jobject jcaller,
624 jlong shell_holder,
625 jint responseId) {
627 ->InvokePlatformMessageEmptyResponseCallback(responseId);
628}
629
631 jobject obj,
632 jlong shell_holder) {
634}
635
637 jobject obj,
638 jint codePoint) {
639 return u_hasBinaryProperty(codePoint, UProperty::UCHAR_EMOJI);
640}
641
643 jobject obj,
644 jint codePoint) {
645 return u_hasBinaryProperty(codePoint, UProperty::UCHAR_EMOJI_MODIFIER);
646}
647
649 jobject obj,
650 jint codePoint) {
651 return u_hasBinaryProperty(codePoint, UProperty::UCHAR_EMOJI_MODIFIER_BASE);
652}
653
655 jobject obj,
656 jint codePoint) {
657 return u_hasBinaryProperty(codePoint, UProperty::UCHAR_VARIATION_SELECTOR);
658}
659
661 jobject obj,
662 jint codePoint) {
663 return u_hasBinaryProperty(codePoint, UProperty::UCHAR_REGIONAL_INDICATOR);
664}
665
668 bool transient) {
669
670}
671
673 jobject obj,
674 jint jLoadingUnitId,
675 jstring jError,
676 jboolean jTransient) {
679 static_cast<bool>(jTransient));
680}
681
683 jobject obj,
684 jlong shell_holder,
685 jint jLoadingUnitId,
686 jobjectArray jSearchPaths) {
687
688 intptr_t loading_unit_id = static_cast<intptr_t>(jLoadingUnitId);
689 std::vector<std::string> search_paths =
691
692
693
694 void* handle = nullptr;
695 while (handle == nullptr && !search_paths.empty()) {
696 std::string
path = search_paths.back();
697 handle = ::dlopen(
path.c_str(), RTLD_NOW);
698 search_paths.pop_back();
699 }
700 if (handle == nullptr) {
702 "No lib .so found for provided search paths.", true);
703 return;
704 }
707
708
709 std::unique_ptr<const fml::SymbolMapping> data_mapping =
710 std::make_unique<const fml::SymbolMapping>(
711 native_lib, DartSnapshot::kIsolateDataSymbol);
712 std::unique_ptr<const fml::SymbolMapping> instructions_mapping =
713 std::make_unique<const fml::SymbolMapping>(
714 native_lib, DartSnapshot::kIsolateInstructionsSymbol);
715
717 loading_unit_id, std::move(data_mapping),
718 std::move(instructions_mapping));
719}
720
722 jobject obj,
723 jlong shell_holder,
724 jobject jAssetManager,
725 jstring jAssetBundlePath) {
726 auto asset_resolver = std::make_unique<flutter::APKAssetProvider>(
727 env,
728 jAssetManager,
730
732 std::move(asset_resolver),
733 AssetResolver::AssetResolverType::kApkAssetProvider);
734}
735
737 static const JNINativeMethod flutter_jni_methods[] = {
738
739 {
740 .name = "nativeAttach",
741 .signature = "(Lio/flutter/embedding/engine/FlutterJNI;)J",
742 .fnPtr =
reinterpret_cast<void*
>(&
AttachJNI),
743 },
744 {
745 .name = "nativeDestroy",
746 .signature = "(J)V",
747 .fnPtr =
reinterpret_cast<void*
>(&
DestroyJNI),
748 },
749 {
750 .name = "nativeSpawn",
751 .signature = "(JLjava/lang/String;Ljava/lang/String;Ljava/lang/"
752 "String;Ljava/util/List;J)Lio/flutter/"
753 "embedding/engine/FlutterJNI;",
754 .fnPtr =
reinterpret_cast<void*
>(&
SpawnJNI),
755 },
756 {
757 .name = "nativeRunBundleAndSnapshotFromLibrary",
758 .signature = "(JLjava/lang/String;Ljava/lang/String;"
759 "Ljava/lang/String;Landroid/content/res/"
760 "AssetManager;Ljava/util/List;J)V",
762 },
763 {
764 .name = "nativeDispatchEmptyPlatformMessage",
765 .signature = "(JLjava/lang/String;I)V",
767 },
768 {
769 .name = "nativeCleanupMessageData",
770 .signature = "(J)V",
772 },
773 {
774 .name = "nativeDispatchPlatformMessage",
775 .signature = "(JLjava/lang/String;Ljava/nio/ByteBuffer;II)V",
777 },
778 {
779 .name = "nativeInvokePlatformMessageResponseCallback",
780 .signature = "(JILjava/nio/ByteBuffer;I)V",
781 .fnPtr =
783 },
784 {
785 .name = "nativeInvokePlatformMessageEmptyResponseCallback",
786 .signature = "(JI)V",
787 .fnPtr = reinterpret_cast<void*>(
789 },
790 {
791 .name = "nativeNotifyLowMemoryWarning",
792 .signature = "(J)V",
794 },
795
796
797 {
798 .name = "nativeGetBitmap",
799 .signature = "(J)Landroid/graphics/Bitmap;",
800 .fnPtr =
reinterpret_cast<void*
>(&
GetBitmap),
801 },
802 {
803 .name = "nativeSurfaceCreated",
804 .signature = "(JLandroid/view/Surface;)V",
806 },
807 {
808 .name = "nativeSurfaceWindowChanged",
809 .signature = "(JLandroid/view/Surface;)V",
811 },
812 {
813 .name = "nativeSurfaceChanged",
814 .signature = "(JII)V",
816 },
817 {
818 .name = "nativeSurfaceDestroyed",
819 .signature = "(J)V",
821 },
822 {
823 .name = "nativeSetViewportMetrics",
824 .signature = "(JFIIIIIIIIIIIIIII[I[I[IIIIIIIII)V",
826 },
827 {
828 .name = "nativeDispatchPointerDataPacket",
829 .signature = "(JLjava/nio/ByteBuffer;I)V",
831 },
832 {
833 .name = "nativeDispatchSemanticsAction",
834 .signature = "(JIILjava/nio/ByteBuffer;I)V",
836 },
837 {
838 .name = "nativeSetSemanticsEnabled",
839 .signature = "(JZ)V",
841 },
842 {
843 .name = "nativeSetAccessibilityFeatures",
844 .signature = "(JI)V",
846 },
847 {
848 .name = "nativeGetIsSoftwareRenderingEnabled",
849 .signature = "()Z",
851 },
852 {
853 .name = "nativeRegisterTexture",
854 .signature = "(JJLjava/lang/ref/"
855 "WeakReference;)V",
857 },
858 {
859 .name = "nativeRegisterImageTexture",
860 .signature = "(JJLjava/lang/ref/"
861 "WeakReference;Z)V",
863 },
864 {
865 .name = "nativeMarkTextureFrameAvailable",
866 .signature = "(JJ)V",
868 },
869 {
870 .name = "nativeScheduleFrame",
871 .signature = "(J)V",
873 },
874 {
875 .name = "nativeUnregisterTexture",
876 .signature = "(JJ)V",
878 },
879
880 {
881 .name = "nativeLookupCallbackInformation",
882 .signature = "(J)Lio/flutter/view/FlutterCallbackInformation;",
884 },
885
886
887 {
888 .name = "nativeFlutterTextUtilsIsEmoji",
889 .signature = "(I)Z",
891 },
892 {
893 .name = "nativeFlutterTextUtilsIsEmojiModifier",
894 .signature = "(I)Z",
896 },
897 {
898 .name = "nativeFlutterTextUtilsIsEmojiModifierBase",
899 .signature = "(I)Z",
900 .fnPtr =
902 },
903 {
904 .name = "nativeFlutterTextUtilsIsVariationSelector",
905 .signature = "(I)Z",
906 .fnPtr =
908 },
909 {
910 .name = "nativeFlutterTextUtilsIsRegionalIndicator",
911 .signature = "(I)Z",
912 .fnPtr =
914 },
915 {
916 .name = "nativeLoadDartDeferredLibrary",
917 .signature = "(JI[Ljava/lang/String;)V",
919 },
920 {
921 .name = "nativeUpdateJavaAssetManager",
922 .signature =
923 "(JLandroid/content/res/AssetManager;Ljava/lang/String;)V",
925 },
926 {
927 .name = "nativeDeferredComponentInstallFailure",
928 .signature = "(ILjava/lang/String;Z)V",
930 },
931 {
932 .name = "nativeUpdateDisplayMetrics",
933 .signature = "(J)V",
935 },
936 {
937 .name = "nativeIsSurfaceControlEnabled",
938 .signature = "(J)Z",
940 }};
941
943 std::size(flutter_jni_methods)) != 0) {
944 FML_LOG(ERROR) <<
"Failed to RegisterNatives with FlutterJNI";
945 return false;
946 }
947
950
951 if (g_jni_shell_holder_field == nullptr) {
952 FML_LOG(ERROR) <<
"Could not locate FlutterJNI's nativeShellHolderId field";
953 return false;
954 }
955
958
959 if (g_jni_constructor == nullptr) {
960 FML_LOG(ERROR) <<
"Could not locate FlutterJNI's constructor";
961 return false;
962 }
963
965 "valueOf", "(J)Ljava/lang/Long;");
966 if (g_long_constructor == nullptr) {
967 FML_LOG(ERROR) <<
"Could not locate Long's constructor";
968 return false;
969 }
970
972
974 env, env->FindClass("io/flutter/embedding/engine/FlutterOverlaySurface"));
975 if (overlay_surface_class.is_null()) {
976 FML_LOG(ERROR) <<
"Could not locate FlutterOverlaySurface class";
977 return false;
978 }
980 env->GetMethodID(overlay_surface_class.obj(), "getId", "()I");
981 if (g_overlay_surface_id_method == nullptr) {
982 FML_LOG(ERROR) <<
"Could not locate FlutterOverlaySurface#getId() method";
983 return false;
984 }
986 overlay_surface_class.obj(), "getSurface", "()Landroid/view/Surface;");
987 if (g_overlay_surface_surface_method == nullptr) {
989 << "Could not locate FlutterOverlaySurface#getSurface() method";
990 return false;
991 }
992
994 env, env->FindClass("android/graphics/Bitmap"));
996 FML_LOG(ERROR) <<
"Could not locate Bitmap Class";
997 return false;
998 }
999
1002 "(IILandroid/graphics/Bitmap$Config;)Landroid/graphics/Bitmap;");
1003 if (g_bitmap_create_bitmap_method == nullptr) {
1004 FML_LOG(ERROR) <<
"Could not locate Bitmap.createBitmap method";
1005 return false;
1006 }
1007
1009 g_bitmap_class->obj(),
"copyPixelsFromBuffer",
"(Ljava/nio/Buffer;)V");
1010 if (g_bitmap_copy_pixels_from_buffer_method == nullptr) {
1011 FML_LOG(ERROR) <<
"Could not locate Bitmap.copyPixelsFromBuffer method";
1012 return false;
1013 }
1014
1016 env, env->FindClass("android/graphics/Bitmap$Config"));
1018 FML_LOG(ERROR) <<
"Could not locate Bitmap.Config Class";
1019 return false;
1020 }
1021
1024 "(Ljava/lang/String;)Landroid/graphics/Bitmap$Config;");
1025 if (g_bitmap_config_value_of == nullptr) {
1026 FML_LOG(ERROR) <<
"Could not locate Bitmap.Config.valueOf method";
1027 return false;
1028 }
1029
1030 return true;
1031}
1032
1033bool PlatformViewAndroid::Register(JNIEnv* env) {
1034 if (env == nullptr) {
1035 FML_LOG(ERROR) <<
"No JNIEnv provided";
1036 return false;
1037 }
1038
1040 env, env->FindClass("io/flutter/view/FlutterCallbackInformation"));
1042 FML_LOG(ERROR) <<
"Could not locate FlutterCallbackInformation class";
1043 return false;
1044 }
1045
1048 "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V");
1049 if (g_flutter_callback_info_constructor == nullptr) {
1050 FML_LOG(ERROR) <<
"Could not locate FlutterCallbackInformation constructor";
1051 return false;
1052 }
1053
1055 env, env->FindClass("io/flutter/embedding/engine/FlutterJNI"));
1057 FML_LOG(ERROR) <<
"Failed to find FlutterJNI Class.";
1058 return false;
1059 }
1060
1062 env,
1063 env->FindClass(
1064 "io/flutter/embedding/engine/mutatorsstack/FlutterMutatorsStack"));
1065 if (g_mutators_stack_class == nullptr) {
1066 FML_LOG(ERROR) <<
"Could not locate FlutterMutatorsStack";
1067 return false;
1068 }
1069
1072 if (g_mutators_stack_init_method == nullptr) {
1073 FML_LOG(ERROR) <<
"Could not locate FlutterMutatorsStack.init method";
1074 return false;
1075 }
1076
1079 if (g_mutators_stack_push_transform_method == nullptr) {
1081 << "Could not locate FlutterMutatorsStack.pushTransform method";
1082 return false;
1083 }
1084
1087 if (g_mutators_stack_push_cliprect_method == nullptr) {
1089 << "Could not locate FlutterMutatorsStack.pushClipRect method";
1090 return false;
1091 }
1092
1095 if (g_mutators_stack_push_cliprrect_method == nullptr) {
1097 << "Could not locate FlutterMutatorsStack.pushClipRRect method";
1098 return false;
1099 }
1100
1103 if (g_mutators_stack_push_opacity_method == nullptr) {
1105 << "Could not locate FlutterMutatorsStack.pushOpacity method";
1106 return false;
1107 }
1108
1111 "(Landroid/graphics/Path;)V");
1112 if (g_mutators_stack_push_clippath_method == nullptr) {
1114 << "Could not locate FlutterMutatorsStack.pushClipPath method";
1115 return false;
1116 }
1117
1119 env, env->FindClass("java/lang/ref/WeakReference"));
1121 FML_LOG(ERROR) <<
"Could not locate WeakReference class";
1122 return false;
1123 }
1124
1127 if (g_java_weak_reference_get_method == nullptr) {
1128 FML_LOG(ERROR) <<
"Could not locate WeakReference.get method";
1129 return false;
1130 }
1131
1133 env, env->FindClass(
1134 "io/flutter/embedding/engine/renderer/SurfaceTextureWrapper"));
1136 FML_LOG(ERROR) <<
"Could not locate SurfaceTextureWrapper class";
1137 return false;
1138 }
1139
1142
1143 if (g_attach_to_gl_context_method == nullptr) {
1144 FML_LOG(ERROR) <<
"Could not locate attachToGlContext method";
1145 return false;
1146 }
1147
1150
1151 if (g_surface_texture_wrapper_should_update == nullptr) {
1153 << "Could not locate SurfaceTextureWrapper.shouldUpdate method";
1154 return false;
1155 }
1156
1159
1160 if (g_update_tex_image_method == nullptr) {
1161 FML_LOG(ERROR) <<
"Could not locate updateTexImage method";
1162 return false;
1163 }
1164
1167
1168 if (g_get_transform_matrix_method == nullptr) {
1169 FML_LOG(ERROR) <<
"Could not locate getTransformMatrix method";
1170 return false;
1171 }
1172
1175
1176 if (g_detach_from_gl_context_method == nullptr) {
1177 FML_LOG(ERROR) <<
"Could not locate detachFromGlContext method";
1178 return false;
1179 }
1182 env, env->FindClass("io/flutter/view/TextureRegistry$ImageConsumer"));
1184 FML_LOG(ERROR) <<
"Could not locate TextureRegistry.ImageConsumer class";
1185 return false;
1186 }
1187
1190 "acquireLatestImage", "()Landroid/media/Image;");
1191 if (g_acquire_latest_image_method == nullptr) {
1192 FML_LOG(ERROR) <<
"Could not locate acquireLatestImage on "
1193 "TextureRegistry.ImageConsumer class";
1194 return false;
1195 }
1196
1198 env, env->FindClass("android/media/Image"));
1200 FML_LOG(ERROR) <<
"Could not locate Image class";
1201 return false;
1202 }
1203
1204
1206
1209 "()Landroid/hardware/HardwareBuffer;");
1210
1211 if (g_image_get_hardware_buffer_method == nullptr) {
1212
1214 }
1215
1217
1218 if (g_image_close_method == nullptr) {
1219 FML_LOG(ERROR) <<
"Could not locate close on Image class";
1220 return false;
1221 }
1222
1223
1226 env, env->FindClass("android/hardware/HardwareBuffer"));
1227
1231 if (g_hardware_buffer_close_method == nullptr) {
1232
1234 }
1235 } else {
1236
1238 }
1239
1242 "([Ljava/lang/String;)[Ljava/lang/String;");
1243
1244 if (g_compute_platform_resolved_locale_method == nullptr) {
1245 FML_LOG(ERROR) <<
"Could not locate computePlatformResolvedLocale method";
1246 return false;
1247 }
1248
1251
1252 if (g_request_dart_deferred_library_method == nullptr) {
1253 FML_LOG(ERROR) <<
"Could not locate requestDartDeferredLibrary method";
1254 return false;
1255 }
1256
1258 env, env->FindClass("java/lang/Long"));
1260 FML_LOG(ERROR) <<
"Could not locate java.lang.Long class";
1261 return false;
1262 }
1263
1264
1266 env, env->FindClass("android/graphics/Path"));
1268 FML_LOG(ERROR) <<
"Could not locate android.graphics.Path class";
1269 return false;
1270 }
1271
1273 if (path_constructor == nullptr) {
1274 FML_LOG(ERROR) <<
"Could not locate android.graphics.Path constructor";
1275 return false;
1276 }
1277
1279 path_class->obj(),
"setFillType",
"(Landroid/graphics/Path$FillType;)V");
1280 if (path_set_fill_type_method == nullptr) {
1282 << "Could not locate android.graphics.Path.setFillType method";
1283 return false;
1284 }
1285
1287 if (path_move_to_method == nullptr) {
1288 FML_LOG(ERROR) <<
"Could not locate android.graphics.Path.moveTo method";
1289 return false;
1290 }
1292 if (path_line_to_method == nullptr) {
1293 FML_LOG(ERROR) <<
"Could not locate android.graphics.Path.lineTo method";
1294 return false;
1295 }
1297 env->GetMethodID(
path_class->obj(),
"quadTo",
"(FFFF)V");
1298 if (path_quad_to_method == nullptr) {
1299 FML_LOG(ERROR) <<
"Could not locate android.graphics.Path.quadTo method";
1300 return false;
1301 }
1303 env->GetMethodID(
path_class->obj(),
"cubicTo",
"(FFFFFF)V");
1304 if (path_cubic_to_method == nullptr) {
1305 FML_LOG(ERROR) <<
"Could not locate android.graphics.Path.cubicTo method";
1306 return false;
1307 }
1308
1310
1312 env->GetMethodID(
path_class->obj(),
"conicTo",
"(FFFFF)V");
1313 if (path_conic_to_method == nullptr) {
1314
1316 }
1318 if (path_close_method == nullptr) {
1319 FML_LOG(ERROR) <<
"Could not locate android.graphics.Path.close method";
1320 return false;
1321 }
1322
1324 env, env->FindClass("android/graphics/Path$FillType"));
1326 FML_LOG(ERROR) <<
"Could not locate android.graphics.Path$FillType class";
1327 return false;
1328 }
1329
1332 "Landroid/graphics/Path$FillType;");
1333 if (g_path_fill_type_winding_field == nullptr) {
1334 FML_LOG(ERROR) <<
"Could not locate Path.FillType.WINDING field";
1335 return false;
1336 }
1337
1340 "Landroid/graphics/Path$FillType;");
1341 if (g_path_fill_type_even_odd_field == nullptr) {
1342 FML_LOG(ERROR) <<
"Could not locate Path.FillType.EVEN_ODD field";
1343 return false;
1344 }
1345
1347}
1348
1349PlatformViewAndroidJNIImpl::PlatformViewAndroidJNIImpl(
1351 : java_object_(java_object) {}
1352
1353PlatformViewAndroidJNIImpl::~PlatformViewAndroidJNIImpl() = default;
1354
1355void PlatformViewAndroidJNIImpl::FlutterViewHandlePlatformMessage(
1356 std::unique_ptr<flutter::PlatformMessage>
message,
1357 int responseId) {
1358
1360
1361 auto java_object = java_object_.get(env);
1362 if (java_object.is_null()) {
1363 return;
1364 }
1365
1368
1371 env, env->NewDirectByteBuffer(
1372 const_cast<uint8_t*
>(
message->data().GetMapping()),
1374
1376 env->CallVoidMethod(java_object.obj(), g_handle_platform_message_method,
1377 java_channel.
obj(), message_array.obj(), responseId,
1378 reinterpret_cast<jlong
>(mapping.
Release()));
1379 } else {
1380 env->CallVoidMethod(java_object.obj(), g_handle_platform_message_method,
1381 java_channel.
obj(),
nullptr, responseId,
nullptr);
1382 }
1383
1385}
1386
1387void PlatformViewAndroidJNIImpl::FlutterViewSetApplicationLocale(
1388 std::string locale) {
1390
1391 auto java_object = java_object_.get(env);
1392 if (java_object.is_null()) {
1393 return;
1394 }
1395
1398
1399 env->CallVoidMethod(java_object.obj(), g_set_application_locale_method,
1401
1403}
1404
1405void PlatformViewAndroidJNIImpl::FlutterViewSetSemanticsTreeEnabled(
1406 bool enabled) {
1408
1409 auto java_object = java_object_.get(env);
1410 if (java_object.is_null()) {
1411 return;
1412 }
1413
1414 env->CallVoidMethod(java_object.obj(), g_set_semantics_tree_enabled_method,
1415 enabled);
1416
1418}
1419
1420void PlatformViewAndroidJNIImpl::FlutterViewHandlePlatformMessageResponse(
1421 int responseId,
1422 std::unique_ptr<fml::Mapping> data) {
1423
1424
1426
1427 auto java_object = java_object_.get(env);
1428 if (java_object.is_null()) {
1429
1430
1431 return;
1432 }
1433 if (data == nullptr) {
1434 env->CallVoidMethod(java_object.obj(),
1435 g_handle_platform_message_response_method, responseId,
1436 nullptr);
1437 } else {
1438
1440 env, env->NewDirectByteBuffer(
const_cast<uint8_t*
>(
data->GetMapping()),
1442
1443 env->CallVoidMethod(java_object.obj(),
1444 g_handle_platform_message_response_method, responseId,
1445 data_array.obj());
1446 }
1447
1449}
1450
1451double PlatformViewAndroidJNIImpl::FlutterViewGetScaledFontSize(
1453 int configuration_id) const {
1455
1456 auto java_object = java_object_.get(env);
1457 if (java_object.is_null()) {
1458 return -3;
1459 }
1460
1461 const jfloat scaledSize = env->CallFloatMethod(
1462 java_object.obj(), g_get_scaled_font_size_method,
1463 static_cast<jfloat
>(
font_size),
static_cast<jint
>(configuration_id));
1465 return static_cast<double>(scaledSize);
1466}
1467
1468void PlatformViewAndroidJNIImpl::FlutterViewUpdateSemantics(
1469 std::vector<uint8_t> buffer,
1470 std::vector<std::string> strings,
1471 std::vector<std::vector<uint8_t>> string_attribute_args) {
1473
1474 auto java_object = java_object_.get(env);
1475 if (java_object.is_null()) {
1476 return;
1477 }
1478
1480 env, env->NewDirectByteBuffer(
buffer.data(),
buffer.size()));
1485
1486 env->CallVoidMethod(java_object.obj(), g_update_semantics_method,
1487 direct_buffer.obj(), jstrings.
obj(),
1488 jstring_attribute_args.
obj());
1489
1491}
1492
1493void PlatformViewAndroidJNIImpl::FlutterViewUpdateCustomAccessibilityActions(
1494 std::vector<uint8_t> actions_buffer,
1495 std::vector<std::string> strings) {
1497
1498 auto java_object = java_object_.get(env);
1499 if (java_object.is_null()) {
1500 return;
1501 }
1502
1504 env,
1505 env->NewDirectByteBuffer(actions_buffer.data(), actions_buffer.size()));
1506
1509
1510 env->CallVoidMethod(java_object.obj(),
1511 g_update_custom_accessibility_actions_method,
1512 direct_actions_buffer.obj(), jstrings.
obj());
1513
1515}
1516
1517void PlatformViewAndroidJNIImpl::FlutterViewOnFirstFrame() {
1519
1520 auto java_object = java_object_.get(env);
1521 if (java_object.is_null()) {
1522 return;
1523 }
1524
1525 env->CallVoidMethod(java_object.obj(), g_on_first_frame_method);
1526
1528}
1529
1530void PlatformViewAndroidJNIImpl::FlutterViewOnPreEngineRestart() {
1532
1533 auto java_object = java_object_.get(env);
1534 if (java_object.is_null()) {
1535 return;
1536 }
1537
1538 env->CallVoidMethod(java_object.obj(), g_on_engine_restart_method);
1539
1541}
1542
1543void PlatformViewAndroidJNIImpl::SurfaceTextureAttachToGLContext(
1544 JavaLocalRef surface_texture,
1545 int textureId) {
1547
1548 if (surface_texture.is_null()) {
1549 return;
1550 }
1551
1553 env, env->CallObjectMethod(surface_texture.obj(),
1554 g_java_weak_reference_get_method));
1555
1556 if (surface_texture_local_ref.is_null()) {
1557 return;
1558 }
1559
1560 env->CallVoidMethod(surface_texture_local_ref.obj(),
1561 g_attach_to_gl_context_method, textureId);
1562
1564}
1565
1566bool PlatformViewAndroidJNIImpl::SurfaceTextureShouldUpdate(
1567 JavaLocalRef surface_texture) {
1569
1570 if (surface_texture.is_null()) {
1571 return false;
1572 }
1573
1575 env, env->CallObjectMethod(surface_texture.obj(),
1576 g_java_weak_reference_get_method));
1577 if (surface_texture_local_ref.is_null()) {
1578 return false;
1579 }
1580
1581 jboolean shouldUpdate = env->CallBooleanMethod(
1582 surface_texture_local_ref.obj(), g_surface_texture_wrapper_should_update);
1583
1585
1586 return shouldUpdate;
1587}
1588
1589void PlatformViewAndroidJNIImpl::SurfaceTextureUpdateTexImage(
1590 JavaLocalRef surface_texture) {
1592
1593 if (surface_texture.is_null()) {
1594 return;
1595 }
1596
1598 env, env->CallObjectMethod(surface_texture.obj(),
1599 g_java_weak_reference_get_method));
1600 if (surface_texture_local_ref.is_null()) {
1601 return;
1602 }
1603
1604 env->CallVoidMethod(surface_texture_local_ref.obj(),
1605 g_update_tex_image_method);
1606
1608}
1609
1610SkM44 PlatformViewAndroidJNIImpl::SurfaceTextureGetTransformMatrix(
1611 JavaLocalRef surface_texture) {
1613
1614 if (surface_texture.is_null()) {
1615 return {};
1616 }
1617
1619 env, env->CallObjectMethod(surface_texture.obj(),
1620 g_java_weak_reference_get_method));
1621 if (surface_texture_local_ref.is_null()) {
1622 return {};
1623 }
1624
1626 env, env->NewFloatArray(16));
1627
1628 env->CallVoidMethod(surface_texture_local_ref.obj(),
1629 g_get_transform_matrix_method, transformMatrix.obj());
1631
1632 float* m = env->GetFloatArrayElements(transformMatrix.obj(), nullptr);
1633
1634 static_assert(sizeof(SkScalar) == sizeof(float));
1635 const auto transform = SkM44::ColMajor(m);
1636
1637 env->ReleaseFloatArrayElements(transformMatrix.obj(), m, JNI_ABORT);
1638
1640}
1641
1642void PlatformViewAndroidJNIImpl::SurfaceTextureDetachFromGLContext(
1643 JavaLocalRef surface_texture) {
1645
1646 if (surface_texture.is_null()) {
1647 return;
1648 }
1649
1651 env, env->CallObjectMethod(surface_texture.obj(),
1652 g_java_weak_reference_get_method));
1653 if (surface_texture_local_ref.is_null()) {
1654 return;
1655 }
1656
1657 env->CallVoidMethod(surface_texture_local_ref.obj(),
1658 g_detach_from_gl_context_method);
1659
1661}
1662
1664PlatformViewAndroidJNIImpl::ImageProducerTextureEntryAcquireLatestImage(
1665 JavaLocalRef image_producer_texture_entry) {
1667
1668 if (image_producer_texture_entry.is_null()) {
1669
1671 }
1672
1673
1674
1676 env, env->CallObjectMethod(image_producer_texture_entry.obj(),
1677 g_java_weak_reference_get_method));
1678
1679 if (image_producer_texture_entry_local_ref.is_null()) {
1680
1682 }
1683
1685 env, env->CallObjectMethod(image_producer_texture_entry_local_ref.obj(),
1686 g_acquire_latest_image_method));
1688 return r;
1689 }
1690
1692}
1693
1694JavaLocalRef PlatformViewAndroidJNIImpl::ImageGetHardwareBuffer(
1695 JavaLocalRef
image) {
1696 FML_CHECK(g_image_get_hardware_buffer_method !=
nullptr);
1698 if (
image.is_null()) {
1699
1701 }
1703 env,
1704 env->CallObjectMethod(
image.obj(), g_image_get_hardware_buffer_method));
1707 }
1708 return r;
1709}
1710
1711void PlatformViewAndroidJNIImpl::ImageClose(JavaLocalRef
image) {
1713 if (
image.is_null()) {
1714 return;
1715 }
1716 env->CallVoidMethod(
image.obj(), g_image_close_method);
1718}
1719
1720void PlatformViewAndroidJNIImpl::HardwareBufferClose(
1721 JavaLocalRef hardware_buffer) {
1722 FML_CHECK(g_hardware_buffer_close_method !=
nullptr);
1724 if (hardware_buffer.is_null()) {
1725 return;
1726 }
1727 env->CallVoidMethod(hardware_buffer.obj(), g_hardware_buffer_close_method);
1729}
1730
1731void PlatformViewAndroidJNIImpl::FlutterViewOnDisplayPlatformView(
1737 int viewWidth,
1738 int viewHeight,
1739 MutatorsStack mutators_stack) {
1741 auto java_object = java_object_.get(env);
1742 if (java_object.is_null()) {
1743 return;
1744 }
1745
1747 g_mutators_stack_init_method);
1748
1749 std::vector<std::shared_ptr<Mutator>>::const_iterator iter =
1750 mutators_stack.Begin();
1751 while (iter != mutators_stack.End()) {
1752 switch ((*iter)->GetType()) {
1753 case MutatorType::kTransform: {
1754 const DlMatrix& matrix = (*iter)->GetMatrix();
1756 matrix.m[0], matrix.m[4], matrix.m[12],
1757 matrix.m[1], matrix.m[5], matrix.m[13],
1758 matrix.m[3], matrix.m[7], matrix.m[15],
1759 };
1761 env, env->NewFloatArray(9));
1762
1763 env->SetFloatArrayRegion(transformMatrix.obj(), 0, 9, matrix_array);
1764 env->CallVoidMethod(mutatorsStack,
1765 g_mutators_stack_push_transform_method,
1766 transformMatrix.obj());
1767 break;
1768 }
1769 case MutatorType::kClipRect: {
1770 const DlRect& rect = (*iter)->GetRect();
1771 env->CallVoidMethod(mutatorsStack,
1772 g_mutators_stack_push_cliprect_method,
1773 static_cast<int>(rect.GetLeft()),
1774 static_cast<int>(rect.GetTop()),
1775 static_cast<int>(rect.GetRight()),
1776 static_cast<int>(rect.GetBottom()));
1777 break;
1778 }
1779 case MutatorType::kClipRRect: {
1781 const DlRect& rect = rrect.GetBounds();
1783 SkScalar radiis[8] = {
1785 radii.top_right.width, radii.top_right.height,
1786 radii.bottom_right.width, radii.bottom_right.height,
1787 radii.bottom_left.width, radii.bottom_left.height,
1788 };
1790 env, env->NewFloatArray(8));
1791 env->SetFloatArrayRegion(radiisArray.obj(), 0, 8, radiis);
1792 env->CallVoidMethod(mutatorsStack,
1793 g_mutators_stack_push_cliprrect_method,
1794 static_cast<int>(rect.GetLeft()),
1795 static_cast<int>(rect.GetTop()),
1796 static_cast<int>(rect.GetRight()),
1797 static_cast<int>(rect.GetBottom()),
1798 radiisArray.obj());
1799 break;
1800 }
1801 case MutatorType::kClipRSE: {
1802 const DlRoundRect& rrect = (*iter)->GetRSEApproximation();
1803 const DlRect& rect = rrect.GetBounds();
1805 SkScalar radiis[8] = {
1807 radii.top_right.width, radii.top_right.height,
1808 radii.bottom_right.width, radii.bottom_right.height,
1809 radii.bottom_left.width, radii.bottom_left.height,
1810 };
1812 env, env->NewFloatArray(8));
1813 env->SetFloatArrayRegion(radiisArray.obj(), 0, 8, radiis);
1814 env->CallVoidMethod(mutatorsStack,
1815 g_mutators_stack_push_cliprrect_method,
1816 static_cast<int>(rect.GetLeft()),
1817 static_cast<int>(rect.GetTop()),
1818 static_cast<int>(rect.GetRight()),
1819 static_cast<int>(rect.GetBottom()),
1820 radiisArray.obj());
1821 break;
1822 }
1823
1824
1825 case MutatorType::kClipPath:
1826 case MutatorType::kOpacity:
1827 case MutatorType::kBackdropFilter:
1828 case MutatorType::kBackdropClipRect:
1829 case MutatorType::kBackdropClipRRect:
1830 case MutatorType::kBackdropClipRSuperellipse:
1831 case MutatorType::kBackdropClipPath:
1832 break;
1833 }
1834 ++iter;
1835 }
1836
1837 env->CallVoidMethod(java_object.obj(), g_on_display_platform_view_method,
1839 mutatorsStack);
1840
1842}
1843
1844void PlatformViewAndroidJNIImpl::FlutterViewDisplayOverlaySurface(
1845 int surface_id,
1851
1852 auto java_object = java_object_.get(env);
1853 if (java_object.is_null()) {
1854 return;
1855 }
1856
1857 env->CallVoidMethod(java_object.obj(), g_on_display_overlay_surface_method,
1859
1861}
1862
1863void PlatformViewAndroidJNIImpl::FlutterViewBeginFrame() {
1865
1866 auto java_object = java_object_.get(env);
1867 if (java_object.is_null()) {
1868 return;
1869 }
1870
1871 env->CallVoidMethod(java_object.obj(), g_on_begin_frame_method);
1872
1874}
1875
1876void PlatformViewAndroidJNIImpl::FlutterViewEndFrame() {
1878
1879 auto java_object = java_object_.get(env);
1880 if (java_object.is_null()) {
1881 return;
1882 }
1883
1884 env->CallVoidMethod(java_object.obj(), g_on_end_frame_method);
1885
1887}
1888
1889std::unique_ptr<PlatformViewAndroidJNI::OverlayMetadata>
1890PlatformViewAndroidJNIImpl::FlutterViewCreateOverlaySurface() {
1892
1893 auto java_object = java_object_.get(env);
1894 if (java_object.is_null()) {
1895 return nullptr;
1896 }
1897
1899 env, env->CallObjectMethod(java_object.obj(),
1900 g_create_overlay_surface_method));
1902
1903 if (overlay.is_null()) {
1904 return std::make_unique<PlatformViewAndroidJNI::OverlayMetadata>(0,
1905 nullptr);
1906 }
1907
1908 jint overlay_id =
1909 env->CallIntMethod(overlay.obj(), g_overlay_surface_id_method);
1910
1911 jobject overlay_surface =
1912 env->CallObjectMethod(overlay.obj(), g_overlay_surface_surface_method);
1913
1914 auto overlay_window = fml::MakeRefCounted<AndroidNativeWindow>(
1915 ANativeWindow_fromSurface(env, overlay_surface));
1916
1917 return std::make_unique<PlatformViewAndroidJNI::OverlayMetadata>(
1918 overlay_id, std::move(overlay_window));
1919}
1920
1921void PlatformViewAndroidJNIImpl::FlutterViewDestroyOverlaySurfaces() {
1923
1924 auto java_object = java_object_.get(env);
1925 if (java_object.is_null()) {
1926 return;
1927 }
1928
1929 env->CallVoidMethod(java_object.obj(), g_destroy_overlay_surfaces_method);
1930
1932}
1933
1934std::unique_ptr<std::vector<std::string>>
1935PlatformViewAndroidJNIImpl::FlutterViewComputePlatformResolvedLocale(
1936 std::vector<std::string> supported_locales_data) {
1938
1939 std::unique_ptr<std::vector<std::string>> out =
1940 std::make_unique<std::vector<std::string>>();
1941
1942 auto java_object = java_object_.get(env);
1943 if (java_object.is_null()) {
1944 return out;
1945 }
1948 jobjectArray result = static_cast<jobjectArray>(env->CallObjectMethod(
1949 java_object.obj(), g_compute_platform_resolved_locale_method,
1950 j_locales_data.
obj()));
1951
1953
1954 int length = env->GetArrayLength(result);
1957 env,
static_cast<jstring
>(env->GetObjectArrayElement(result,
i))));
1958 }
1959 return out;
1960}
1961
1962double PlatformViewAndroidJNIImpl::GetDisplayRefreshRate() {
1964
1965 auto java_object = java_object_.get(env);
1966 if (java_object.is_null()) {
1967 return kUnknownDisplayRefreshRate;
1968 }
1969
1971 env, env->GetObjectClass(java_object.obj()));
1972 if (clazz.is_null()) {
1973 return kUnknownDisplayRefreshRate;
1974 }
1975
1976 jfieldID fid = env->GetStaticFieldID(clazz.obj(), "refreshRateFPS", "F");
1977 return static_cast<double>(env->GetStaticFloatField(clazz.obj(), fid));
1978}
1979
1980double PlatformViewAndroidJNIImpl::GetDisplayWidth() {
1982
1983 auto java_object = java_object_.get(env);
1984 if (java_object.is_null()) {
1985 return -1;
1986 }
1987
1989 env, env->GetObjectClass(java_object.obj()));
1990 if (clazz.is_null()) {
1991 return -1;
1992 }
1993
1994 jfieldID fid = env->GetStaticFieldID(clazz.obj(), "displayWidth", "F");
1995 return static_cast<double>(env->GetStaticFloatField(clazz.obj(), fid));
1996}
1997
1998double PlatformViewAndroidJNIImpl::GetDisplayHeight() {
2000
2001 auto java_object = java_object_.get(env);
2002 if (java_object.is_null()) {
2003 return -1;
2004 }
2005
2007 env, env->GetObjectClass(java_object.obj()));
2008 if (clazz.is_null()) {
2009 return -1;
2010 }
2011
2012 jfieldID fid = env->GetStaticFieldID(clazz.obj(), "displayHeight", "F");
2013 return static_cast<double>(env->GetStaticFloatField(clazz.obj(), fid));
2014}
2015
2016double PlatformViewAndroidJNIImpl::GetDisplayDensity() {
2018
2019 auto java_object = java_object_.get(env);
2020 if (java_object.is_null()) {
2021 return -1;
2022 }
2023
2025 env, env->GetObjectClass(java_object.obj()));
2026 if (clazz.is_null()) {
2027 return -1;
2028 }
2029
2030 jfieldID fid = env->GetStaticFieldID(clazz.obj(), "displayDensity", "F");
2031 return static_cast<double>(env->GetStaticFloatField(clazz.obj(), fid));
2032}
2033
2034bool PlatformViewAndroidJNIImpl::RequestDartDeferredLibrary(
2035 int loading_unit_id) {
2037
2038 auto java_object = java_object_.get(env);
2039 if (java_object.is_null()) {
2040 return true;
2041 }
2042
2043 env->CallVoidMethod(java_object.obj(), g_request_dart_deferred_library_method,
2044 loading_unit_id);
2045
2047 return true;
2048}
2049
2050
2051
2052ASurfaceTransaction* PlatformViewAndroidJNIImpl::createTransaction() {
2054
2055 auto java_object = java_object_.get(env);
2056 if (java_object.is_null()) {
2057 return nullptr;
2058 }
2059
2061 env,
2062 env->CallObjectMethod(java_object.obj(), g_create_transaction_method));
2063 if (transaction.is_null()) {
2064 return nullptr;
2065 }
2067
2069 env, transaction.obj());
2070}
2071
2072void PlatformViewAndroidJNIImpl::swapTransaction() {
2074
2075 auto java_object = java_object_.get(env);
2076 if (java_object.is_null()) {
2077 return;
2078 }
2079
2080 env->CallVoidMethod(java_object.obj(), g_swap_transaction_method);
2081
2083}
2084
2085void PlatformViewAndroidJNIImpl::applyTransaction() {
2087
2088 auto java_object = java_object_.get(env);
2089 if (java_object.is_null()) {
2090 return;
2091 }
2092
2093 env->CallVoidMethod(java_object.obj(), g_apply_transaction_method);
2094
2096}
2097
2098std::unique_ptr<PlatformViewAndroidJNI::OverlayMetadata>
2099PlatformViewAndroidJNIImpl::createOverlaySurface2() {
2101
2102 auto java_object = java_object_.get(env);
2103 if (java_object.is_null()) {
2104 return nullptr;
2105 }
2106
2108 env, env->CallObjectMethod(java_object.obj(),
2109 g_create_overlay_surface2_method));
2111
2112 if (overlay.is_null()) {
2113 return std::make_unique<PlatformViewAndroidJNI::OverlayMetadata>(0,
2114 nullptr);
2115 }
2116
2117 jint overlay_id =
2118 env->CallIntMethod(overlay.obj(), g_overlay_surface_id_method);
2119
2120 jobject overlay_surface =
2121 env->CallObjectMethod(overlay.obj(), g_overlay_surface_surface_method);
2122
2123 auto overlay_window = fml::MakeRefCounted<AndroidNativeWindow>(
2124 ANativeWindow_fromSurface(env, overlay_surface));
2125
2126 return std::make_unique<PlatformViewAndroidJNI::OverlayMetadata>(
2127 overlay_id, std::move(overlay_window));
2128}
2129
2130void PlatformViewAndroidJNIImpl::destroyOverlaySurface2() {
2132
2133 auto java_object = java_object_.get(env);
2134 if (java_object.is_null()) {
2135 return;
2136 }
2137
2138 env->CallVoidMethod(java_object.obj(), g_destroy_overlay_surface2_method);
2139
2141}
2142
2143namespace {
2145 public:
2146 explicit AndroidPathReceiver(JNIEnv* env)
2147 : env_(env),
2149
2150 void SetFillType(DlPathFillType
type) {
2151 jfieldID fill_type_field_id;
2153 case DlPathFillType::kOdd:
2155 break;
2156 case DlPathFillType::kNonZero:
2158 break;
2159 default:
2160
2161
2162 return;
2163 }
2164
2165
2166
2170 fill_type_field_id));
2173
2174
2175 env_->CallVoidMethod(android_path_, path_set_fill_type_method,
2176 fill_type_enum.
obj());
2178 }
2179
2180 void MoveTo(
const DlPoint&
p2,
bool will_be_closed)
override {
2181 env_->CallVoidMethod(android_path_, path_move_to_method,
p2.x,
p2.y);
2182 }
2183 void LineTo(
const DlPoint&
p2)
override {
2184 env_->CallVoidMethod(android_path_, path_line_to_method,
p2.x,
p2.y);
2185 }
2186 void QuadTo(
const DlPoint& cp,
const DlPoint&
p2)
override {
2187 env_->CallVoidMethod(android_path_, path_quad_to_method,
2188 cp.x, cp.y,
p2.x,
p2.y);
2189 }
2190 bool ConicTo(
const DlPoint& cp,
const DlPoint&
p2, DlScalar
weight)
override {
2191 if (!path_conic_to_method) {
2192 return false;
2193 }
2194 env_->CallVoidMethod(android_path_, path_conic_to_method,
2196 return true;
2197 };
2198 void CubicTo(
const DlPoint& cp1,
2199 const DlPoint& cp2,
2200 const DlPoint&
p2)
override {
2201 env_->CallVoidMethod(android_path_, path_cubic_to_method,
2202 cp1.x, cp1.y, cp2.x, cp2.y,
p2.x,
p2.y);
2203 }
2204 void Close()
override {
2205 env_->CallVoidMethod(android_path_, path_close_method);
2206 }
2207
2208 jobject TakePath() const { return android_path_; }
2209
2210 private:
2211 JNIEnv* env_;
2212 jobject android_path_;
2213};
2214}
2215
2216void PlatformViewAndroidJNIImpl::onDisplayPlatformView2(
2222 int32_t viewWidth,
2223 int32_t viewHeight,
2224 MutatorsStack mutators_stack) {
2226 auto java_object = java_object_.get(env);
2227 if (java_object.is_null()) {
2228 return;
2229 }
2230
2232 g_mutators_stack_init_method);
2233
2234 std::vector<std::shared_ptr<Mutator>>::const_iterator iter =
2235 mutators_stack.Begin();
2236 while (iter != mutators_stack.End()) {
2237 switch ((*iter)->GetType()) {
2238 case MutatorType::kTransform: {
2239 const DlMatrix& matrix = (*iter)->GetMatrix();
2241 matrix.m[0], matrix.m[4], matrix.m[12],
2242 matrix.m[1], matrix.m[5], matrix.m[13],
2243 matrix.m[3], matrix.m[7], matrix.m[15],
2244 };
2246 env, env->NewFloatArray(9));
2247
2248 env->SetFloatArrayRegion(transformMatrix.obj(), 0, 9, matrix_array);
2249 env->CallVoidMethod(mutatorsStack,
2250 g_mutators_stack_push_transform_method,
2251 transformMatrix.obj());
2252 break;
2253 }
2254 case MutatorType::kClipRect: {
2255 const DlRect& rect = (*iter)->GetRect();
2256 env->CallVoidMethod(mutatorsStack,
2257 g_mutators_stack_push_cliprect_method,
2258 static_cast<int>(rect.GetLeft()),
2259 static_cast<int>(rect.GetTop()),
2260 static_cast<int>(rect.GetRight()),
2261 static_cast<int>(rect.GetBottom()));
2262 break;
2263 }
2264 case MutatorType::kClipRRect: {
2266 const DlRect& rect = rrect.GetBounds();
2268 SkScalar radiis[8] = {
2270 radii.top_right.width, radii.top_right.height,
2271 radii.bottom_right.width, radii.bottom_right.height,
2272 radii.bottom_left.width, radii.bottom_left.height,
2273 };
2275 env, env->NewFloatArray(8));
2276 env->SetFloatArrayRegion(radiisArray.obj(), 0, 8, radiis);
2277 env->CallVoidMethod(mutatorsStack,
2278 g_mutators_stack_push_cliprrect_method,
2279 static_cast<int>(rect.GetLeft()),
2280 static_cast<int>(rect.GetTop()),
2281 static_cast<int>(rect.GetRight()),
2282 static_cast<int>(rect.GetBottom()),
2283 radiisArray.obj());
2284 break;
2285 }
2286 case MutatorType::kClipRSE: {
2287 const DlRoundRect& rrect = (*iter)->GetRSEApproximation();
2288 const DlRect& rect = rrect.GetBounds();
2290 SkScalar radiis[8] = {
2292 radii.top_right.width, radii.top_right.height,
2293 radii.bottom_right.width, radii.bottom_right.height,
2294 radii.bottom_left.width, radii.bottom_left.height,
2295 };
2297 env, env->NewFloatArray(8));
2298 env->SetFloatArrayRegion(radiisArray.obj(), 0, 8, radiis);
2299 env->CallVoidMethod(mutatorsStack,
2300 g_mutators_stack_push_cliprrect_method,
2301 static_cast<int>(rect.GetLeft()),
2302 static_cast<int>(rect.GetTop()),
2303 static_cast<int>(rect.GetRight()),
2304 static_cast<int>(rect.GetBottom()),
2305 radiisArray.obj());
2306 break;
2307 }
2308 case MutatorType::kOpacity: {
2309 float opacity = (*iter)->GetAlphaFloat();
2310 env->CallVoidMethod(mutatorsStack, g_mutators_stack_push_opacity_method,
2311 opacity);
2312 break;
2313 }
2314 case MutatorType::kClipPath: {
2315 auto& dlPath = (*iter)->GetPath();
2316
2317
2318
2319
2323
2324
2325 AndroidPathReceiver receiver(env);
2326 receiver.SetFillType(dlPath.GetFillType());
2327
2328
2329
2330
2331 dlPath.Dispatch(receiver);
2332
2333 env->CallVoidMethod(mutatorsStack,
2334 g_mutators_stack_push_clippath_method,
2335 receiver.TakePath());
2336 break;
2337 }
2338
2339
2340 case MutatorType::kBackdropFilter:
2341 case MutatorType::kBackdropClipRect:
2342 case MutatorType::kBackdropClipRRect:
2343 case MutatorType::kBackdropClipRSuperellipse:
2344 case MutatorType::kBackdropClipPath:
2345 break;
2346 }
2347 ++iter;
2348 }
2349
2350 env->CallVoidMethod(java_object.obj(), g_on_display_platform_view2_method,
2352 mutatorsStack);
2353
2355}
2356
2357void PlatformViewAndroidJNIImpl::hidePlatformView2(int32_t
view_id) {
2359 auto java_object = java_object_.get(env);
2360 if (java_object.is_null()) {
2361 return;
2362 }
2363
2364 env->CallVoidMethod(java_object.obj(), g_hide_platform_view2_method,
view_id);
2365}
2366
2367void PlatformViewAndroidJNIImpl::onEndFrame2() {
2369
2370 auto java_object = java_object_.get(env);
2371 if (java_object.is_null()) {
2372 return;
2373 }
2374
2375 env->CallVoidMethod(java_object.obj(), g_on_end_frame2_method);
2376
2378}
2379
2380void PlatformViewAndroidJNIImpl::showOverlaySurface2() {
2382
2383 auto java_object = java_object_.get(env);
2384 if (java_object.is_null()) {
2385 return;
2386 }
2387
2388 env->CallVoidMethod(java_object.obj(), g_show_overlay_surface2_method);
2390}
2391
2392void PlatformViewAndroidJNIImpl::hideOverlaySurface2() {
2394
2395 auto java_object = java_object_.get(env);
2396 if (java_object.is_null()) {
2397 return;
2398 }
2399
2400 env->CallVoidMethod(java_object.obj(), g_hide_overlay_surface2_method);
2402}
2403
2404void PlatformViewAndroidJNIImpl::MaybeResizeSurfaceView(int32_t
width,
2407
2408 auto java_object = java_object_.get(env);
2409 if (java_object.is_null()) {
2410 return;
2411 }
2412
2413 env->CallVoidMethod(java_object.obj(), g_maybe_resize_surface_view,
width,
2416}
2417
2418}
static std::unique_ptr< DartCallbackRepresentation > GetCallbackInformation(int64_t handle)
A Mapping like NonOwnedMapping, but uses Free as its release proc.
static MallocMapping Copy(const T *begin, const T *end)
static fml::RefPtr< NativeLibrary > CreateWithHandle(Handle handle, bool close_handle_when_done)
FlutterVulkanImage * image
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
G_BEGIN_DECLS FlutterViewId view_id
#define FML_LOG(severity)
#define FML_CHECK(condition)
#define FML_DCHECK(condition)
std::shared_ptr< SkBitmap > bitmap
static jmethodID g_hardware_buffer_close_method
impeller::Scalar DlScalar
static void RunBundleAndSnapshotFromLibrary(JNIEnv *env, jobject jcaller, jlong shell_holder, jstring jBundlePath, jstring jEntrypoint, jstring jLibraryUrl, jobject jAssetManager, jobject jEntrypointArgs, jlong engineId)
impeller::PathReceiver DlPathReceiver
static jmethodID g_mutators_stack_init_method
impeller::RoundingRadii DlRoundingRadii
static jfieldID g_jni_shell_holder_field
static void InvokePlatformMessageResponseCallback(JNIEnv *env, jobject jcaller, jlong shell_holder, jint responseId, jobject message, jint position)
static jmethodID g_request_dart_deferred_library_method
static jboolean GetIsSoftwareRendering(JNIEnv *env, jobject jcaller)
static bool IsSurfaceControlEnabled(JNIEnv *env, jobject jcaller, jlong shell_holder)
static void DispatchPointerDataPacket(JNIEnv *env, jobject jcaller, jlong shell_holder, jobject buffer, jint position)
bool RegisterApi(JNIEnv *env)
impeller::RoundRect DlRoundRect
static jmethodID g_mutators_stack_push_clippath_method
static jboolean FlutterTextUtilsIsEmojiModifier(JNIEnv *env, jobject obj, jint codePoint)
static fml::jni::ScopedJavaGlobalRef< jclass > * path_class
static fml::jni::ScopedJavaGlobalRef< jclass > * g_java_long_class
static void LoadLoadingUnitFailure(intptr_t loading_unit_id, const std::string &message, bool transient)
static void InvokePlatformMessageEmptyResponseCallback(JNIEnv *env, jobject jcaller, jlong shell_holder, jint responseId)
impeller::Matrix DlMatrix
impeller::ISize32 DlISize
static jmethodID g_acquire_latest_image_method
static jmethodID g_mutators_stack_push_transform_method
static fml::jni::ScopedJavaGlobalRef< jclass > * g_bitmap_class
std::nullptr_t JavaLocalRef
static void SurfaceDestroyed(JNIEnv *env, jobject jcaller, jlong shell_holder)
static jmethodID path_line_to_method
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
static jmethodID path_quad_to_method
static jmethodID g_long_constructor
static void DestroyJNI(JNIEnv *env, jobject jcaller, jlong shell_holder)
static void DispatchSemanticsAction(JNIEnv *env, jobject jcaller, jlong shell_holder, jint id, jint action, jobject args, jint args_position)
static jmethodID g_jni_constructor
static void MarkTextureFrameAvailable(JNIEnv *env, jobject jcaller, jlong shell_holder, jlong texture_id)
static jmethodID g_attach_to_gl_context_method
static jfieldID g_path_fill_type_even_odd_field
static void SetSemanticsEnabled(JNIEnv *env, jobject jcaller, jlong shell_holder, jboolean enabled)
static void DeferredComponentInstallFailure(JNIEnv *env, jobject obj, jint jLoadingUnitId, jstring jError, jboolean jTransient)
static jobject SpawnJNI(JNIEnv *env, jobject jcaller, jlong shell_holder, jstring jEntrypoint, jstring jLibraryUrl, jstring jInitialRoute, jobject jEntrypointArgs, jlong engineId)
static jfieldID g_path_fill_type_winding_field
static fml::jni::ScopedJavaGlobalRef< jclass > * g_texture_wrapper_class
static void LoadDartDeferredLibrary(JNIEnv *env, jobject obj, jlong shell_holder, jint jLoadingUnitId, jobjectArray jSearchPaths)
static jmethodID g_java_weak_reference_get_method
static void NotifyLowMemoryWarning(JNIEnv *env, jobject obj, jlong shell_holder)
static jboolean FlutterTextUtilsIsVariationSelector(JNIEnv *env, jobject obj, jint codePoint)
static jmethodID g_image_get_hardware_buffer_method
static void CleanupMessageData(JNIEnv *env, jobject jcaller, jlong message_data)
static jmethodID g_mutators_stack_push_cliprect_method
static jmethodID g_overlay_surface_surface_method
static void SetViewportMetrics(JNIEnv *env, jobject jcaller, jlong shell_holder, jfloat devicePixelRatio, jint physicalWidth, jint physicalHeight, jint physicalPaddingTop, jint physicalPaddingRight, jint physicalPaddingBottom, jint physicalPaddingLeft, jint physicalViewInsetTop, jint physicalViewInsetRight, jint physicalViewInsetBottom, jint physicalViewInsetLeft, jint systemGestureInsetTop, jint systemGestureInsetRight, jint systemGestureInsetBottom, jint systemGestureInsetLeft, jint physicalTouchSlop, jintArray javaDisplayFeaturesBounds, jintArray javaDisplayFeaturesType, jintArray javaDisplayFeaturesState, jint physicalMinWidth, jint physicalMaxWidth, jint physicalMinHeight, jint physicalMaxHeight, jint physicalDisplayCornerRadiusTopLeft, jint physicalDisplayCornerRadiusTopRight, jint physicalDisplayCornerRadiusBottomRight, jint physicalDisplayCornerRadiusBottomLeft)
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot data
static void DispatchPlatformMessage(JNIEnv *env, jobject jcaller, jlong shell_holder, jstring channel, jobject message, jint position, jint responseId)
static jmethodID g_overlay_surface_id_method
static jmethodID g_mutators_stack_push_cliprrect_method
static jmethodID g_get_transform_matrix_method
static jmethodID path_cubic_to_method
static jmethodID g_compute_platform_resolved_locale_method
static void SurfaceWindowChanged(JNIEnv *env, jobject jcaller, jlong shell_holder, jobject jsurface)
static jmethodID g_bitmap_copy_pixels_from_buffer_method
static void RegisterImageTexture(JNIEnv *env, jobject jcaller, jlong shell_holder, jlong texture_id, jobject image_texture_entry, jboolean reset_on_background)
static fml::jni::ScopedJavaGlobalRef< jclass > * g_flutter_jni_class
static fml::jni::ScopedJavaGlobalRef< jclass > * g_bitmap_config_class
static jmethodID g_surface_texture_wrapper_should_update
static fml::jni::ScopedJavaGlobalRef< jclass > * g_image_class
static void SurfaceCreated(JNIEnv *env, jobject jcaller, jlong shell_holder, jobject jsurface)
static jmethodID g_flutter_callback_info_constructor
static jmethodID path_set_fill_type_method
static void DispatchEmptyPlatformMessage(JNIEnv *env, jobject jcaller, jlong shell_holder, jstring channel, jint responseId)
static fml::jni::ScopedJavaGlobalRef< jclass > * g_path_fill_type_class
static void ScheduleFrame(JNIEnv *env, jobject jcaller, jlong shell_holder)
static jmethodID path_move_to_method
static jlong AttachJNI(JNIEnv *env, jclass clazz, jobject flutterJNI)
static void SetAccessibilityFeatures(JNIEnv *env, jobject jcaller, jlong shell_holder, jint flags)
static jmethodID g_update_tex_image_method
static fml::jni::ScopedJavaGlobalRef< jclass > * g_java_weak_reference_class
static jmethodID g_image_close_method
static void UpdateDisplayMetrics(JNIEnv *env, jobject jcaller, jlong shell_holder)
static jmethodID g_mutators_stack_push_opacity_method
static void SurfaceChanged(JNIEnv *env, jobject jcaller, jlong shell_holder, jint width, jint height)
static jmethodID g_bitmap_config_value_of
static fml::jni::ScopedJavaGlobalRef< jclass > * g_image_consumer_texture_registry_interface
static void UpdateJavaAssetManager(JNIEnv *env, jobject obj, jlong shell_holder, jobject jAssetManager, jstring jAssetBundlePath)
static jobject GetBitmap(JNIEnv *env, jobject jcaller, jlong shell_holder)
static jmethodID path_constructor
static jmethodID g_bitmap_create_bitmap_method
static void UnregisterTexture(JNIEnv *env, jobject jcaller, jlong shell_holder, jlong texture_id)
static fml::jni::ScopedJavaGlobalRef< jclass > * g_flutter_callback_info_class
static fml::jni::ScopedJavaGlobalRef< jclass > * g_mutators_stack_class
static jmethodID path_close_method
static jboolean FlutterTextUtilsIsEmojiModifierBase(JNIEnv *env, jobject obj, jint codePoint)
static jobject LookupCallbackInformation(JNIEnv *env, jobject, jlong handle)
static jboolean FlutterTextUtilsIsRegionalIndicator(JNIEnv *env, jobject obj, jint codePoint)
static jmethodID g_detach_from_gl_context_method
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set profile Make the profiler discard new samples once the profiler sample buffer is full When this flag is not the profiler sample buffer is used as a ring buffer
static jmethodID path_conic_to_method
static fml::jni::ScopedJavaGlobalRef< jclass > * g_hardware_buffer_class
static jboolean FlutterTextUtilsIsEmoji(JNIEnv *env, jobject obj, jint codePoint)
static void RegisterTexture(JNIEnv *env, jobject jcaller, jlong shell_holder, jlong texture_id, jobject surface_texture)
JNIEnv * AttachCurrentThread()
ScopedJavaLocalRef< jobjectArray > VectorToBufferArray(JNIEnv *env, const std::vector< std::vector< uint8_t > > &vector)
std::string JavaStringToString(JNIEnv *env, jstring str)
bool ClearException(JNIEnv *env, bool silent)
bool CheckException(JNIEnv *env)
ScopedJavaLocalRef< jobjectArray > VectorToStringArray(JNIEnv *env, const std::vector< std::string > &vector)
std::vector< std::string > StringListToVector(JNIEnv *env, jobject list)
std::vector< std::string > StringArrayToVector(JNIEnv *env, jobjectArray array)
ScopedJavaLocalRef< jstring > StringToJavaString(JNIEnv *env, const std::string &u8_string)
const ProcTable & GetProcTable()
void MoveTo(PathBuilder *builder, Scalar x, Scalar y)
void LineTo(PathBuilder *builder, Scalar x, Scalar y)
void CubicTo(PathBuilder *builder, Scalar x1, Scalar y1, Scalar x2, Scalar y2, Scalar x3, Scalar y3)
void Close(PathBuilder *builder)
impeller::ShaderType type