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 env->GetIntArrayRegion(javaDisplayFeaturesBounds, 0, rectSize,
368 &boundsIntVector[0]);
369 std::vector<double> displayFeaturesBounds(boundsIntVector.begin(),
370 boundsIntVector.end());
371 jsize typeSize = env->GetArrayLength(javaDisplayFeaturesType);
372 std::vector<int> displayFeaturesType(typeSize);
373 env->GetIntArrayRegion(javaDisplayFeaturesType, 0, typeSize,
374 &displayFeaturesType[0]);
375
376 jsize stateSize = env->GetArrayLength(javaDisplayFeaturesState);
377 std::vector<int> displayFeaturesState(stateSize);
378 env->GetIntArrayRegion(javaDisplayFeaturesState, 0, stateSize,
379 &displayFeaturesState[0]);
380
381
383 static_cast<double>(devicePixelRatio),
384 static_cast<double>(physicalWidth),
385 static_cast<double>(physicalHeight),
386 static_cast<double>(physicalMinWidth),
387 static_cast<double>(physicalMaxWidth),
388 static_cast<double>(
389 physicalMinHeight),
390 static_cast<double>(
391 physicalMaxHeight),
392 static_cast<double>(physicalPaddingTop),
393 static_cast<double>(physicalPaddingRight),
394 static_cast<double>(physicalPaddingBottom),
395 static_cast<double>(physicalPaddingLeft),
396 static_cast<double>(physicalViewInsetTop),
397 static_cast<double>(
398 physicalViewInsetRight),
399 static_cast<double>(
400 physicalViewInsetBottom),
401 static_cast<double>(physicalViewInsetLeft),
402 static_cast<double>(
403 systemGestureInsetTop),
404 static_cast<double>(
405 systemGestureInsetRight),
406 static_cast<double>(
407 systemGestureInsetBottom),
408 static_cast<double>(
409 systemGestureInsetLeft),
410 static_cast<double>(physicalTouchSlop),
411 displayFeaturesBounds,
412 displayFeaturesType,
413 displayFeaturesState,
414 0,
415 static_cast<double>(
416 physicalDisplayCornerRadiusTopLeft),
417 static_cast<double>(
418 physicalDisplayCornerRadiusTopRight),
419 static_cast<double>(
420 physicalDisplayCornerRadiusBottomRight),
421 static_cast<double>(
422 physicalDisplayCornerRadiusBottomLeft),
423 };
424
426 kFlutterImplicitViewId, metrics);
427}
428
430 jobject jcaller,
431 jlong shell_holder) {
433}
434
436 jobject jcaller,
437 jlong shell_holder) {
439}
440
441static jobject
GetBitmap(JNIEnv* env, jobject jcaller, jlong shell_holder) {
443 Rasterizer::ScreenshotType::UncompressedImage, false);
444 if (screenshot.data == nullptr) {
445 return nullptr;
446 }
447
448 jstring argb = env->NewStringUTF("ARGB_8888");
449 if (argb == nullptr) {
450 return nullptr;
451 }
452
453 jobject bitmap_config = env->CallStaticObjectMethod(
455 if (bitmap_config == nullptr) {
456 return nullptr;
457 }
458
459 auto bitmap = env->CallStaticObjectMethod(
461 screenshot.frame_size.width, screenshot.frame_size.height, bitmap_config);
462
464 env,
465 env->NewDirectByteBuffer(const_cast<uint8_t*>(screenshot.data->bytes()),
466 screenshot.data->size()));
467
468 env->CallVoidMethod(
bitmap, g_bitmap_copy_pixels_from_buffer_method,
470
472}
473
475 jobject jcaller,
476 jlong shell_holder,
479 jint position,
480 jint responseId) {
482 env,
485 position,
486 responseId
487 );
488}
489
491 jobject jcaller,
492 jlong shell_holder,
494 jint responseId) {
496 env,
498 responseId
499 );
500}
501
503 jobject jcaller,
504 jlong message_data) {
505
506 free(reinterpret_cast<void*>(message_data));
507}
508
510 jobject jcaller,
511 jlong shell_holder,
512 jobject buffer,
513 jint position) {
514 uint8_t*
data =
static_cast<uint8_t*
>(env->GetDirectBufferAddress(buffer));
515 auto packet = std::make_unique<flutter::PointerDataPacket>(
data, position);
517 std::move(packet));
518}
519
521 jobject jcaller,
522 jlong shell_holder,
523 jint id,
526 jint args_position) {
528 env,
529 id,
532 args_position
533 );
534}
535
537 jobject jcaller,
538 jlong shell_holder,
539 jboolean enabled) {
541}
542
544 jobject jcaller,
545 jlong shell_holder,
546 jint flags) {
548}
549
551 return FlutterMain::Get().GetSettings().enable_software_rendering;
552}
553
555 jobject jcaller,
556 jlong shell_holder,
558 jobject surface_texture) {
562 );
563}
564
566 jobject jcaller,
567 jlong shell_holder,
569 jobject image_texture_entry,
570 jboolean reset_on_background) {
571 ImageExternalTexture::ImageLifecycle lifecycle =
572 reset_on_background ? ImageExternalTexture::ImageLifecycle::kReset
573 : ImageExternalTexture::ImageLifecycle::kKeepAlive;
574
578 lifecycle
579 );
580}
581
583 jobject jcaller,
584 jlong shell_holder,
588}
589
591 jobject jcaller,
592 jlong shell_holder,
596}
597
598static void ScheduleFrame(JNIEnv* env, jobject jcaller, jlong shell_holder) {
600}
601
603 jobject jcaller,
604 jlong shell_holder,
605 jint responseId,
607 jint position) {
608 uint8_t* response_data =
609 static_cast<uint8_t*
>(env->GetDirectBufferAddress(
message));
611 auto mapping = std::make_unique<fml::MallocMapping>(
614 ->InvokePlatformMessageResponseCallback(responseId, std::move(mapping));
615}
616
618 jobject jcaller,
619 jlong shell_holder,
620 jint responseId) {
622 ->InvokePlatformMessageEmptyResponseCallback(responseId);
623}
624
626 jobject obj,
627 jlong shell_holder) {
629}
630
632 jobject obj,
633 jint codePoint) {
634 return u_hasBinaryProperty(codePoint, UProperty::UCHAR_EMOJI);
635}
636
638 jobject obj,
639 jint codePoint) {
640 return u_hasBinaryProperty(codePoint, UProperty::UCHAR_EMOJI_MODIFIER);
641}
642
644 jobject obj,
645 jint codePoint) {
646 return u_hasBinaryProperty(codePoint, UProperty::UCHAR_EMOJI_MODIFIER_BASE);
647}
648
650 jobject obj,
651 jint codePoint) {
652 return u_hasBinaryProperty(codePoint, UProperty::UCHAR_VARIATION_SELECTOR);
653}
654
656 jobject obj,
657 jint codePoint) {
658 return u_hasBinaryProperty(codePoint, UProperty::UCHAR_REGIONAL_INDICATOR);
659}
660
663 bool transient) {
664
665}
666
668 jobject obj,
669 jint jLoadingUnitId,
670 jstring jError,
671 jboolean jTransient) {
674 static_cast<bool>(jTransient));
675}
676
678 jobject obj,
679 jlong shell_holder,
680 jint jLoadingUnitId,
681 jobjectArray jSearchPaths) {
682
683 intptr_t loading_unit_id = static_cast<intptr_t>(jLoadingUnitId);
684 std::vector<std::string> search_paths =
686
687
688
689 void* handle = nullptr;
690 while (handle == nullptr && !search_paths.empty()) {
691 std::string
path = search_paths.back();
692 handle = ::dlopen(
path.c_str(), RTLD_NOW);
693 search_paths.pop_back();
694 }
695 if (handle == nullptr) {
697 "No lib .so found for provided search paths.", true);
698 return;
699 }
702
703
704 std::unique_ptr<const fml::SymbolMapping> data_mapping =
705 std::make_unique<const fml::SymbolMapping>(
706 native_lib, DartSnapshot::kIsolateDataSymbol);
707 std::unique_ptr<const fml::SymbolMapping> instructions_mapping =
708 std::make_unique<const fml::SymbolMapping>(
709 native_lib, DartSnapshot::kIsolateInstructionsSymbol);
710
712 loading_unit_id, std::move(data_mapping),
713 std::move(instructions_mapping));
714}
715
717 jobject obj,
718 jlong shell_holder,
719 jobject jAssetManager,
720 jstring jAssetBundlePath) {
721 auto asset_resolver = std::make_unique<flutter::APKAssetProvider>(
722 env,
723 jAssetManager,
725
727 std::move(asset_resolver),
728 AssetResolver::AssetResolverType::kApkAssetProvider);
729}
730
732 static const JNINativeMethod flutter_jni_methods[] = {
733
734 {
735 .name = "nativeAttach",
736 .signature = "(Lio/flutter/embedding/engine/FlutterJNI;)J",
737 .fnPtr =
reinterpret_cast<void*
>(&
AttachJNI),
738 },
739 {
740 .name = "nativeDestroy",
741 .signature = "(J)V",
742 .fnPtr =
reinterpret_cast<void*
>(&
DestroyJNI),
743 },
744 {
745 .name = "nativeSpawn",
746 .signature = "(JLjava/lang/String;Ljava/lang/String;Ljava/lang/"
747 "String;Ljava/util/List;J)Lio/flutter/"
748 "embedding/engine/FlutterJNI;",
749 .fnPtr =
reinterpret_cast<void*
>(&
SpawnJNI),
750 },
751 {
752 .name = "nativeRunBundleAndSnapshotFromLibrary",
753 .signature = "(JLjava/lang/String;Ljava/lang/String;"
754 "Ljava/lang/String;Landroid/content/res/"
755 "AssetManager;Ljava/util/List;J)V",
757 },
758 {
759 .name = "nativeDispatchEmptyPlatformMessage",
760 .signature = "(JLjava/lang/String;I)V",
762 },
763 {
764 .name = "nativeCleanupMessageData",
765 .signature = "(J)V",
767 },
768 {
769 .name = "nativeDispatchPlatformMessage",
770 .signature = "(JLjava/lang/String;Ljava/nio/ByteBuffer;II)V",
772 },
773 {
774 .name = "nativeInvokePlatformMessageResponseCallback",
775 .signature = "(JILjava/nio/ByteBuffer;I)V",
776 .fnPtr =
778 },
779 {
780 .name = "nativeInvokePlatformMessageEmptyResponseCallback",
781 .signature = "(JI)V",
782 .fnPtr = reinterpret_cast<void*>(
784 },
785 {
786 .name = "nativeNotifyLowMemoryWarning",
787 .signature = "(J)V",
789 },
790
791
792 {
793 .name = "nativeGetBitmap",
794 .signature = "(J)Landroid/graphics/Bitmap;",
795 .fnPtr =
reinterpret_cast<void*
>(&
GetBitmap),
796 },
797 {
798 .name = "nativeSurfaceCreated",
799 .signature = "(JLandroid/view/Surface;)V",
801 },
802 {
803 .name = "nativeSurfaceWindowChanged",
804 .signature = "(JLandroid/view/Surface;)V",
806 },
807 {
808 .name = "nativeSurfaceChanged",
809 .signature = "(JII)V",
811 },
812 {
813 .name = "nativeSurfaceDestroyed",
814 .signature = "(J)V",
816 },
817 {
818 .name = "nativeSetViewportMetrics",
819 .signature = "(JFIIIIIIIIIIIIIII[I[I[IIIIIIIII)V",
821 },
822 {
823 .name = "nativeDispatchPointerDataPacket",
824 .signature = "(JLjava/nio/ByteBuffer;I)V",
826 },
827 {
828 .name = "nativeDispatchSemanticsAction",
829 .signature = "(JIILjava/nio/ByteBuffer;I)V",
831 },
832 {
833 .name = "nativeSetSemanticsEnabled",
834 .signature = "(JZ)V",
836 },
837 {
838 .name = "nativeSetAccessibilityFeatures",
839 .signature = "(JI)V",
841 },
842 {
843 .name = "nativeGetIsSoftwareRenderingEnabled",
844 .signature = "()Z",
846 },
847 {
848 .name = "nativeRegisterTexture",
849 .signature = "(JJLjava/lang/ref/"
850 "WeakReference;)V",
852 },
853 {
854 .name = "nativeRegisterImageTexture",
855 .signature = "(JJLjava/lang/ref/"
856 "WeakReference;Z)V",
858 },
859 {
860 .name = "nativeMarkTextureFrameAvailable",
861 .signature = "(JJ)V",
863 },
864 {
865 .name = "nativeScheduleFrame",
866 .signature = "(J)V",
868 },
869 {
870 .name = "nativeUnregisterTexture",
871 .signature = "(JJ)V",
873 },
874
875 {
876 .name = "nativeLookupCallbackInformation",
877 .signature = "(J)Lio/flutter/view/FlutterCallbackInformation;",
879 },
880
881
882 {
883 .name = "nativeFlutterTextUtilsIsEmoji",
884 .signature = "(I)Z",
886 },
887 {
888 .name = "nativeFlutterTextUtilsIsEmojiModifier",
889 .signature = "(I)Z",
891 },
892 {
893 .name = "nativeFlutterTextUtilsIsEmojiModifierBase",
894 .signature = "(I)Z",
895 .fnPtr =
897 },
898 {
899 .name = "nativeFlutterTextUtilsIsVariationSelector",
900 .signature = "(I)Z",
901 .fnPtr =
903 },
904 {
905 .name = "nativeFlutterTextUtilsIsRegionalIndicator",
906 .signature = "(I)Z",
907 .fnPtr =
909 },
910 {
911 .name = "nativeLoadDartDeferredLibrary",
912 .signature = "(JI[Ljava/lang/String;)V",
914 },
915 {
916 .name = "nativeUpdateJavaAssetManager",
917 .signature =
918 "(JLandroid/content/res/AssetManager;Ljava/lang/String;)V",
920 },
921 {
922 .name = "nativeDeferredComponentInstallFailure",
923 .signature = "(ILjava/lang/String;Z)V",
925 },
926 {
927 .name = "nativeUpdateDisplayMetrics",
928 .signature = "(J)V",
930 },
931 {
932 .name = "nativeIsSurfaceControlEnabled",
933 .signature = "(J)Z",
935 }};
936
938 std::size(flutter_jni_methods)) != 0) {
939 FML_LOG(ERROR) <<
"Failed to RegisterNatives with FlutterJNI";
940 return false;
941 }
942
945
946 if (g_jni_shell_holder_field == nullptr) {
947 FML_LOG(ERROR) <<
"Could not locate FlutterJNI's nativeShellHolderId field";
948 return false;
949 }
950
953
954 if (g_jni_constructor == nullptr) {
955 FML_LOG(ERROR) <<
"Could not locate FlutterJNI's constructor";
956 return false;
957 }
958
960 "valueOf", "(J)Ljava/lang/Long;");
961 if (g_long_constructor == nullptr) {
962 FML_LOG(ERROR) <<
"Could not locate Long's constructor";
963 return false;
964 }
965
967
969 env, env->FindClass("io/flutter/embedding/engine/FlutterOverlaySurface"));
970 if (overlay_surface_class.is_null()) {
971 FML_LOG(ERROR) <<
"Could not locate FlutterOverlaySurface class";
972 return false;
973 }
975 env->GetMethodID(overlay_surface_class.obj(), "getId", "()I");
976 if (g_overlay_surface_id_method == nullptr) {
977 FML_LOG(ERROR) <<
"Could not locate FlutterOverlaySurface#getId() method";
978 return false;
979 }
981 overlay_surface_class.obj(), "getSurface", "()Landroid/view/Surface;");
982 if (g_overlay_surface_surface_method == nullptr) {
984 << "Could not locate FlutterOverlaySurface#getSurface() method";
985 return false;
986 }
987
989 env, env->FindClass("android/graphics/Bitmap"));
991 FML_LOG(ERROR) <<
"Could not locate Bitmap Class";
992 return false;
993 }
994
997 "(IILandroid/graphics/Bitmap$Config;)Landroid/graphics/Bitmap;");
998 if (g_bitmap_create_bitmap_method == nullptr) {
999 FML_LOG(ERROR) <<
"Could not locate Bitmap.createBitmap method";
1000 return false;
1001 }
1002
1004 g_bitmap_class->obj(),
"copyPixelsFromBuffer",
"(Ljava/nio/Buffer;)V");
1005 if (g_bitmap_copy_pixels_from_buffer_method == nullptr) {
1006 FML_LOG(ERROR) <<
"Could not locate Bitmap.copyPixelsFromBuffer method";
1007 return false;
1008 }
1009
1011 env, env->FindClass("android/graphics/Bitmap$Config"));
1013 FML_LOG(ERROR) <<
"Could not locate Bitmap.Config Class";
1014 return false;
1015 }
1016
1019 "(Ljava/lang/String;)Landroid/graphics/Bitmap$Config;");
1020 if (g_bitmap_config_value_of == nullptr) {
1021 FML_LOG(ERROR) <<
"Could not locate Bitmap.Config.valueOf method";
1022 return false;
1023 }
1024
1025 return true;
1026}
1027
1028bool PlatformViewAndroid::Register(JNIEnv* env) {
1029 if (env == nullptr) {
1030 FML_LOG(ERROR) <<
"No JNIEnv provided";
1031 return false;
1032 }
1033
1035 env, env->FindClass("io/flutter/view/FlutterCallbackInformation"));
1037 FML_LOG(ERROR) <<
"Could not locate FlutterCallbackInformation class";
1038 return false;
1039 }
1040
1043 "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V");
1044 if (g_flutter_callback_info_constructor == nullptr) {
1045 FML_LOG(ERROR) <<
"Could not locate FlutterCallbackInformation constructor";
1046 return false;
1047 }
1048
1050 env, env->FindClass("io/flutter/embedding/engine/FlutterJNI"));
1052 FML_LOG(ERROR) <<
"Failed to find FlutterJNI Class.";
1053 return false;
1054 }
1055
1057 env,
1058 env->FindClass(
1059 "io/flutter/embedding/engine/mutatorsstack/FlutterMutatorsStack"));
1060 if (g_mutators_stack_class == nullptr) {
1061 FML_LOG(ERROR) <<
"Could not locate FlutterMutatorsStack";
1062 return false;
1063 }
1064
1067 if (g_mutators_stack_init_method == nullptr) {
1068 FML_LOG(ERROR) <<
"Could not locate FlutterMutatorsStack.init method";
1069 return false;
1070 }
1071
1074 if (g_mutators_stack_push_transform_method == nullptr) {
1076 << "Could not locate FlutterMutatorsStack.pushTransform method";
1077 return false;
1078 }
1079
1082 if (g_mutators_stack_push_cliprect_method == nullptr) {
1084 << "Could not locate FlutterMutatorsStack.pushClipRect method";
1085 return false;
1086 }
1087
1090 if (g_mutators_stack_push_cliprrect_method == nullptr) {
1092 << "Could not locate FlutterMutatorsStack.pushClipRRect method";
1093 return false;
1094 }
1095
1098 if (g_mutators_stack_push_opacity_method == nullptr) {
1100 << "Could not locate FlutterMutatorsStack.pushOpacity method";
1101 return false;
1102 }
1103
1106 "(Landroid/graphics/Path;)V");
1107 if (g_mutators_stack_push_clippath_method == nullptr) {
1109 << "Could not locate FlutterMutatorsStack.pushClipPath method";
1110 return false;
1111 }
1112
1114 env, env->FindClass("java/lang/ref/WeakReference"));
1116 FML_LOG(ERROR) <<
"Could not locate WeakReference class";
1117 return false;
1118 }
1119
1122 if (g_java_weak_reference_get_method == nullptr) {
1123 FML_LOG(ERROR) <<
"Could not locate WeakReference.get method";
1124 return false;
1125 }
1126
1128 env, env->FindClass(
1129 "io/flutter/embedding/engine/renderer/SurfaceTextureWrapper"));
1131 FML_LOG(ERROR) <<
"Could not locate SurfaceTextureWrapper class";
1132 return false;
1133 }
1134
1137
1138 if (g_attach_to_gl_context_method == nullptr) {
1139 FML_LOG(ERROR) <<
"Could not locate attachToGlContext method";
1140 return false;
1141 }
1142
1145
1146 if (g_surface_texture_wrapper_should_update == nullptr) {
1148 << "Could not locate SurfaceTextureWrapper.shouldUpdate method";
1149 return false;
1150 }
1151
1154
1155 if (g_update_tex_image_method == nullptr) {
1156 FML_LOG(ERROR) <<
"Could not locate updateTexImage method";
1157 return false;
1158 }
1159
1162
1163 if (g_get_transform_matrix_method == nullptr) {
1164 FML_LOG(ERROR) <<
"Could not locate getTransformMatrix method";
1165 return false;
1166 }
1167
1170
1171 if (g_detach_from_gl_context_method == nullptr) {
1172 FML_LOG(ERROR) <<
"Could not locate detachFromGlContext method";
1173 return false;
1174 }
1177 env, env->FindClass("io/flutter/view/TextureRegistry$ImageConsumer"));
1179 FML_LOG(ERROR) <<
"Could not locate TextureRegistry.ImageConsumer class";
1180 return false;
1181 }
1182
1185 "acquireLatestImage", "()Landroid/media/Image;");
1186 if (g_acquire_latest_image_method == nullptr) {
1187 FML_LOG(ERROR) <<
"Could not locate acquireLatestImage on "
1188 "TextureRegistry.ImageConsumer class";
1189 return false;
1190 }
1191
1193 env, env->FindClass("android/media/Image"));
1195 FML_LOG(ERROR) <<
"Could not locate Image class";
1196 return false;
1197 }
1198
1199
1201
1204 "()Landroid/hardware/HardwareBuffer;");
1205
1206 if (g_image_get_hardware_buffer_method == nullptr) {
1207
1209 }
1210
1212
1213 if (g_image_close_method == nullptr) {
1214 FML_LOG(ERROR) <<
"Could not locate close on Image class";
1215 return false;
1216 }
1217
1218
1221 env, env->FindClass("android/hardware/HardwareBuffer"));
1222
1226 if (g_hardware_buffer_close_method == nullptr) {
1227
1229 }
1230 } else {
1231
1233 }
1234
1237 "([Ljava/lang/String;)[Ljava/lang/String;");
1238
1239 if (g_compute_platform_resolved_locale_method == nullptr) {
1240 FML_LOG(ERROR) <<
"Could not locate computePlatformResolvedLocale method";
1241 return false;
1242 }
1243
1246
1247 if (g_request_dart_deferred_library_method == nullptr) {
1248 FML_LOG(ERROR) <<
"Could not locate requestDartDeferredLibrary method";
1249 return false;
1250 }
1251
1253 env, env->FindClass("java/lang/Long"));
1255 FML_LOG(ERROR) <<
"Could not locate java.lang.Long class";
1256 return false;
1257 }
1258
1259
1261 env, env->FindClass("android/graphics/Path"));
1263 FML_LOG(ERROR) <<
"Could not locate android.graphics.Path class";
1264 return false;
1265 }
1266
1268 if (path_constructor == nullptr) {
1269 FML_LOG(ERROR) <<
"Could not locate android.graphics.Path constructor";
1270 return false;
1271 }
1272
1274 path_class->obj(),
"setFillType",
"(Landroid/graphics/Path$FillType;)V");
1275 if (path_set_fill_type_method == nullptr) {
1277 << "Could not locate android.graphics.Path.setFillType method";
1278 return false;
1279 }
1280
1282 if (path_move_to_method == nullptr) {
1283 FML_LOG(ERROR) <<
"Could not locate android.graphics.Path.moveTo method";
1284 return false;
1285 }
1287 if (path_line_to_method == nullptr) {
1288 FML_LOG(ERROR) <<
"Could not locate android.graphics.Path.lineTo method";
1289 return false;
1290 }
1292 env->GetMethodID(
path_class->obj(),
"quadTo",
"(FFFF)V");
1293 if (path_quad_to_method == nullptr) {
1294 FML_LOG(ERROR) <<
"Could not locate android.graphics.Path.quadTo method";
1295 return false;
1296 }
1298 env->GetMethodID(
path_class->obj(),
"cubicTo",
"(FFFFFF)V");
1299 if (path_cubic_to_method == nullptr) {
1300 FML_LOG(ERROR) <<
"Could not locate android.graphics.Path.cubicTo method";
1301 return false;
1302 }
1303
1305
1307 env->GetMethodID(
path_class->obj(),
"conicTo",
"(FFFFF)V");
1308 if (path_conic_to_method == nullptr) {
1309
1311 }
1313 if (path_close_method == nullptr) {
1314 FML_LOG(ERROR) <<
"Could not locate android.graphics.Path.close method";
1315 return false;
1316 }
1317
1319 env, env->FindClass("android/graphics/Path$FillType"));
1321 FML_LOG(ERROR) <<
"Could not locate android.graphics.Path$FillType class";
1322 return false;
1323 }
1324
1327 "Landroid/graphics/Path$FillType;");
1328 if (g_path_fill_type_winding_field == nullptr) {
1329 FML_LOG(ERROR) <<
"Could not locate Path.FillType.WINDING field";
1330 return false;
1331 }
1332
1335 "Landroid/graphics/Path$FillType;");
1336 if (g_path_fill_type_even_odd_field == nullptr) {
1337 FML_LOG(ERROR) <<
"Could not locate Path.FillType.EVEN_ODD field";
1338 return false;
1339 }
1340
1342}
1343
1344PlatformViewAndroidJNIImpl::PlatformViewAndroidJNIImpl(
1346 : java_object_(java_object) {}
1347
1348PlatformViewAndroidJNIImpl::~PlatformViewAndroidJNIImpl() = default;
1349
1350void PlatformViewAndroidJNIImpl::FlutterViewHandlePlatformMessage(
1351 std::unique_ptr<flutter::PlatformMessage>
message,
1352 int responseId) {
1353
1355
1356 auto java_object = java_object_.get(env);
1357 if (java_object.is_null()) {
1358 return;
1359 }
1360
1363
1366 env, env->NewDirectByteBuffer(
1367 const_cast<uint8_t*
>(
message->data().GetMapping()),
1369
1371 env->CallVoidMethod(java_object.obj(), g_handle_platform_message_method,
1372 java_channel.
obj(), message_array.obj(), responseId,
1373 reinterpret_cast<jlong
>(mapping.
Release()));
1374 } else {
1375 env->CallVoidMethod(java_object.obj(), g_handle_platform_message_method,
1376 java_channel.
obj(),
nullptr, responseId,
nullptr);
1377 }
1378
1380}
1381
1382void PlatformViewAndroidJNIImpl::FlutterViewSetApplicationLocale(
1383 std::string locale) {
1385
1386 auto java_object = java_object_.get(env);
1387 if (java_object.is_null()) {
1388 return;
1389 }
1390
1393
1394 env->CallVoidMethod(java_object.obj(), g_set_application_locale_method,
1396
1398}
1399
1400void PlatformViewAndroidJNIImpl::FlutterViewSetSemanticsTreeEnabled(
1401 bool enabled) {
1403
1404 auto java_object = java_object_.get(env);
1405 if (java_object.is_null()) {
1406 return;
1407 }
1408
1409 env->CallVoidMethod(java_object.obj(), g_set_semantics_tree_enabled_method,
1410 enabled);
1411
1413}
1414
1415void PlatformViewAndroidJNIImpl::FlutterViewHandlePlatformMessageResponse(
1416 int responseId,
1417 std::unique_ptr<fml::Mapping>
data) {
1418
1419
1421
1422 auto java_object = java_object_.get(env);
1423 if (java_object.is_null()) {
1424
1425
1426 return;
1427 }
1428 if (
data ==
nullptr) {
1429 env->CallVoidMethod(java_object.obj(),
1430 g_handle_platform_message_response_method, responseId,
1431 nullptr);
1432 } else {
1433
1435 env, env->NewDirectByteBuffer(
const_cast<uint8_t*
>(
data->GetMapping()),
1437
1438 env->CallVoidMethod(java_object.obj(),
1439 g_handle_platform_message_response_method, responseId,
1440 data_array.obj());
1441 }
1442
1444}
1445
1446double PlatformViewAndroidJNIImpl::FlutterViewGetScaledFontSize(
1448 int configuration_id) const {
1450
1451 auto java_object = java_object_.get(env);
1452 if (java_object.is_null()) {
1453 return -3;
1454 }
1455
1456 const jfloat scaledSize = env->CallFloatMethod(
1457 java_object.obj(), g_get_scaled_font_size_method,
1458 static_cast<jfloat
>(
font_size),
static_cast<jint
>(configuration_id));
1460 return static_cast<double>(scaledSize);
1461}
1462
1463void PlatformViewAndroidJNIImpl::FlutterViewUpdateSemantics(
1464 std::vector<uint8_t> buffer,
1465 std::vector<std::string> strings,
1466 std::vector<std::vector<uint8_t>> string_attribute_args) {
1468
1469 auto java_object = java_object_.get(env);
1470 if (java_object.is_null()) {
1471 return;
1472 }
1473
1475 env, env->NewDirectByteBuffer(
buffer.data(),
buffer.size()));
1480
1481 env->CallVoidMethod(java_object.obj(), g_update_semantics_method,
1482 direct_buffer.obj(), jstrings.
obj(),
1483 jstring_attribute_args.
obj());
1484
1486}
1487
1488void PlatformViewAndroidJNIImpl::FlutterViewUpdateCustomAccessibilityActions(
1489 std::vector<uint8_t> actions_buffer,
1490 std::vector<std::string> strings) {
1492
1493 auto java_object = java_object_.get(env);
1494 if (java_object.is_null()) {
1495 return;
1496 }
1497
1499 env,
1500 env->NewDirectByteBuffer(actions_buffer.data(), actions_buffer.size()));
1501
1504
1505 env->CallVoidMethod(java_object.obj(),
1506 g_update_custom_accessibility_actions_method,
1507 direct_actions_buffer.obj(), jstrings.
obj());
1508
1510}
1511
1512void PlatformViewAndroidJNIImpl::FlutterViewOnFirstFrame() {
1514
1515 auto java_object = java_object_.get(env);
1516 if (java_object.is_null()) {
1517 return;
1518 }
1519
1520 env->CallVoidMethod(java_object.obj(), g_on_first_frame_method);
1521
1523}
1524
1525void PlatformViewAndroidJNIImpl::FlutterViewOnPreEngineRestart() {
1527
1528 auto java_object = java_object_.get(env);
1529 if (java_object.is_null()) {
1530 return;
1531 }
1532
1533 env->CallVoidMethod(java_object.obj(), g_on_engine_restart_method);
1534
1536}
1537
1538void PlatformViewAndroidJNIImpl::SurfaceTextureAttachToGLContext(
1539 JavaLocalRef surface_texture,
1540 int textureId) {
1542
1543 if (surface_texture.is_null()) {
1544 return;
1545 }
1546
1548 env, env->CallObjectMethod(surface_texture.obj(),
1549 g_java_weak_reference_get_method));
1550
1551 if (surface_texture_local_ref.is_null()) {
1552 return;
1553 }
1554
1555 env->CallVoidMethod(surface_texture_local_ref.obj(),
1556 g_attach_to_gl_context_method, textureId);
1557
1559}
1560
1561bool PlatformViewAndroidJNIImpl::SurfaceTextureShouldUpdate(
1562 JavaLocalRef surface_texture) {
1564
1565 if (surface_texture.is_null()) {
1566 return false;
1567 }
1568
1570 env, env->CallObjectMethod(surface_texture.obj(),
1571 g_java_weak_reference_get_method));
1572 if (surface_texture_local_ref.is_null()) {
1573 return false;
1574 }
1575
1576 jboolean shouldUpdate = env->CallBooleanMethod(
1577 surface_texture_local_ref.obj(), g_surface_texture_wrapper_should_update);
1578
1580
1581 return shouldUpdate;
1582}
1583
1584void PlatformViewAndroidJNIImpl::SurfaceTextureUpdateTexImage(
1585 JavaLocalRef surface_texture) {
1587
1588 if (surface_texture.is_null()) {
1589 return;
1590 }
1591
1593 env, env->CallObjectMethod(surface_texture.obj(),
1594 g_java_weak_reference_get_method));
1595 if (surface_texture_local_ref.is_null()) {
1596 return;
1597 }
1598
1599 env->CallVoidMethod(surface_texture_local_ref.obj(),
1600 g_update_tex_image_method);
1601
1603}
1604
1605SkM44 PlatformViewAndroidJNIImpl::SurfaceTextureGetTransformMatrix(
1606 JavaLocalRef surface_texture) {
1608
1609 if (surface_texture.is_null()) {
1610 return {};
1611 }
1612
1614 env, env->CallObjectMethod(surface_texture.obj(),
1615 g_java_weak_reference_get_method));
1616 if (surface_texture_local_ref.is_null()) {
1617 return {};
1618 }
1619
1621 env, env->NewFloatArray(16));
1622
1623 env->CallVoidMethod(surface_texture_local_ref.obj(),
1624 g_get_transform_matrix_method, transformMatrix.obj());
1626
1627 float* m = env->GetFloatArrayElements(transformMatrix.obj(), nullptr);
1628
1629 static_assert(sizeof(SkScalar) == sizeof(float));
1630 const auto transform = SkM44::ColMajor(m);
1631
1632 env->ReleaseFloatArrayElements(transformMatrix.obj(), m, JNI_ABORT);
1633
1635}
1636
1637void PlatformViewAndroidJNIImpl::SurfaceTextureDetachFromGLContext(
1638 JavaLocalRef surface_texture) {
1640
1641 if (surface_texture.is_null()) {
1642 return;
1643 }
1644
1646 env, env->CallObjectMethod(surface_texture.obj(),
1647 g_java_weak_reference_get_method));
1648 if (surface_texture_local_ref.is_null()) {
1649 return;
1650 }
1651
1652 env->CallVoidMethod(surface_texture_local_ref.obj(),
1653 g_detach_from_gl_context_method);
1654
1656}
1657
1659PlatformViewAndroidJNIImpl::ImageProducerTextureEntryAcquireLatestImage(
1660 JavaLocalRef image_producer_texture_entry) {
1662
1663 if (image_producer_texture_entry.is_null()) {
1664
1666 }
1667
1668
1669
1671 env, env->CallObjectMethod(image_producer_texture_entry.obj(),
1672 g_java_weak_reference_get_method));
1673
1674 if (image_producer_texture_entry_local_ref.is_null()) {
1675
1677 }
1678
1680 env, env->CallObjectMethod(image_producer_texture_entry_local_ref.obj(),
1681 g_acquire_latest_image_method));
1683 return r;
1684 }
1685
1687}
1688
1689JavaLocalRef PlatformViewAndroidJNIImpl::ImageGetHardwareBuffer(
1690 JavaLocalRef
image) {
1691 FML_CHECK(g_image_get_hardware_buffer_method !=
nullptr);
1693 if (
image.is_null()) {
1694
1696 }
1698 env,
1699 env->CallObjectMethod(
image.obj(), g_image_get_hardware_buffer_method));
1701 return r;
1702}
1703
1704void PlatformViewAndroidJNIImpl::ImageClose(JavaLocalRef
image) {
1706 if (
image.is_null()) {
1707 return;
1708 }
1709 env->CallVoidMethod(
image.obj(), g_image_close_method);
1711}
1712
1713void PlatformViewAndroidJNIImpl::HardwareBufferClose(
1714 JavaLocalRef hardware_buffer) {
1715 FML_CHECK(g_hardware_buffer_close_method !=
nullptr);
1717 if (hardware_buffer.is_null()) {
1718 return;
1719 }
1720 env->CallVoidMethod(hardware_buffer.obj(), g_hardware_buffer_close_method);
1722}
1723
1724void PlatformViewAndroidJNIImpl::FlutterViewOnDisplayPlatformView(
1730 int viewWidth,
1731 int viewHeight,
1732 MutatorsStack mutators_stack) {
1734 auto java_object = java_object_.get(env);
1735 if (java_object.is_null()) {
1736 return;
1737 }
1738
1740 g_mutators_stack_init_method);
1741
1742 std::vector<std::shared_ptr<Mutator>>::const_iterator iter =
1743 mutators_stack.Begin();
1744 while (iter != mutators_stack.End()) {
1745 switch ((*iter)->GetType()) {
1746 case MutatorType::kTransform: {
1747 const DlMatrix& matrix = (*iter)->GetMatrix();
1749 matrix.m[0], matrix.m[4], matrix.m[12],
1750 matrix.m[1], matrix.m[5], matrix.m[13],
1751 matrix.m[3], matrix.m[7], matrix.m[15],
1752 };
1754 env, env->NewFloatArray(9));
1755
1756 env->SetFloatArrayRegion(transformMatrix.obj(), 0, 9, matrix_array);
1757 env->CallVoidMethod(mutatorsStack,
1758 g_mutators_stack_push_transform_method,
1759 transformMatrix.obj());
1760 break;
1761 }
1762 case MutatorType::kClipRect: {
1763 const DlRect& rect = (*iter)->GetRect();
1764 env->CallVoidMethod(mutatorsStack,
1765 g_mutators_stack_push_cliprect_method,
1766 static_cast<int>(rect.GetLeft()),
1767 static_cast<int>(rect.GetTop()),
1768 static_cast<int>(rect.GetRight()),
1769 static_cast<int>(rect.GetBottom()));
1770 break;
1771 }
1772 case MutatorType::kClipRRect: {
1774 const DlRect& rect = rrect.GetBounds();
1776 SkScalar radiis[8] = {
1778 radii.top_right.width, radii.top_right.height,
1779 radii.bottom_right.width, radii.bottom_right.height,
1780 radii.bottom_left.width, radii.bottom_left.height,
1781 };
1783 env, env->NewFloatArray(8));
1784 env->SetFloatArrayRegion(radiisArray.obj(), 0, 8, radiis);
1785 env->CallVoidMethod(mutatorsStack,
1786 g_mutators_stack_push_cliprrect_method,
1787 static_cast<int>(rect.GetLeft()),
1788 static_cast<int>(rect.GetTop()),
1789 static_cast<int>(rect.GetRight()),
1790 static_cast<int>(rect.GetBottom()),
1791 radiisArray.obj());
1792 break;
1793 }
1794 case MutatorType::kClipRSE: {
1795 const DlRoundRect& rrect = (*iter)->GetRSEApproximation();
1796 const DlRect& rect = rrect.GetBounds();
1798 SkScalar radiis[8] = {
1800 radii.top_right.width, radii.top_right.height,
1801 radii.bottom_right.width, radii.bottom_right.height,
1802 radii.bottom_left.width, radii.bottom_left.height,
1803 };
1805 env, env->NewFloatArray(8));
1806 env->SetFloatArrayRegion(radiisArray.obj(), 0, 8, radiis);
1807 env->CallVoidMethod(mutatorsStack,
1808 g_mutators_stack_push_cliprrect_method,
1809 static_cast<int>(rect.GetLeft()),
1810 static_cast<int>(rect.GetTop()),
1811 static_cast<int>(rect.GetRight()),
1812 static_cast<int>(rect.GetBottom()),
1813 radiisArray.obj());
1814 break;
1815 }
1816
1817
1818 case MutatorType::kClipPath:
1819 case MutatorType::kOpacity:
1820 case MutatorType::kBackdropFilter:
1821 case MutatorType::kBackdropClipRect:
1822 case MutatorType::kBackdropClipRRect:
1823 case MutatorType::kBackdropClipRSuperellipse:
1824 case MutatorType::kBackdropClipPath:
1825 break;
1826 }
1827 ++iter;
1828 }
1829
1830 env->CallVoidMethod(java_object.obj(), g_on_display_platform_view_method,
1832 mutatorsStack);
1833
1835}
1836
1837void PlatformViewAndroidJNIImpl::FlutterViewDisplayOverlaySurface(
1838 int surface_id,
1844
1845 auto java_object = java_object_.get(env);
1846 if (java_object.is_null()) {
1847 return;
1848 }
1849
1850 env->CallVoidMethod(java_object.obj(), g_on_display_overlay_surface_method,
1852
1854}
1855
1856void PlatformViewAndroidJNIImpl::FlutterViewBeginFrame() {
1858
1859 auto java_object = java_object_.get(env);
1860 if (java_object.is_null()) {
1861 return;
1862 }
1863
1864 env->CallVoidMethod(java_object.obj(), g_on_begin_frame_method);
1865
1867}
1868
1869void PlatformViewAndroidJNIImpl::FlutterViewEndFrame() {
1871
1872 auto java_object = java_object_.get(env);
1873 if (java_object.is_null()) {
1874 return;
1875 }
1876
1877 env->CallVoidMethod(java_object.obj(), g_on_end_frame_method);
1878
1880}
1881
1882std::unique_ptr<PlatformViewAndroidJNI::OverlayMetadata>
1883PlatformViewAndroidJNIImpl::FlutterViewCreateOverlaySurface() {
1885
1886 auto java_object = java_object_.get(env);
1887 if (java_object.is_null()) {
1888 return nullptr;
1889 }
1890
1892 env, env->CallObjectMethod(java_object.obj(),
1893 g_create_overlay_surface_method));
1895
1896 if (overlay.is_null()) {
1897 return std::make_unique<PlatformViewAndroidJNI::OverlayMetadata>(0,
1898 nullptr);
1899 }
1900
1901 jint overlay_id =
1902 env->CallIntMethod(overlay.obj(), g_overlay_surface_id_method);
1903
1904 jobject overlay_surface =
1905 env->CallObjectMethod(overlay.obj(), g_overlay_surface_surface_method);
1906
1907 auto overlay_window = fml::MakeRefCounted<AndroidNativeWindow>(
1908 ANativeWindow_fromSurface(env, overlay_surface));
1909
1910 return std::make_unique<PlatformViewAndroidJNI::OverlayMetadata>(
1911 overlay_id, std::move(overlay_window));
1912}
1913
1914void PlatformViewAndroidJNIImpl::FlutterViewDestroyOverlaySurfaces() {
1916
1917 auto java_object = java_object_.get(env);
1918 if (java_object.is_null()) {
1919 return;
1920 }
1921
1922 env->CallVoidMethod(java_object.obj(), g_destroy_overlay_surfaces_method);
1923
1925}
1926
1927std::unique_ptr<std::vector<std::string>>
1928PlatformViewAndroidJNIImpl::FlutterViewComputePlatformResolvedLocale(
1929 std::vector<std::string> supported_locales_data) {
1931
1932 std::unique_ptr<std::vector<std::string>> out =
1933 std::make_unique<std::vector<std::string>>();
1934
1935 auto java_object = java_object_.get(env);
1936 if (java_object.is_null()) {
1937 return out;
1938 }
1941 jobjectArray result = static_cast<jobjectArray>(env->CallObjectMethod(
1942 java_object.obj(), g_compute_platform_resolved_locale_method,
1943 j_locales_data.
obj()));
1944
1946
1947 int length = env->GetArrayLength(result);
1950 env,
static_cast<jstring
>(env->GetObjectArrayElement(result,
i))));
1951 }
1952 return out;
1953}
1954
1955double PlatformViewAndroidJNIImpl::GetDisplayRefreshRate() {
1957
1958 auto java_object = java_object_.get(env);
1959 if (java_object.is_null()) {
1960 return kUnknownDisplayRefreshRate;
1961 }
1962
1964 env, env->GetObjectClass(java_object.obj()));
1965 if (clazz.is_null()) {
1966 return kUnknownDisplayRefreshRate;
1967 }
1968
1969 jfieldID fid = env->GetStaticFieldID(clazz.obj(), "refreshRateFPS", "F");
1970 return static_cast<double>(env->GetStaticFloatField(clazz.obj(), fid));
1971}
1972
1973double PlatformViewAndroidJNIImpl::GetDisplayWidth() {
1975
1976 auto java_object = java_object_.get(env);
1977 if (java_object.is_null()) {
1978 return -1;
1979 }
1980
1982 env, env->GetObjectClass(java_object.obj()));
1983 if (clazz.is_null()) {
1984 return -1;
1985 }
1986
1987 jfieldID fid = env->GetStaticFieldID(clazz.obj(), "displayWidth", "F");
1988 return static_cast<double>(env->GetStaticFloatField(clazz.obj(), fid));
1989}
1990
1991double PlatformViewAndroidJNIImpl::GetDisplayHeight() {
1993
1994 auto java_object = java_object_.get(env);
1995 if (java_object.is_null()) {
1996 return -1;
1997 }
1998
2000 env, env->GetObjectClass(java_object.obj()));
2001 if (clazz.is_null()) {
2002 return -1;
2003 }
2004
2005 jfieldID fid = env->GetStaticFieldID(clazz.obj(), "displayHeight", "F");
2006 return static_cast<double>(env->GetStaticFloatField(clazz.obj(), fid));
2007}
2008
2009double PlatformViewAndroidJNIImpl::GetDisplayDensity() {
2011
2012 auto java_object = java_object_.get(env);
2013 if (java_object.is_null()) {
2014 return -1;
2015 }
2016
2018 env, env->GetObjectClass(java_object.obj()));
2019 if (clazz.is_null()) {
2020 return -1;
2021 }
2022
2023 jfieldID fid = env->GetStaticFieldID(clazz.obj(), "displayDensity", "F");
2024 return static_cast<double>(env->GetStaticFloatField(clazz.obj(), fid));
2025}
2026
2027bool PlatformViewAndroidJNIImpl::RequestDartDeferredLibrary(
2028 int loading_unit_id) {
2030
2031 auto java_object = java_object_.get(env);
2032 if (java_object.is_null()) {
2033 return true;
2034 }
2035
2036 env->CallVoidMethod(java_object.obj(), g_request_dart_deferred_library_method,
2037 loading_unit_id);
2038
2040 return true;
2041}
2042
2043
2044
2045ASurfaceTransaction* PlatformViewAndroidJNIImpl::createTransaction() {
2047
2048 auto java_object = java_object_.get(env);
2049 if (java_object.is_null()) {
2050 return nullptr;
2051 }
2052
2054 env,
2055 env->CallObjectMethod(java_object.obj(), g_create_transaction_method));
2056 if (transaction.is_null()) {
2057 return nullptr;
2058 }
2060
2062 env, transaction.obj());
2063}
2064
2065void PlatformViewAndroidJNIImpl::swapTransaction() {
2067
2068 auto java_object = java_object_.get(env);
2069 if (java_object.is_null()) {
2070 return;
2071 }
2072
2073 env->CallVoidMethod(java_object.obj(), g_swap_transaction_method);
2074
2076}
2077
2078void PlatformViewAndroidJNIImpl::applyTransaction() {
2080
2081 auto java_object = java_object_.get(env);
2082 if (java_object.is_null()) {
2083 return;
2084 }
2085
2086 env->CallVoidMethod(java_object.obj(), g_apply_transaction_method);
2087
2089}
2090
2091std::unique_ptr<PlatformViewAndroidJNI::OverlayMetadata>
2092PlatformViewAndroidJNIImpl::createOverlaySurface2() {
2094
2095 auto java_object = java_object_.get(env);
2096 if (java_object.is_null()) {
2097 return nullptr;
2098 }
2099
2101 env, env->CallObjectMethod(java_object.obj(),
2102 g_create_overlay_surface2_method));
2104
2105 if (overlay.is_null()) {
2106 return std::make_unique<PlatformViewAndroidJNI::OverlayMetadata>(0,
2107 nullptr);
2108 }
2109
2110 jint overlay_id =
2111 env->CallIntMethod(overlay.obj(), g_overlay_surface_id_method);
2112
2113 jobject overlay_surface =
2114 env->CallObjectMethod(overlay.obj(), g_overlay_surface_surface_method);
2115
2116 auto overlay_window = fml::MakeRefCounted<AndroidNativeWindow>(
2117 ANativeWindow_fromSurface(env, overlay_surface));
2118
2119 return std::make_unique<PlatformViewAndroidJNI::OverlayMetadata>(
2120 overlay_id, std::move(overlay_window));
2121}
2122
2123void PlatformViewAndroidJNIImpl::destroyOverlaySurface2() {
2125
2126 auto java_object = java_object_.get(env);
2127 if (java_object.is_null()) {
2128 return;
2129 }
2130
2131 env->CallVoidMethod(java_object.obj(), g_destroy_overlay_surface2_method);
2132
2134}
2135
2136namespace {
2138 public:
2139 explicit AndroidPathReceiver(JNIEnv* env)
2140 : env_(env),
2142
2143 void SetFillType(DlPathFillType
type) {
2144 jfieldID fill_type_field_id;
2146 case DlPathFillType::kOdd:
2148 break;
2149 case DlPathFillType::kNonZero:
2151 break;
2152 default:
2153
2154
2155 return;
2156 }
2157
2158
2159
2163 fill_type_field_id));
2166
2167
2168 env_->CallVoidMethod(android_path_, path_set_fill_type_method,
2169 fill_type_enum.
obj());
2171 }
2172
2173 void MoveTo(
const DlPoint&
p2,
bool will_be_closed)
override {
2174 env_->CallVoidMethod(android_path_, path_move_to_method,
p2.x,
p2.y);
2175 }
2176 void LineTo(
const DlPoint&
p2)
override {
2177 env_->CallVoidMethod(android_path_, path_line_to_method,
p2.x,
p2.y);
2178 }
2179 void QuadTo(
const DlPoint& cp,
const DlPoint&
p2)
override {
2180 env_->CallVoidMethod(android_path_, path_quad_to_method,
2181 cp.x, cp.y,
p2.x,
p2.y);
2182 }
2183 bool ConicTo(
const DlPoint& cp,
const DlPoint&
p2, DlScalar
weight)
override {
2184 if (!path_conic_to_method) {
2185 return false;
2186 }
2187 env_->CallVoidMethod(android_path_, path_conic_to_method,
2189 return true;
2190 };
2191 void CubicTo(
const DlPoint& cp1,
2192 const DlPoint& cp2,
2193 const DlPoint&
p2)
override {
2194 env_->CallVoidMethod(android_path_, path_cubic_to_method,
2195 cp1.x, cp1.y, cp2.x, cp2.y,
p2.x,
p2.y);
2196 }
2197 void Close()
override {
2198 env_->CallVoidMethod(android_path_, path_close_method);
2199 }
2200
2201 jobject TakePath() const { return android_path_; }
2202
2203 private:
2204 JNIEnv* env_;
2205 jobject android_path_;
2206};
2207}
2208
2209void PlatformViewAndroidJNIImpl::onDisplayPlatformView2(
2215 int32_t viewWidth,
2216 int32_t viewHeight,
2217 MutatorsStack mutators_stack) {
2219 auto java_object = java_object_.get(env);
2220 if (java_object.is_null()) {
2221 return;
2222 }
2223
2225 g_mutators_stack_init_method);
2226
2227 std::vector<std::shared_ptr<Mutator>>::const_iterator iter =
2228 mutators_stack.Begin();
2229 while (iter != mutators_stack.End()) {
2230 switch ((*iter)->GetType()) {
2231 case MutatorType::kTransform: {
2232 const DlMatrix& matrix = (*iter)->GetMatrix();
2234 matrix.m[0], matrix.m[4], matrix.m[12],
2235 matrix.m[1], matrix.m[5], matrix.m[13],
2236 matrix.m[3], matrix.m[7], matrix.m[15],
2237 };
2239 env, env->NewFloatArray(9));
2240
2241 env->SetFloatArrayRegion(transformMatrix.obj(), 0, 9, matrix_array);
2242 env->CallVoidMethod(mutatorsStack,
2243 g_mutators_stack_push_transform_method,
2244 transformMatrix.obj());
2245 break;
2246 }
2247 case MutatorType::kClipRect: {
2248 const DlRect& rect = (*iter)->GetRect();
2249 env->CallVoidMethod(mutatorsStack,
2250 g_mutators_stack_push_cliprect_method,
2251 static_cast<int>(rect.GetLeft()),
2252 static_cast<int>(rect.GetTop()),
2253 static_cast<int>(rect.GetRight()),
2254 static_cast<int>(rect.GetBottom()));
2255 break;
2256 }
2257 case MutatorType::kClipRRect: {
2259 const DlRect& rect = rrect.GetBounds();
2261 SkScalar radiis[8] = {
2263 radii.top_right.width, radii.top_right.height,
2264 radii.bottom_right.width, radii.bottom_right.height,
2265 radii.bottom_left.width, radii.bottom_left.height,
2266 };
2268 env, env->NewFloatArray(8));
2269 env->SetFloatArrayRegion(radiisArray.obj(), 0, 8, radiis);
2270 env->CallVoidMethod(mutatorsStack,
2271 g_mutators_stack_push_cliprrect_method,
2272 static_cast<int>(rect.GetLeft()),
2273 static_cast<int>(rect.GetTop()),
2274 static_cast<int>(rect.GetRight()),
2275 static_cast<int>(rect.GetBottom()),
2276 radiisArray.obj());
2277 break;
2278 }
2279 case MutatorType::kClipRSE: {
2280 const DlRoundRect& rrect = (*iter)->GetRSEApproximation();
2281 const DlRect& rect = rrect.GetBounds();
2283 SkScalar radiis[8] = {
2285 radii.top_right.width, radii.top_right.height,
2286 radii.bottom_right.width, radii.bottom_right.height,
2287 radii.bottom_left.width, radii.bottom_left.height,
2288 };
2290 env, env->NewFloatArray(8));
2291 env->SetFloatArrayRegion(radiisArray.obj(), 0, 8, radiis);
2292 env->CallVoidMethod(mutatorsStack,
2293 g_mutators_stack_push_cliprrect_method,
2294 static_cast<int>(rect.GetLeft()),
2295 static_cast<int>(rect.GetTop()),
2296 static_cast<int>(rect.GetRight()),
2297 static_cast<int>(rect.GetBottom()),
2298 radiisArray.obj());
2299 break;
2300 }
2301 case MutatorType::kOpacity: {
2302 float opacity = (*iter)->GetAlphaFloat();
2303 env->CallVoidMethod(mutatorsStack, g_mutators_stack_push_opacity_method,
2304 opacity);
2305 break;
2306 }
2307 case MutatorType::kClipPath: {
2308 auto& dlPath = (*iter)->GetPath();
2309
2310
2311
2312
2316
2317
2318 AndroidPathReceiver receiver(env);
2319 receiver.SetFillType(dlPath.GetFillType());
2320
2321
2322
2323
2324 dlPath.Dispatch(receiver);
2325
2326 env->CallVoidMethod(mutatorsStack,
2327 g_mutators_stack_push_clippath_method,
2328 receiver.TakePath());
2329 break;
2330 }
2331
2332
2333 case MutatorType::kBackdropFilter:
2334 case MutatorType::kBackdropClipRect:
2335 case MutatorType::kBackdropClipRRect:
2336 case MutatorType::kBackdropClipRSuperellipse:
2337 case MutatorType::kBackdropClipPath:
2338 break;
2339 }
2340 ++iter;
2341 }
2342
2343 env->CallVoidMethod(java_object.obj(), g_on_display_platform_view2_method,
2345 mutatorsStack);
2346
2348}
2349
2350void PlatformViewAndroidJNIImpl::hidePlatformView2(int32_t
view_id) {
2352 auto java_object = java_object_.get(env);
2353 if (java_object.is_null()) {
2354 return;
2355 }
2356
2357 env->CallVoidMethod(java_object.obj(), g_hide_platform_view2_method,
view_id);
2358}
2359
2360void PlatformViewAndroidJNIImpl::onEndFrame2() {
2362
2363 auto java_object = java_object_.get(env);
2364 if (java_object.is_null()) {
2365 return;
2366 }
2367
2368 env->CallVoidMethod(java_object.obj(), g_on_end_frame2_method);
2369
2371}
2372
2373void PlatformViewAndroidJNIImpl::showOverlaySurface2() {
2375
2376 auto java_object = java_object_.get(env);
2377 if (java_object.is_null()) {
2378 return;
2379 }
2380
2381 env->CallVoidMethod(java_object.obj(), g_show_overlay_surface2_method);
2383}
2384
2385void PlatformViewAndroidJNIImpl::hideOverlaySurface2() {
2387
2388 auto java_object = java_object_.get(env);
2389 if (java_object.is_null()) {
2390 return;
2391 }
2392
2393 env->CallVoidMethod(java_object.obj(), g_hide_overlay_surface2_method);
2395}
2396
2397void PlatformViewAndroidJNIImpl::MaybeResizeSurfaceView(int32_t
width,
2400
2401 auto java_object = java_object_.get(env);
2402 if (java_object.is_null()) {
2403 return;
2404 }
2405
2406 env->CallVoidMethod(java_object.obj(), g_maybe_resize_surface_view,
width,
2409}
2410
2411}
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)
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)
std::shared_ptr< const fml::Mapping > data