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
382 static_cast<double>(devicePixelRatio),
383 static_cast<double>(physicalWidth),
384 static_cast<double>(physicalHeight),
385 static_cast<double>(physicalMinWidth),
386 static_cast<double>(physicalMaxWidth),
387 static_cast<double>(
388 physicalMinHeight),
389 static_cast<double>(
390 physicalMaxHeight),
391 static_cast<double>(physicalPaddingTop),
392 static_cast<double>(physicalPaddingRight),
393 static_cast<double>(physicalPaddingBottom),
394 static_cast<double>(physicalPaddingLeft),
395 static_cast<double>(physicalViewInsetTop),
396 static_cast<double>(
397 physicalViewInsetRight),
398 static_cast<double>(
399 physicalViewInsetBottom),
400 static_cast<double>(physicalViewInsetLeft),
401 static_cast<double>(
402 systemGestureInsetTop),
403 static_cast<double>(
404 systemGestureInsetRight),
405 static_cast<double>(
406 systemGestureInsetBottom),
407 static_cast<double>(
408 systemGestureInsetLeft),
409 static_cast<double>(physicalTouchSlop),
410 displayFeaturesBounds,
411 displayFeaturesType,
412 displayFeaturesState,
413 0,
414 static_cast<double>(
415 physicalDisplayCornerRadiusTopLeft),
416 static_cast<double>(
417 physicalDisplayCornerRadiusTopRight),
418 static_cast<double>(
419 physicalDisplayCornerRadiusBottomRight),
420 static_cast<double>(
421 physicalDisplayCornerRadiusBottomLeft),
422 };
423
425 kFlutterImplicitViewId, metrics);
426}
427
429 jobject jcaller,
430 jlong shell_holder) {
432}
433
435 jobject jcaller,
436 jlong shell_holder) {
438}
439
440static jobject
GetBitmap(JNIEnv* env, jobject jcaller, jlong shell_holder) {
442 Rasterizer::ScreenshotType::UncompressedImage, false);
443 if (screenshot.data == nullptr) {
444 return nullptr;
445 }
446
447 jstring argb = env->NewStringUTF("ARGB_8888");
448 if (argb == nullptr) {
449 return nullptr;
450 }
451
452 jobject bitmap_config = env->CallStaticObjectMethod(
454 if (bitmap_config == nullptr) {
455 return nullptr;
456 }
457
458 auto bitmap = env->CallStaticObjectMethod(
460 screenshot.frame_size.width, screenshot.frame_size.height, bitmap_config);
461
463 env,
464 env->NewDirectByteBuffer(const_cast<uint8_t*>(screenshot.data->bytes()),
465 screenshot.data->size()));
466
467 env->CallVoidMethod(
bitmap, g_bitmap_copy_pixels_from_buffer_method,
469
471}
472
474 jobject jcaller,
475 jlong shell_holder,
478 jint position,
479 jint responseId) {
481 env,
484 position,
485 responseId
486 );
487}
488
490 jobject jcaller,
491 jlong shell_holder,
493 jint responseId) {
495 env,
497 responseId
498 );
499}
500
502 jobject jcaller,
503 jlong message_data) {
504
505 free(reinterpret_cast<void*>(message_data));
506}
507
509 jobject jcaller,
510 jlong shell_holder,
511 jobject buffer,
512 jint position) {
513 uint8_t*
data =
static_cast<uint8_t*
>(env->GetDirectBufferAddress(buffer));
514 auto packet = std::make_unique<flutter::PointerDataPacket>(data, position);
516 std::move(packet));
517}
518
520 jobject jcaller,
521 jlong shell_holder,
522 jint id,
525 jint args_position) {
527 env,
528 id,
531 args_position
532 );
533}
534
536 jobject jcaller,
537 jlong shell_holder,
538 jboolean enabled) {
540}
541
543 jobject jcaller,
544 jlong shell_holder,
545 jint flags) {
547}
548
550 return FlutterMain::Get().GetSettings().enable_software_rendering;
551}
552
554 jobject jcaller,
555 jlong shell_holder,
557 jobject surface_texture) {
561 );
562}
563
565 jobject jcaller,
566 jlong shell_holder,
568 jobject image_texture_entry,
569 jboolean reset_on_background) {
570 ImageExternalTexture::ImageLifecycle lifecycle =
571 reset_on_background ? ImageExternalTexture::ImageLifecycle::kReset
572 : ImageExternalTexture::ImageLifecycle::kKeepAlive;
573
577 lifecycle
578 );
579}
580
582 jobject jcaller,
583 jlong shell_holder,
587}
588
590 jobject jcaller,
591 jlong shell_holder,
595}
596
597static void ScheduleFrame(JNIEnv* env, jobject jcaller, jlong shell_holder) {
599}
600
602 jobject jcaller,
603 jlong shell_holder,
604 jint responseId,
606 jint position) {
607 uint8_t* response_data =
608 static_cast<uint8_t*
>(env->GetDirectBufferAddress(
message));
610 auto mapping = std::make_unique<fml::MallocMapping>(
613 ->InvokePlatformMessageResponseCallback(responseId, std::move(mapping));
614}
615
617 jobject jcaller,
618 jlong shell_holder,
619 jint responseId) {
621 ->InvokePlatformMessageEmptyResponseCallback(responseId);
622}
623
625 jobject obj,
626 jlong shell_holder) {
628}
629
631 jobject obj,
632 jint codePoint) {
633 return u_hasBinaryProperty(codePoint, UProperty::UCHAR_EMOJI);
634}
635
637 jobject obj,
638 jint codePoint) {
639 return u_hasBinaryProperty(codePoint, UProperty::UCHAR_EMOJI_MODIFIER);
640}
641
643 jobject obj,
644 jint codePoint) {
645 return u_hasBinaryProperty(codePoint, UProperty::UCHAR_EMOJI_MODIFIER_BASE);
646}
647
649 jobject obj,
650 jint codePoint) {
651 return u_hasBinaryProperty(codePoint, UProperty::UCHAR_VARIATION_SELECTOR);
652}
653
655 jobject obj,
656 jint codePoint) {
657 return u_hasBinaryProperty(codePoint, UProperty::UCHAR_REGIONAL_INDICATOR);
658}
659
662 bool transient) {
663
664}
665
667 jobject obj,
668 jint jLoadingUnitId,
669 jstring jError,
670 jboolean jTransient) {
673 static_cast<bool>(jTransient));
674}
675
677 jobject obj,
678 jlong shell_holder,
679 jint jLoadingUnitId,
680 jobjectArray jSearchPaths) {
681
682 intptr_t loading_unit_id = static_cast<intptr_t>(jLoadingUnitId);
683 std::vector<std::string> search_paths =
685
686
687
688 void* handle = nullptr;
689 while (handle == nullptr && !search_paths.empty()) {
690 std::string
path = search_paths.back();
691 handle = ::dlopen(
path.c_str(), RTLD_NOW);
692 search_paths.pop_back();
693 }
694 if (handle == nullptr) {
696 "No lib .so found for provided search paths.", true);
697 return;
698 }
701
702
703 std::unique_ptr<const fml::SymbolMapping> data_mapping =
704 std::make_unique<const fml::SymbolMapping>(
705 native_lib, DartSnapshot::kIsolateDataSymbol);
706 std::unique_ptr<const fml::SymbolMapping> instructions_mapping =
707 std::make_unique<const fml::SymbolMapping>(
708 native_lib, DartSnapshot::kIsolateInstructionsSymbol);
709
711 loading_unit_id, std::move(data_mapping),
712 std::move(instructions_mapping));
713}
714
716 jobject obj,
717 jlong shell_holder,
718 jobject jAssetManager,
719 jstring jAssetBundlePath) {
720 auto asset_resolver = std::make_unique<flutter::APKAssetProvider>(
721 env,
722 jAssetManager,
724
726 std::move(asset_resolver),
727 AssetResolver::AssetResolverType::kApkAssetProvider);
728}
729
731 static const JNINativeMethod flutter_jni_methods[] = {
732
733 {
734 .name = "nativeAttach",
735 .signature = "(Lio/flutter/embedding/engine/FlutterJNI;)J",
736 .fnPtr =
reinterpret_cast<void*
>(&
AttachJNI),
737 },
738 {
739 .name = "nativeDestroy",
740 .signature = "(J)V",
741 .fnPtr =
reinterpret_cast<void*
>(&
DestroyJNI),
742 },
743 {
744 .name = "nativeSpawn",
745 .signature = "(JLjava/lang/String;Ljava/lang/String;Ljava/lang/"
746 "String;Ljava/util/List;J)Lio/flutter/"
747 "embedding/engine/FlutterJNI;",
748 .fnPtr =
reinterpret_cast<void*
>(&
SpawnJNI),
749 },
750 {
751 .name = "nativeRunBundleAndSnapshotFromLibrary",
752 .signature = "(JLjava/lang/String;Ljava/lang/String;"
753 "Ljava/lang/String;Landroid/content/res/"
754 "AssetManager;Ljava/util/List;J)V",
756 },
757 {
758 .name = "nativeDispatchEmptyPlatformMessage",
759 .signature = "(JLjava/lang/String;I)V",
761 },
762 {
763 .name = "nativeCleanupMessageData",
764 .signature = "(J)V",
766 },
767 {
768 .name = "nativeDispatchPlatformMessage",
769 .signature = "(JLjava/lang/String;Ljava/nio/ByteBuffer;II)V",
771 },
772 {
773 .name = "nativeInvokePlatformMessageResponseCallback",
774 .signature = "(JILjava/nio/ByteBuffer;I)V",
775 .fnPtr =
777 },
778 {
779 .name = "nativeInvokePlatformMessageEmptyResponseCallback",
780 .signature = "(JI)V",
781 .fnPtr = reinterpret_cast<void*>(
783 },
784 {
785 .name = "nativeNotifyLowMemoryWarning",
786 .signature = "(J)V",
788 },
789
790
791 {
792 .name = "nativeGetBitmap",
793 .signature = "(J)Landroid/graphics/Bitmap;",
794 .fnPtr =
reinterpret_cast<void*
>(&
GetBitmap),
795 },
796 {
797 .name = "nativeSurfaceCreated",
798 .signature = "(JLandroid/view/Surface;)V",
800 },
801 {
802 .name = "nativeSurfaceWindowChanged",
803 .signature = "(JLandroid/view/Surface;)V",
805 },
806 {
807 .name = "nativeSurfaceChanged",
808 .signature = "(JII)V",
810 },
811 {
812 .name = "nativeSurfaceDestroyed",
813 .signature = "(J)V",
815 },
816 {
817 .name = "nativeSetViewportMetrics",
818 .signature = "(JFIIIIIIIIIIIIIII[I[I[IIIIIIIII)V",
820 },
821 {
822 .name = "nativeDispatchPointerDataPacket",
823 .signature = "(JLjava/nio/ByteBuffer;I)V",
825 },
826 {
827 .name = "nativeDispatchSemanticsAction",
828 .signature = "(JIILjava/nio/ByteBuffer;I)V",
830 },
831 {
832 .name = "nativeSetSemanticsEnabled",
833 .signature = "(JZ)V",
835 },
836 {
837 .name = "nativeSetAccessibilityFeatures",
838 .signature = "(JI)V",
840 },
841 {
842 .name = "nativeGetIsSoftwareRenderingEnabled",
843 .signature = "()Z",
845 },
846 {
847 .name = "nativeRegisterTexture",
848 .signature = "(JJLjava/lang/ref/"
849 "WeakReference;)V",
851 },
852 {
853 .name = "nativeRegisterImageTexture",
854 .signature = "(JJLjava/lang/ref/"
855 "WeakReference;Z)V",
857 },
858 {
859 .name = "nativeMarkTextureFrameAvailable",
860 .signature = "(JJ)V",
862 },
863 {
864 .name = "nativeScheduleFrame",
865 .signature = "(J)V",
867 },
868 {
869 .name = "nativeUnregisterTexture",
870 .signature = "(JJ)V",
872 },
873
874 {
875 .name = "nativeLookupCallbackInformation",
876 .signature = "(J)Lio/flutter/view/FlutterCallbackInformation;",
878 },
879
880
881 {
882 .name = "nativeFlutterTextUtilsIsEmoji",
883 .signature = "(I)Z",
885 },
886 {
887 .name = "nativeFlutterTextUtilsIsEmojiModifier",
888 .signature = "(I)Z",
890 },
891 {
892 .name = "nativeFlutterTextUtilsIsEmojiModifierBase",
893 .signature = "(I)Z",
894 .fnPtr =
896 },
897 {
898 .name = "nativeFlutterTextUtilsIsVariationSelector",
899 .signature = "(I)Z",
900 .fnPtr =
902 },
903 {
904 .name = "nativeFlutterTextUtilsIsRegionalIndicator",
905 .signature = "(I)Z",
906 .fnPtr =
908 },
909 {
910 .name = "nativeLoadDartDeferredLibrary",
911 .signature = "(JI[Ljava/lang/String;)V",
913 },
914 {
915 .name = "nativeUpdateJavaAssetManager",
916 .signature =
917 "(JLandroid/content/res/AssetManager;Ljava/lang/String;)V",
919 },
920 {
921 .name = "nativeDeferredComponentInstallFailure",
922 .signature = "(ILjava/lang/String;Z)V",
924 },
925 {
926 .name = "nativeUpdateDisplayMetrics",
927 .signature = "(J)V",
929 },
930 {
931 .name = "nativeIsSurfaceControlEnabled",
932 .signature = "(J)Z",
934 }};
935
937 std::size(flutter_jni_methods)) != 0) {
938 FML_LOG(ERROR) <<
"Failed to RegisterNatives with FlutterJNI";
939 return false;
940 }
941
944
945 if (g_jni_shell_holder_field == nullptr) {
946 FML_LOG(ERROR) <<
"Could not locate FlutterJNI's nativeShellHolderId field";
947 return false;
948 }
949
952
953 if (g_jni_constructor == nullptr) {
954 FML_LOG(ERROR) <<
"Could not locate FlutterJNI's constructor";
955 return false;
956 }
957
959 "valueOf", "(J)Ljava/lang/Long;");
960 if (g_long_constructor == nullptr) {
961 FML_LOG(ERROR) <<
"Could not locate Long's constructor";
962 return false;
963 }
964
966
968 env, env->FindClass("io/flutter/embedding/engine/FlutterOverlaySurface"));
969 if (overlay_surface_class.is_null()) {
970 FML_LOG(ERROR) <<
"Could not locate FlutterOverlaySurface class";
971 return false;
972 }
974 env->GetMethodID(overlay_surface_class.obj(), "getId", "()I");
975 if (g_overlay_surface_id_method == nullptr) {
976 FML_LOG(ERROR) <<
"Could not locate FlutterOverlaySurface#getId() method";
977 return false;
978 }
980 overlay_surface_class.obj(), "getSurface", "()Landroid/view/Surface;");
981 if (g_overlay_surface_surface_method == nullptr) {
983 << "Could not locate FlutterOverlaySurface#getSurface() method";
984 return false;
985 }
986
988 env, env->FindClass("android/graphics/Bitmap"));
990 FML_LOG(ERROR) <<
"Could not locate Bitmap Class";
991 return false;
992 }
993
996 "(IILandroid/graphics/Bitmap$Config;)Landroid/graphics/Bitmap;");
997 if (g_bitmap_create_bitmap_method == nullptr) {
998 FML_LOG(ERROR) <<
"Could not locate Bitmap.createBitmap method";
999 return false;
1000 }
1001
1003 g_bitmap_class->obj(),
"copyPixelsFromBuffer",
"(Ljava/nio/Buffer;)V");
1004 if (g_bitmap_copy_pixels_from_buffer_method == nullptr) {
1005 FML_LOG(ERROR) <<
"Could not locate Bitmap.copyPixelsFromBuffer method";
1006 return false;
1007 }
1008
1010 env, env->FindClass("android/graphics/Bitmap$Config"));
1012 FML_LOG(ERROR) <<
"Could not locate Bitmap.Config Class";
1013 return false;
1014 }
1015
1018 "(Ljava/lang/String;)Landroid/graphics/Bitmap$Config;");
1019 if (g_bitmap_config_value_of == nullptr) {
1020 FML_LOG(ERROR) <<
"Could not locate Bitmap.Config.valueOf method";
1021 return false;
1022 }
1023
1024 return true;
1025}
1026
1027bool PlatformViewAndroid::Register(JNIEnv* env) {
1028 if (env == nullptr) {
1029 FML_LOG(ERROR) <<
"No JNIEnv provided";
1030 return false;
1031 }
1032
1034 env, env->FindClass("io/flutter/view/FlutterCallbackInformation"));
1036 FML_LOG(ERROR) <<
"Could not locate FlutterCallbackInformation class";
1037 return false;
1038 }
1039
1042 "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V");
1043 if (g_flutter_callback_info_constructor == nullptr) {
1044 FML_LOG(ERROR) <<
"Could not locate FlutterCallbackInformation constructor";
1045 return false;
1046 }
1047
1049 env, env->FindClass("io/flutter/embedding/engine/FlutterJNI"));
1051 FML_LOG(ERROR) <<
"Failed to find FlutterJNI Class.";
1052 return false;
1053 }
1054
1056 env,
1057 env->FindClass(
1058 "io/flutter/embedding/engine/mutatorsstack/FlutterMutatorsStack"));
1059 if (g_mutators_stack_class == nullptr) {
1060 FML_LOG(ERROR) <<
"Could not locate FlutterMutatorsStack";
1061 return false;
1062 }
1063
1066 if (g_mutators_stack_init_method == nullptr) {
1067 FML_LOG(ERROR) <<
"Could not locate FlutterMutatorsStack.init method";
1068 return false;
1069 }
1070
1073 if (g_mutators_stack_push_transform_method == nullptr) {
1075 << "Could not locate FlutterMutatorsStack.pushTransform method";
1076 return false;
1077 }
1078
1081 if (g_mutators_stack_push_cliprect_method == nullptr) {
1083 << "Could not locate FlutterMutatorsStack.pushClipRect method";
1084 return false;
1085 }
1086
1089 if (g_mutators_stack_push_cliprrect_method == nullptr) {
1091 << "Could not locate FlutterMutatorsStack.pushClipRRect method";
1092 return false;
1093 }
1094
1097 if (g_mutators_stack_push_opacity_method == nullptr) {
1099 << "Could not locate FlutterMutatorsStack.pushOpacity method";
1100 return false;
1101 }
1102
1105 "(Landroid/graphics/Path;)V");
1106 if (g_mutators_stack_push_clippath_method == nullptr) {
1108 << "Could not locate FlutterMutatorsStack.pushClipPath method";
1109 return false;
1110 }
1111
1113 env, env->FindClass("java/lang/ref/WeakReference"));
1115 FML_LOG(ERROR) <<
"Could not locate WeakReference class";
1116 return false;
1117 }
1118
1121 if (g_java_weak_reference_get_method == nullptr) {
1122 FML_LOG(ERROR) <<
"Could not locate WeakReference.get method";
1123 return false;
1124 }
1125
1127 env, env->FindClass(
1128 "io/flutter/embedding/engine/renderer/SurfaceTextureWrapper"));
1130 FML_LOG(ERROR) <<
"Could not locate SurfaceTextureWrapper class";
1131 return false;
1132 }
1133
1136
1137 if (g_attach_to_gl_context_method == nullptr) {
1138 FML_LOG(ERROR) <<
"Could not locate attachToGlContext method";
1139 return false;
1140 }
1141
1144
1145 if (g_surface_texture_wrapper_should_update == nullptr) {
1147 << "Could not locate SurfaceTextureWrapper.shouldUpdate method";
1148 return false;
1149 }
1150
1153
1154 if (g_update_tex_image_method == nullptr) {
1155 FML_LOG(ERROR) <<
"Could not locate updateTexImage method";
1156 return false;
1157 }
1158
1161
1162 if (g_get_transform_matrix_method == nullptr) {
1163 FML_LOG(ERROR) <<
"Could not locate getTransformMatrix method";
1164 return false;
1165 }
1166
1169
1170 if (g_detach_from_gl_context_method == nullptr) {
1171 FML_LOG(ERROR) <<
"Could not locate detachFromGlContext method";
1172 return false;
1173 }
1176 env, env->FindClass("io/flutter/view/TextureRegistry$ImageConsumer"));
1178 FML_LOG(ERROR) <<
"Could not locate TextureRegistry.ImageConsumer class";
1179 return false;
1180 }
1181
1184 "acquireLatestImage", "()Landroid/media/Image;");
1185 if (g_acquire_latest_image_method == nullptr) {
1186 FML_LOG(ERROR) <<
"Could not locate acquireLatestImage on "
1187 "TextureRegistry.ImageConsumer class";
1188 return false;
1189 }
1190
1192 env, env->FindClass("android/media/Image"));
1194 FML_LOG(ERROR) <<
"Could not locate Image class";
1195 return false;
1196 }
1197
1198
1200
1203 "()Landroid/hardware/HardwareBuffer;");
1204
1205 if (g_image_get_hardware_buffer_method == nullptr) {
1206
1208 }
1209
1211
1212 if (g_image_close_method == nullptr) {
1213 FML_LOG(ERROR) <<
"Could not locate close on Image class";
1214 return false;
1215 }
1216
1217
1220 env, env->FindClass("android/hardware/HardwareBuffer"));
1221
1225 if (g_hardware_buffer_close_method == nullptr) {
1226
1228 }
1229 } else {
1230
1232 }
1233
1236 "([Ljava/lang/String;)[Ljava/lang/String;");
1237
1238 if (g_compute_platform_resolved_locale_method == nullptr) {
1239 FML_LOG(ERROR) <<
"Could not locate computePlatformResolvedLocale method";
1240 return false;
1241 }
1242
1245
1246 if (g_request_dart_deferred_library_method == nullptr) {
1247 FML_LOG(ERROR) <<
"Could not locate requestDartDeferredLibrary method";
1248 return false;
1249 }
1250
1252 env, env->FindClass("java/lang/Long"));
1254 FML_LOG(ERROR) <<
"Could not locate java.lang.Long class";
1255 return false;
1256 }
1257
1258
1260 env, env->FindClass("android/graphics/Path"));
1262 FML_LOG(ERROR) <<
"Could not locate android.graphics.Path class";
1263 return false;
1264 }
1265
1267 if (path_constructor == nullptr) {
1268 FML_LOG(ERROR) <<
"Could not locate android.graphics.Path constructor";
1269 return false;
1270 }
1271
1273 path_class->obj(),
"setFillType",
"(Landroid/graphics/Path$FillType;)V");
1274 if (path_set_fill_type_method == nullptr) {
1276 << "Could not locate android.graphics.Path.setFillType method";
1277 return false;
1278 }
1279
1281 if (path_move_to_method == nullptr) {
1282 FML_LOG(ERROR) <<
"Could not locate android.graphics.Path.moveTo method";
1283 return false;
1284 }
1286 if (path_line_to_method == nullptr) {
1287 FML_LOG(ERROR) <<
"Could not locate android.graphics.Path.lineTo method";
1288 return false;
1289 }
1291 env->GetMethodID(
path_class->obj(),
"quadTo",
"(FFFF)V");
1292 if (path_quad_to_method == nullptr) {
1293 FML_LOG(ERROR) <<
"Could not locate android.graphics.Path.quadTo method";
1294 return false;
1295 }
1297 env->GetMethodID(
path_class->obj(),
"cubicTo",
"(FFFFFF)V");
1298 if (path_cubic_to_method == nullptr) {
1299 FML_LOG(ERROR) <<
"Could not locate android.graphics.Path.cubicTo method";
1300 return false;
1301 }
1302
1304
1306 env->GetMethodID(
path_class->obj(),
"conicTo",
"(FFFFF)V");
1307 if (path_conic_to_method == nullptr) {
1308
1310 }
1312 if (path_close_method == nullptr) {
1313 FML_LOG(ERROR) <<
"Could not locate android.graphics.Path.close method";
1314 return false;
1315 }
1316
1318 env, env->FindClass("android/graphics/Path$FillType"));
1320 FML_LOG(ERROR) <<
"Could not locate android.graphics.Path$FillType class";
1321 return false;
1322 }
1323
1326 "Landroid/graphics/Path$FillType;");
1327 if (g_path_fill_type_winding_field == nullptr) {
1328 FML_LOG(ERROR) <<
"Could not locate Path.FillType.WINDING field";
1329 return false;
1330 }
1331
1334 "Landroid/graphics/Path$FillType;");
1335 if (g_path_fill_type_even_odd_field == nullptr) {
1336 FML_LOG(ERROR) <<
"Could not locate Path.FillType.EVEN_ODD field";
1337 return false;
1338 }
1339
1341}
1342
1343PlatformViewAndroidJNIImpl::PlatformViewAndroidJNIImpl(
1345 : java_object_(java_object) {}
1346
1347PlatformViewAndroidJNIImpl::~PlatformViewAndroidJNIImpl() = default;
1348
1349void PlatformViewAndroidJNIImpl::FlutterViewHandlePlatformMessage(
1350 std::unique_ptr<flutter::PlatformMessage>
message,
1351 int responseId) {
1352
1354
1355 auto java_object = java_object_.get(env);
1356 if (java_object.is_null()) {
1357 return;
1358 }
1359
1362
1365 env, env->NewDirectByteBuffer(
1366 const_cast<uint8_t*
>(
message->data().GetMapping()),
1368
1370 env->CallVoidMethod(java_object.obj(), g_handle_platform_message_method,
1371 java_channel.
obj(), message_array.obj(), responseId,
1372 reinterpret_cast<jlong
>(mapping.
Release()));
1373 } else {
1374 env->CallVoidMethod(java_object.obj(), g_handle_platform_message_method,
1375 java_channel.
obj(),
nullptr, responseId,
nullptr);
1376 }
1377
1379}
1380
1381void PlatformViewAndroidJNIImpl::FlutterViewSetApplicationLocale(
1382 std::string locale) {
1384
1385 auto java_object = java_object_.get(env);
1386 if (java_object.is_null()) {
1387 return;
1388 }
1389
1392
1393 env->CallVoidMethod(java_object.obj(), g_set_application_locale_method,
1395
1397}
1398
1399void PlatformViewAndroidJNIImpl::FlutterViewSetSemanticsTreeEnabled(
1400 bool enabled) {
1402
1403 auto java_object = java_object_.get(env);
1404 if (java_object.is_null()) {
1405 return;
1406 }
1407
1408 env->CallVoidMethod(java_object.obj(), g_set_semantics_tree_enabled_method,
1409 enabled);
1410
1412}
1413
1414void PlatformViewAndroidJNIImpl::FlutterViewHandlePlatformMessageResponse(
1415 int responseId,
1416 std::unique_ptr<fml::Mapping> data) {
1417
1418
1420
1421 auto java_object = java_object_.get(env);
1422 if (java_object.is_null()) {
1423
1424
1425 return;
1426 }
1427 if (data == nullptr) {
1428 env->CallVoidMethod(java_object.obj(),
1429 g_handle_platform_message_response_method, responseId,
1430 nullptr);
1431 } else {
1432
1434 env, env->NewDirectByteBuffer(
const_cast<uint8_t*
>(
data->GetMapping()),
1436
1437 env->CallVoidMethod(java_object.obj(),
1438 g_handle_platform_message_response_method, responseId,
1439 data_array.obj());
1440 }
1441
1443}
1444
1445double PlatformViewAndroidJNIImpl::FlutterViewGetScaledFontSize(
1447 int configuration_id) const {
1449
1450 auto java_object = java_object_.get(env);
1451 if (java_object.is_null()) {
1452 return -3;
1453 }
1454
1455 const jfloat scaledSize = env->CallFloatMethod(
1456 java_object.obj(), g_get_scaled_font_size_method,
1457 static_cast<jfloat
>(
font_size),
static_cast<jint
>(configuration_id));
1459 return static_cast<double>(scaledSize);
1460}
1461
1462void PlatformViewAndroidJNIImpl::FlutterViewUpdateSemantics(
1463 std::vector<uint8_t> buffer,
1464 std::vector<std::string> strings,
1465 std::vector<std::vector<uint8_t>> string_attribute_args) {
1467
1468 auto java_object = java_object_.get(env);
1469 if (java_object.is_null()) {
1470 return;
1471 }
1472
1474 env, env->NewDirectByteBuffer(
buffer.data(),
buffer.size()));
1479
1480 env->CallVoidMethod(java_object.obj(), g_update_semantics_method,
1481 direct_buffer.obj(), jstrings.
obj(),
1482 jstring_attribute_args.
obj());
1483
1485}
1486
1487void PlatformViewAndroidJNIImpl::FlutterViewUpdateCustomAccessibilityActions(
1488 std::vector<uint8_t> actions_buffer,
1489 std::vector<std::string> strings) {
1491
1492 auto java_object = java_object_.get(env);
1493 if (java_object.is_null()) {
1494 return;
1495 }
1496
1498 env,
1499 env->NewDirectByteBuffer(actions_buffer.data(), actions_buffer.size()));
1500
1503
1504 env->CallVoidMethod(java_object.obj(),
1505 g_update_custom_accessibility_actions_method,
1506 direct_actions_buffer.obj(), jstrings.
obj());
1507
1509}
1510
1511void PlatformViewAndroidJNIImpl::FlutterViewOnFirstFrame() {
1513
1514 auto java_object = java_object_.get(env);
1515 if (java_object.is_null()) {
1516 return;
1517 }
1518
1519 env->CallVoidMethod(java_object.obj(), g_on_first_frame_method);
1520
1522}
1523
1524void PlatformViewAndroidJNIImpl::FlutterViewOnPreEngineRestart() {
1526
1527 auto java_object = java_object_.get(env);
1528 if (java_object.is_null()) {
1529 return;
1530 }
1531
1532 env->CallVoidMethod(java_object.obj(), g_on_engine_restart_method);
1533
1535}
1536
1537void PlatformViewAndroidJNIImpl::SurfaceTextureAttachToGLContext(
1538 JavaLocalRef surface_texture,
1539 int textureId) {
1541
1542 if (surface_texture.is_null()) {
1543 return;
1544 }
1545
1547 env, env->CallObjectMethod(surface_texture.obj(),
1548 g_java_weak_reference_get_method));
1549
1550 if (surface_texture_local_ref.is_null()) {
1551 return;
1552 }
1553
1554 env->CallVoidMethod(surface_texture_local_ref.obj(),
1555 g_attach_to_gl_context_method, textureId);
1556
1558}
1559
1560bool PlatformViewAndroidJNIImpl::SurfaceTextureShouldUpdate(
1561 JavaLocalRef surface_texture) {
1563
1564 if (surface_texture.is_null()) {
1565 return false;
1566 }
1567
1569 env, env->CallObjectMethod(surface_texture.obj(),
1570 g_java_weak_reference_get_method));
1571 if (surface_texture_local_ref.is_null()) {
1572 return false;
1573 }
1574
1575 jboolean shouldUpdate = env->CallBooleanMethod(
1576 surface_texture_local_ref.obj(), g_surface_texture_wrapper_should_update);
1577
1579
1580 return shouldUpdate;
1581}
1582
1583void PlatformViewAndroidJNIImpl::SurfaceTextureUpdateTexImage(
1584 JavaLocalRef surface_texture) {
1586
1587 if (surface_texture.is_null()) {
1588 return;
1589 }
1590
1592 env, env->CallObjectMethod(surface_texture.obj(),
1593 g_java_weak_reference_get_method));
1594 if (surface_texture_local_ref.is_null()) {
1595 return;
1596 }
1597
1598 env->CallVoidMethod(surface_texture_local_ref.obj(),
1599 g_update_tex_image_method);
1600
1602}
1603
1604SkM44 PlatformViewAndroidJNIImpl::SurfaceTextureGetTransformMatrix(
1605 JavaLocalRef surface_texture) {
1607
1608 if (surface_texture.is_null()) {
1609 return {};
1610 }
1611
1613 env, env->CallObjectMethod(surface_texture.obj(),
1614 g_java_weak_reference_get_method));
1615 if (surface_texture_local_ref.is_null()) {
1616 return {};
1617 }
1618
1620 env, env->NewFloatArray(16));
1621
1622 env->CallVoidMethod(surface_texture_local_ref.obj(),
1623 g_get_transform_matrix_method, transformMatrix.obj());
1625
1626 float* m = env->GetFloatArrayElements(transformMatrix.obj(), nullptr);
1627
1628 static_assert(sizeof(SkScalar) == sizeof(float));
1629 const auto transform = SkM44::ColMajor(m);
1630
1631 env->ReleaseFloatArrayElements(transformMatrix.obj(), m, JNI_ABORT);
1632
1634}
1635
1636void PlatformViewAndroidJNIImpl::SurfaceTextureDetachFromGLContext(
1637 JavaLocalRef surface_texture) {
1639
1640 if (surface_texture.is_null()) {
1641 return;
1642 }
1643
1645 env, env->CallObjectMethod(surface_texture.obj(),
1646 g_java_weak_reference_get_method));
1647 if (surface_texture_local_ref.is_null()) {
1648 return;
1649 }
1650
1651 env->CallVoidMethod(surface_texture_local_ref.obj(),
1652 g_detach_from_gl_context_method);
1653
1655}
1656
1658PlatformViewAndroidJNIImpl::ImageProducerTextureEntryAcquireLatestImage(
1659 JavaLocalRef image_producer_texture_entry) {
1661
1662 if (image_producer_texture_entry.is_null()) {
1663
1665 }
1666
1667
1668
1670 env, env->CallObjectMethod(image_producer_texture_entry.obj(),
1671 g_java_weak_reference_get_method));
1672
1673 if (image_producer_texture_entry_local_ref.is_null()) {
1674
1676 }
1677
1679 env, env->CallObjectMethod(image_producer_texture_entry_local_ref.obj(),
1680 g_acquire_latest_image_method));
1682 return r;
1683 }
1684
1686}
1687
1688JavaLocalRef PlatformViewAndroidJNIImpl::ImageGetHardwareBuffer(
1689 JavaLocalRef
image) {
1690 FML_CHECK(g_image_get_hardware_buffer_method !=
nullptr);
1692 if (
image.is_null()) {
1693
1695 }
1697 env,
1698 env->CallObjectMethod(
image.obj(), g_image_get_hardware_buffer_method));
1701 }
1702 return r;
1703}
1704
1705void PlatformViewAndroidJNIImpl::ImageClose(JavaLocalRef
image) {
1707 if (
image.is_null()) {
1708 return;
1709 }
1710 env->CallVoidMethod(
image.obj(), g_image_close_method);
1712}
1713
1714void PlatformViewAndroidJNIImpl::HardwareBufferClose(
1715 JavaLocalRef hardware_buffer) {
1716 FML_CHECK(g_hardware_buffer_close_method !=
nullptr);
1718 if (hardware_buffer.is_null()) {
1719 return;
1720 }
1721 env->CallVoidMethod(hardware_buffer.obj(), g_hardware_buffer_close_method);
1723}
1724
1725void PlatformViewAndroidJNIImpl::FlutterViewOnDisplayPlatformView(
1731 int viewWidth,
1732 int viewHeight,
1733 MutatorsStack mutators_stack) {
1735 auto java_object = java_object_.get(env);
1736 if (java_object.is_null()) {
1737 return;
1738 }
1739
1741 g_mutators_stack_init_method);
1742
1743 std::vector<std::shared_ptr<Mutator>>::const_iterator iter =
1744 mutators_stack.Begin();
1745 while (iter != mutators_stack.End()) {
1746 switch ((*iter)->GetType()) {
1747 case MutatorType::kTransform: {
1748 const DlMatrix& matrix = (*iter)->GetMatrix();
1750 matrix.m[0], matrix.m[4], matrix.m[12],
1751 matrix.m[1], matrix.m[5], matrix.m[13],
1752 matrix.m[3], matrix.m[7], matrix.m[15],
1753 };
1755 env, env->NewFloatArray(9));
1756
1757 env->SetFloatArrayRegion(transformMatrix.obj(), 0, 9, matrix_array);
1758 env->CallVoidMethod(mutatorsStack,
1759 g_mutators_stack_push_transform_method,
1760 transformMatrix.obj());
1761 break;
1762 }
1763 case MutatorType::kClipRect: {
1764 const DlRect& rect = (*iter)->GetRect();
1765 env->CallVoidMethod(mutatorsStack,
1766 g_mutators_stack_push_cliprect_method,
1767 static_cast<int>(rect.GetLeft()),
1768 static_cast<int>(rect.GetTop()),
1769 static_cast<int>(rect.GetRight()),
1770 static_cast<int>(rect.GetBottom()));
1771 break;
1772 }
1773 case MutatorType::kClipRRect: {
1775 const DlRect& rect = rrect.GetBounds();
1777 SkScalar radiis[8] = {
1779 radii.top_right.width, radii.top_right.height,
1780 radii.bottom_right.width, radii.bottom_right.height,
1781 radii.bottom_left.width, radii.bottom_left.height,
1782 };
1784 env, env->NewFloatArray(8));
1785 env->SetFloatArrayRegion(radiisArray.obj(), 0, 8, radiis);
1786 env->CallVoidMethod(mutatorsStack,
1787 g_mutators_stack_push_cliprrect_method,
1788 static_cast<int>(rect.GetLeft()),
1789 static_cast<int>(rect.GetTop()),
1790 static_cast<int>(rect.GetRight()),
1791 static_cast<int>(rect.GetBottom()),
1792 radiisArray.obj());
1793 break;
1794 }
1795 case MutatorType::kClipRSE: {
1796 const DlRoundRect& rrect = (*iter)->GetRSEApproximation();
1797 const DlRect& rect = rrect.GetBounds();
1799 SkScalar radiis[8] = {
1801 radii.top_right.width, radii.top_right.height,
1802 radii.bottom_right.width, radii.bottom_right.height,
1803 radii.bottom_left.width, radii.bottom_left.height,
1804 };
1806 env, env->NewFloatArray(8));
1807 env->SetFloatArrayRegion(radiisArray.obj(), 0, 8, radiis);
1808 env->CallVoidMethod(mutatorsStack,
1809 g_mutators_stack_push_cliprrect_method,
1810 static_cast<int>(rect.GetLeft()),
1811 static_cast<int>(rect.GetTop()),
1812 static_cast<int>(rect.GetRight()),
1813 static_cast<int>(rect.GetBottom()),
1814 radiisArray.obj());
1815 break;
1816 }
1817
1818
1819 case MutatorType::kClipPath:
1820 case MutatorType::kOpacity:
1821 case MutatorType::kBackdropFilter:
1822 case MutatorType::kBackdropClipRect:
1823 case MutatorType::kBackdropClipRRect:
1824 case MutatorType::kBackdropClipRSuperellipse:
1825 case MutatorType::kBackdropClipPath:
1826 break;
1827 }
1828 ++iter;
1829 }
1830
1831 env->CallVoidMethod(java_object.obj(), g_on_display_platform_view_method,
1833 mutatorsStack);
1834
1836}
1837
1838void PlatformViewAndroidJNIImpl::FlutterViewDisplayOverlaySurface(
1839 int surface_id,
1845
1846 auto java_object = java_object_.get(env);
1847 if (java_object.is_null()) {
1848 return;
1849 }
1850
1851 env->CallVoidMethod(java_object.obj(), g_on_display_overlay_surface_method,
1853
1855}
1856
1857void PlatformViewAndroidJNIImpl::FlutterViewBeginFrame() {
1859
1860 auto java_object = java_object_.get(env);
1861 if (java_object.is_null()) {
1862 return;
1863 }
1864
1865 env->CallVoidMethod(java_object.obj(), g_on_begin_frame_method);
1866
1868}
1869
1870void PlatformViewAndroidJNIImpl::FlutterViewEndFrame() {
1872
1873 auto java_object = java_object_.get(env);
1874 if (java_object.is_null()) {
1875 return;
1876 }
1877
1878 env->CallVoidMethod(java_object.obj(), g_on_end_frame_method);
1879
1881}
1882
1883std::unique_ptr<PlatformViewAndroidJNI::OverlayMetadata>
1884PlatformViewAndroidJNIImpl::FlutterViewCreateOverlaySurface() {
1886
1887 auto java_object = java_object_.get(env);
1888 if (java_object.is_null()) {
1889 return nullptr;
1890 }
1891
1893 env, env->CallObjectMethod(java_object.obj(),
1894 g_create_overlay_surface_method));
1896
1897 if (overlay.is_null()) {
1898 return std::make_unique<PlatformViewAndroidJNI::OverlayMetadata>(0,
1899 nullptr);
1900 }
1901
1902 jint overlay_id =
1903 env->CallIntMethod(overlay.obj(), g_overlay_surface_id_method);
1904
1905 jobject overlay_surface =
1906 env->CallObjectMethod(overlay.obj(), g_overlay_surface_surface_method);
1907
1908 auto overlay_window = fml::MakeRefCounted<AndroidNativeWindow>(
1909 ANativeWindow_fromSurface(env, overlay_surface));
1910
1911 return std::make_unique<PlatformViewAndroidJNI::OverlayMetadata>(
1912 overlay_id, std::move(overlay_window));
1913}
1914
1915void PlatformViewAndroidJNIImpl::FlutterViewDestroyOverlaySurfaces() {
1917
1918 auto java_object = java_object_.get(env);
1919 if (java_object.is_null()) {
1920 return;
1921 }
1922
1923 env->CallVoidMethod(java_object.obj(), g_destroy_overlay_surfaces_method);
1924
1926}
1927
1928std::unique_ptr<std::vector<std::string>>
1929PlatformViewAndroidJNIImpl::FlutterViewComputePlatformResolvedLocale(
1930 std::vector<std::string> supported_locales_data) {
1932
1933 std::unique_ptr<std::vector<std::string>> out =
1934 std::make_unique<std::vector<std::string>>();
1935
1936 auto java_object = java_object_.get(env);
1937 if (java_object.is_null()) {
1938 return out;
1939 }
1942 jobjectArray result = static_cast<jobjectArray>(env->CallObjectMethod(
1943 java_object.obj(), g_compute_platform_resolved_locale_method,
1944 j_locales_data.
obj()));
1945
1947
1948 int length = env->GetArrayLength(result);
1951 env,
static_cast<jstring
>(env->GetObjectArrayElement(result,
i))));
1952 }
1953 return out;
1954}
1955
1956double PlatformViewAndroidJNIImpl::GetDisplayRefreshRate() {
1958
1959 auto java_object = java_object_.get(env);
1960 if (java_object.is_null()) {
1961 return kUnknownDisplayRefreshRate;
1962 }
1963
1965 env, env->GetObjectClass(java_object.obj()));
1966 if (clazz.is_null()) {
1967 return kUnknownDisplayRefreshRate;
1968 }
1969
1970 jfieldID fid = env->GetStaticFieldID(clazz.obj(), "refreshRateFPS", "F");
1971 return static_cast<double>(env->GetStaticFloatField(clazz.obj(), fid));
1972}
1973
1974double PlatformViewAndroidJNIImpl::GetDisplayWidth() {
1976
1977 auto java_object = java_object_.get(env);
1978 if (java_object.is_null()) {
1979 return -1;
1980 }
1981
1983 env, env->GetObjectClass(java_object.obj()));
1984 if (clazz.is_null()) {
1985 return -1;
1986 }
1987
1988 jfieldID fid = env->GetStaticFieldID(clazz.obj(), "displayWidth", "F");
1989 return static_cast<double>(env->GetStaticFloatField(clazz.obj(), fid));
1990}
1991
1992double PlatformViewAndroidJNIImpl::GetDisplayHeight() {
1994
1995 auto java_object = java_object_.get(env);
1996 if (java_object.is_null()) {
1997 return -1;
1998 }
1999
2001 env, env->GetObjectClass(java_object.obj()));
2002 if (clazz.is_null()) {
2003 return -1;
2004 }
2005
2006 jfieldID fid = env->GetStaticFieldID(clazz.obj(), "displayHeight", "F");
2007 return static_cast<double>(env->GetStaticFloatField(clazz.obj(), fid));
2008}
2009
2010double PlatformViewAndroidJNIImpl::GetDisplayDensity() {
2012
2013 auto java_object = java_object_.get(env);
2014 if (java_object.is_null()) {
2015 return -1;
2016 }
2017
2019 env, env->GetObjectClass(java_object.obj()));
2020 if (clazz.is_null()) {
2021 return -1;
2022 }
2023
2024 jfieldID fid = env->GetStaticFieldID(clazz.obj(), "displayDensity", "F");
2025 return static_cast<double>(env->GetStaticFloatField(clazz.obj(), fid));
2026}
2027
2028bool PlatformViewAndroidJNIImpl::RequestDartDeferredLibrary(
2029 int loading_unit_id) {
2031
2032 auto java_object = java_object_.get(env);
2033 if (java_object.is_null()) {
2034 return true;
2035 }
2036
2037 env->CallVoidMethod(java_object.obj(), g_request_dart_deferred_library_method,
2038 loading_unit_id);
2039
2041 return true;
2042}
2043
2044
2045
2046ASurfaceTransaction* PlatformViewAndroidJNIImpl::createTransaction() {
2048
2049 auto java_object = java_object_.get(env);
2050 if (java_object.is_null()) {
2051 return nullptr;
2052 }
2053
2055 env,
2056 env->CallObjectMethod(java_object.obj(), g_create_transaction_method));
2057 if (transaction.is_null()) {
2058 return nullptr;
2059 }
2061
2063 env, transaction.obj());
2064}
2065
2066void PlatformViewAndroidJNIImpl::swapTransaction() {
2068
2069 auto java_object = java_object_.get(env);
2070 if (java_object.is_null()) {
2071 return;
2072 }
2073
2074 env->CallVoidMethod(java_object.obj(), g_swap_transaction_method);
2075
2077}
2078
2079void PlatformViewAndroidJNIImpl::applyTransaction() {
2081
2082 auto java_object = java_object_.get(env);
2083 if (java_object.is_null()) {
2084 return;
2085 }
2086
2087 env->CallVoidMethod(java_object.obj(), g_apply_transaction_method);
2088
2090}
2091
2092std::unique_ptr<PlatformViewAndroidJNI::OverlayMetadata>
2093PlatformViewAndroidJNIImpl::createOverlaySurface2() {
2095
2096 auto java_object = java_object_.get(env);
2097 if (java_object.is_null()) {
2098 return nullptr;
2099 }
2100
2102 env, env->CallObjectMethod(java_object.obj(),
2103 g_create_overlay_surface2_method));
2105
2106 if (overlay.is_null()) {
2107 return std::make_unique<PlatformViewAndroidJNI::OverlayMetadata>(0,
2108 nullptr);
2109 }
2110
2111 jint overlay_id =
2112 env->CallIntMethod(overlay.obj(), g_overlay_surface_id_method);
2113
2114 jobject overlay_surface =
2115 env->CallObjectMethod(overlay.obj(), g_overlay_surface_surface_method);
2116
2117 auto overlay_window = fml::MakeRefCounted<AndroidNativeWindow>(
2118 ANativeWindow_fromSurface(env, overlay_surface));
2119
2120 return std::make_unique<PlatformViewAndroidJNI::OverlayMetadata>(
2121 overlay_id, std::move(overlay_window));
2122}
2123
2124void PlatformViewAndroidJNIImpl::destroyOverlaySurface2() {
2126
2127 auto java_object = java_object_.get(env);
2128 if (java_object.is_null()) {
2129 return;
2130 }
2131
2132 env->CallVoidMethod(java_object.obj(), g_destroy_overlay_surface2_method);
2133
2135}
2136
2137namespace {
2139 public:
2140 explicit AndroidPathReceiver(JNIEnv* env)
2141 : env_(env),
2143
2144 void SetFillType(DlPathFillType
type) {
2145 jfieldID fill_type_field_id;
2147 case DlPathFillType::kOdd:
2149 break;
2150 case DlPathFillType::kNonZero:
2152 break;
2153 default:
2154
2155
2156 return;
2157 }
2158
2159
2160
2164 fill_type_field_id));
2167
2168
2169 env_->CallVoidMethod(android_path_, path_set_fill_type_method,
2170 fill_type_enum.
obj());
2172 }
2173
2174 void MoveTo(
const DlPoint&
p2,
bool will_be_closed)
override {
2175 env_->CallVoidMethod(android_path_, path_move_to_method,
p2.x,
p2.y);
2176 }
2177 void LineTo(
const DlPoint&
p2)
override {
2178 env_->CallVoidMethod(android_path_, path_line_to_method,
p2.x,
p2.y);
2179 }
2180 void QuadTo(
const DlPoint& cp,
const DlPoint&
p2)
override {
2181 env_->CallVoidMethod(android_path_, path_quad_to_method,
2182 cp.x, cp.y,
p2.x,
p2.y);
2183 }
2184 bool ConicTo(
const DlPoint& cp,
const DlPoint&
p2, DlScalar
weight)
override {
2185 if (!path_conic_to_method) {
2186 return false;
2187 }
2188 env_->CallVoidMethod(android_path_, path_conic_to_method,
2190 return true;
2191 };
2192 void CubicTo(
const DlPoint& cp1,
2193 const DlPoint& cp2,
2194 const DlPoint&
p2)
override {
2195 env_->CallVoidMethod(android_path_, path_cubic_to_method,
2196 cp1.x, cp1.y, cp2.x, cp2.y,
p2.x,
p2.y);
2197 }
2198 void Close()
override {
2199 env_->CallVoidMethod(android_path_, path_close_method);
2200 }
2201
2202 jobject TakePath() const { return android_path_; }
2203
2204 private:
2205 JNIEnv* env_;
2206 jobject android_path_;
2207};
2208}
2209
2210void PlatformViewAndroidJNIImpl::onDisplayPlatformView2(
2216 int32_t viewWidth,
2217 int32_t viewHeight,
2218 MutatorsStack mutators_stack) {
2220 auto java_object = java_object_.get(env);
2221 if (java_object.is_null()) {
2222 return;
2223 }
2224
2226 g_mutators_stack_init_method);
2227
2228 std::vector<std::shared_ptr<Mutator>>::const_iterator iter =
2229 mutators_stack.Begin();
2230 while (iter != mutators_stack.End()) {
2231 switch ((*iter)->GetType()) {
2232 case MutatorType::kTransform: {
2233 const DlMatrix& matrix = (*iter)->GetMatrix();
2235 matrix.m[0], matrix.m[4], matrix.m[12],
2236 matrix.m[1], matrix.m[5], matrix.m[13],
2237 matrix.m[3], matrix.m[7], matrix.m[15],
2238 };
2240 env, env->NewFloatArray(9));
2241
2242 env->SetFloatArrayRegion(transformMatrix.obj(), 0, 9, matrix_array);
2243 env->CallVoidMethod(mutatorsStack,
2244 g_mutators_stack_push_transform_method,
2245 transformMatrix.obj());
2246 break;
2247 }
2248 case MutatorType::kClipRect: {
2249 const DlRect& rect = (*iter)->GetRect();
2250 env->CallVoidMethod(mutatorsStack,
2251 g_mutators_stack_push_cliprect_method,
2252 static_cast<int>(rect.GetLeft()),
2253 static_cast<int>(rect.GetTop()),
2254 static_cast<int>(rect.GetRight()),
2255 static_cast<int>(rect.GetBottom()));
2256 break;
2257 }
2258 case MutatorType::kClipRRect: {
2260 const DlRect& rect = rrect.GetBounds();
2262 SkScalar radiis[8] = {
2264 radii.top_right.width, radii.top_right.height,
2265 radii.bottom_right.width, radii.bottom_right.height,
2266 radii.bottom_left.width, radii.bottom_left.height,
2267 };
2269 env, env->NewFloatArray(8));
2270 env->SetFloatArrayRegion(radiisArray.obj(), 0, 8, radiis);
2271 env->CallVoidMethod(mutatorsStack,
2272 g_mutators_stack_push_cliprrect_method,
2273 static_cast<int>(rect.GetLeft()),
2274 static_cast<int>(rect.GetTop()),
2275 static_cast<int>(rect.GetRight()),
2276 static_cast<int>(rect.GetBottom()),
2277 radiisArray.obj());
2278 break;
2279 }
2280 case MutatorType::kClipRSE: {
2281 const DlRoundRect& rrect = (*iter)->GetRSEApproximation();
2282 const DlRect& rect = rrect.GetBounds();
2284 SkScalar radiis[8] = {
2286 radii.top_right.width, radii.top_right.height,
2287 radii.bottom_right.width, radii.bottom_right.height,
2288 radii.bottom_left.width, radii.bottom_left.height,
2289 };
2291 env, env->NewFloatArray(8));
2292 env->SetFloatArrayRegion(radiisArray.obj(), 0, 8, radiis);
2293 env->CallVoidMethod(mutatorsStack,
2294 g_mutators_stack_push_cliprrect_method,
2295 static_cast<int>(rect.GetLeft()),
2296 static_cast<int>(rect.GetTop()),
2297 static_cast<int>(rect.GetRight()),
2298 static_cast<int>(rect.GetBottom()),
2299 radiisArray.obj());
2300 break;
2301 }
2302 case MutatorType::kOpacity: {
2303 float opacity = (*iter)->GetAlphaFloat();
2304 env->CallVoidMethod(mutatorsStack, g_mutators_stack_push_opacity_method,
2305 opacity);
2306 break;
2307 }
2308 case MutatorType::kClipPath: {
2309 auto& dlPath = (*iter)->GetPath();
2310
2311
2312
2313
2317
2318
2319 AndroidPathReceiver receiver(env);
2320 receiver.SetFillType(dlPath.GetFillType());
2321
2322
2323
2324
2325 dlPath.Dispatch(receiver);
2326
2327 env->CallVoidMethod(mutatorsStack,
2328 g_mutators_stack_push_clippath_method,
2329 receiver.TakePath());
2330 break;
2331 }
2332
2333
2334 case MutatorType::kBackdropFilter:
2335 case MutatorType::kBackdropClipRect:
2336 case MutatorType::kBackdropClipRRect:
2337 case MutatorType::kBackdropClipRSuperellipse:
2338 case MutatorType::kBackdropClipPath:
2339 break;
2340 }
2341 ++iter;
2342 }
2343
2344 env->CallVoidMethod(java_object.obj(), g_on_display_platform_view2_method,
2346 mutatorsStack);
2347
2349}
2350
2351void PlatformViewAndroidJNIImpl::hidePlatformView2(int32_t
view_id) {
2353 auto java_object = java_object_.get(env);
2354 if (java_object.is_null()) {
2355 return;
2356 }
2357
2358 env->CallVoidMethod(java_object.obj(), g_hide_platform_view2_method,
view_id);
2359}
2360
2361void PlatformViewAndroidJNIImpl::onEndFrame2() {
2363
2364 auto java_object = java_object_.get(env);
2365 if (java_object.is_null()) {
2366 return;
2367 }
2368
2369 env->CallVoidMethod(java_object.obj(), g_on_end_frame2_method);
2370
2372}
2373
2374void PlatformViewAndroidJNIImpl::showOverlaySurface2() {
2376
2377 auto java_object = java_object_.get(env);
2378 if (java_object.is_null()) {
2379 return;
2380 }
2381
2382 env->CallVoidMethod(java_object.obj(), g_show_overlay_surface2_method);
2384}
2385
2386void PlatformViewAndroidJNIImpl::hideOverlaySurface2() {
2388
2389 auto java_object = java_object_.get(env);
2390 if (java_object.is_null()) {
2391 return;
2392 }
2393
2394 env->CallVoidMethod(java_object.obj(), g_hide_overlay_surface2_method);
2396}
2397
2398void PlatformViewAndroidJNIImpl::MaybeResizeSurfaceView(int32_t
width,
2401
2402 auto java_object = java_object_.get(env);
2403 if (java_object.is_null()) {
2404 return;
2405 }
2406
2407 env->CallVoidMethod(java_object.obj(), g_maybe_resize_surface_view,
width,
2410}
2411
2412}
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