Skip to content

Rfc410 prototype - #195336

Draft
mboetger wants to merge 32 commits into
flutter:masterfrom
mboetger:rfc410-prototype
Draft

mboetger wants to merge 32 commits into
flutter:masterfrom
mboetger:rfc410-prototype

Conversation

@mboetger

Copy link
Copy Markdown
Contributor

Replace this paragraph with a description of what this PR is changing or adding, and why. Consider including before/after screenshots.

List which issues are fixed by this PR. You must list at least one issue. An issue is not required if the PR fixes something trivial like a typo.

If you had to change anything in the flutter/tests repo, include a link to the migration guide as per the breaking change policy.

Pre-launch Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

If this change needs to override an active code freeze, provide a comment explaining why. The code freeze workflow can be overridden by code reviewers. See pinned issues for any active code freezes with guidance.

Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the gemini-code-assist bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.

@github-actions github-actions Bot added platform-android Android applications specifically engine flutter/engine related. See also e: labels. a: accessibility Accessibility, e.g. VoiceOver or TalkBack. (aka a11y) f: routes Navigator, Router, and related APIs. e: impeller Impeller rendering backend issues and features requests team-android Owned by Android platform team labels Oct 26, 2026
@mboetger mboetger added the CICD Run CI/CD label Oct 26, 2026
@github-actions github-actions Bot added platform-macos Building on or for macOS specifically a: desktop Running on desktop team-macos Owned by the macOS platform team labels Oct 26, 2026
knasher added a commit to knasher/flutter-sailfish that referenced this pull request Oct 27, 2026
The engine patch added four physical_view_padding_* fields to FlutterWindowMetricsEvent. Flutter's RFC for moving the Android embedder to the embedder API (flutter/rfc#24) proposes the same thing as FlutterEdgeInsets physical_padding, and its draft prototype (flutter/flutter#195336) adds it in the same place. The engine patch and embedder patch 0014 now use that layout, read and checked as the prototype does, so our patch can be dropped once Flutter ships it. The runtime spec looks for the new field.

Tested on Jolla Phone 2026, Sailfish 5.2.0.20, in a sandboxed copy of an app
…message routing, and order Hybrid Composition EGL presentation

- Guard `extern "C" __attribute__((weak)) FlutterEngineGetProcAddresses` and its direct call with `#if defined(__ELF__)` in `android_engine_group.cc`, `android_vm_init.cc`, `android_vsync_waiter.cc`, and `flutter_embedder_native.cc` so Mach-O (`ld64.lld`) and PE/COFF host unit test binaries resolve the proc table via `fml::NativeLibrary::CreateForCurrentProcess()`.
- Capture `weak_platform_view_` instead of retaining `ui_task_runner` directly in `Shell::OnEngineHandlePlatformMessage` when routing early unhandled platform messages through the platform thread, removing the `_WIN32` `FML_DCHECK(false)` abort in `EmbedderTest.EmbedderPlatformDispatchTableAndImageDecoderInProjectArgs`.
- Defer `PresentOnscreenSurface` and `PresentOverlaySurface` into `execute_presentation()` in `AndroidPlatformViewsController::PresentView` so EGL swap buffers run after `OnBeginFrame()` and `OnDisplayPlatformView()` (`convertToImageView()`), and clear/present the onscreen `FlutterImageView` surface when no root layer is present or when `convertToImageView()` switches the onscreen `ANativeWindow*` mid-frame.
…nup, macOS shutdown deadlock, and clang-tidy

- Open the parent directory with `fml::FilePermission::kRead` in `CallbackCache::SaveCacheToDisk()` so `OpenDirectory` on Windows shares read/write/delete access (`GetShareFlags(kRead)`) instead of failing with `ERROR_SHARING_VIOLATION` (`32`) when `ScopedTemporaryDirectory` holds an open directory handle.
- Clean up `custom_asset_resolver_.user_data` in `FlutterEmbedderNative` and invoke `custom_asset_resolvers[i]->destruction_callback` and `PlatformMessageReleaseResponseHandle`'s `data_callback` in `flutter_embedder_native_unittests.cc` to resolve LeakSanitizer failures on `Linux linux_unopt`.
- Use `std::recursive_mutex`, retain `shared_from_this()`, and copy `std::function` callbacks onto the stack in `PlatformViewEmbedder::EmbedderPlatformMessageHandler` and `PlatformViewEmbedder` so synchronous engine teardown inside a platform message callback (`FlutterEngineTest.ResponseAfterEngineDied`) does not self-deadlock or access destroyed state.
- Value-initialize `flutter::GPUMTLTextureInfo texture_info = {}` and pass `on_make_current` / `on_clear_current` by `const&` in `MakeRenderTargetFromBackingStoreImpeller` in `embedder.cc` to satisfy `mac_clang_tidy`.
@github-actions github-actions Bot added platform-ios iOS applications specifically tool Affects the "flutter" command-line tool. See also t: labels. team-ios Owned by iOS platform team labels Oct 28, 2026
@mboetger mboetger added CICD Run CI/CD and removed CICD Run CI/CD labels Oct 29, 2026
# Conflicts:
#	engine/src/flutter/shell/platform/android/android_shell_holder.cc
…ons, and cross-thread message dispatch

- Marshal EmbedderEngine::SendPlatformMessage onto the platform task runner via fml::TaskRunner::RunNowOrPostTask so background JNI callers do not dereference the UI-thread-bound Engine WeakPtr during teardown.
- Enable Impeller optional Vulkan device extensions (VK_EXT_image_compression_control, VK_EXT_image_compression_control_swapchain, VK_KHR_sampler_ycbcr_conversion, AHB/foreign queue) and chained feature structs in AndroidSurfaceControl::InitializeVulkan so root surface and SurfaceControl overlays use matching AFRC fixed-rate compression formats on Mali GPUs.
- Destroy cached C++ overlay surfaces (10000+) and controller overlay state when the root window is destroyed or detached, and guard PlatformViewsController2.createOverlaySurface() when flutterView or rootSurfaceControl is null.
- Drain expired platform fml::MessageLoop tasks in FlutterEmbedderNative::RunOnRasterThreadSynchronously while waiting on the raster latch to prevent AB-BA deadlocks with AndroidPlatformViewsController::PresentView.
# Conflicts:
#	engine/src/flutter/shell/platform/android/android_context_dynamic_impeller.cc
#	engine/src/flutter/shell/platform/android/android_context_vk_impeller.cc
- Fix clang-analyzer-core.StackAddressEscape in flutter_embedder_native_unittests.cc
  by storing FakeSpawnJniState and CrossThreadTestState::platform_task_executed by
  value in static test state instead of storing pointers to local stack variables.
- Fix Android NDK jni.h compilation in flutter_shell_native_unittests by deducing the
  JNIEnv::functions table type via decltype instead of hardcoding JNINativeInterface_.
- Reorder FlutterEmbedderNative private fields in flutter_embedder_native.h to match
  clang-analyzer-optin.performance.Padding optimal layout (2 padding bytes vs 34).
- Merge upstream b5879a3 and update AndroidTaskRunners thread affinity back to
  fml::CpuAffinity::kNotEfficiency.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: accessibility Accessibility, e.g. VoiceOver or TalkBack. (aka a11y) a: desktop Running on desktop CICD Run CI/CD e: impeller Impeller rendering backend issues and features requests engine flutter/engine related. See also e: labels. f: routes Navigator, Router, and related APIs. platform-android Android applications specifically platform-ios iOS applications specifically platform-macos Building on or for macOS specifically team-android Owned by Android platform team team-ios Owned by iOS platform team team-macos Owned by the macOS platform team tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant