The fuchsia.sys FIDL library, used to implement v1 components, is
deprecated in the Fuchsia platform and is being removed.
Flutter now implements Components v2 but still imports the old library.
Bug: https://fxbug.dev/109013
Adds `addApplicationDelegate:` to the macOS plugin registrar, following the corresponding iOS method, and wires it up to the existing app delegation forwarding that was recently added for use at the application level. (The actual delegate is non-trivially different between iOS and macOS, but that's not resolveable without a complex migration on the iOS side, so the APIs currently diverge after the level of the `addApplicationDelegate:` method itself.)
This doesn't add any new methods to the delegation; those will be added in a follow-up PR.
Also fixes a retain cycle in the termination handler that prevented the new test from working.
Most of https://github.com/flutter/flutter/issues/41471
[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
Fix issue 129765 and Add test case, see issue
Fixes https://github.com/flutter/flutter/issues/129765
- [â] I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
- [â] I read the [Tree Hygiene] wiki page, which explains my responsibilities.
- [â] I read and followed the [Flutter Style Guide] and the [C++, Objective-C, Java style guides].
- [â] I listed at least one issue that this PR fixes in the description above.
- [â] I added new tests to check the change I am making or feature I am adding, or Hixie said the PR is test-exempt. See [testing the engine] for instructions on writing and running engine tests.
- [â] I updated/added relevant documentation (doc comments with `///`).
- [â] I signed the [CLA].
- [ â] All existing and new tests are passing.
[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
- Introduce AndroidHardwareBufferTextureSourceVK.
- Enable the necessary Vulkan extensions to support
AndroidHardwareBufferTextureSourceVK.
- Refactor HardwareBufferExternalTextureGL into a base class and a GL
and VK specializations.
- Switch ImageReaderPlatformView to use the PRIVATE image format
(enables DRM'd content to be captured in the texture).
- Add a AHardwareBuffer_describe to NDKHelpers.
- Misc cleanups.
Previously, destruction of `Window` called `DestroyWindow`, which may
send `WM_KILLFOCUS` to the to-be-destroyed window. Because `Window`'s
destructor is called after `FlutterWindow`'s, the `FlutterWindow` vtable
was already destroyed at this point, and the subsequent call to the
virtual method `OnWindowStateEvent` would cause a crash. This PR
reintroduces the reverted changes for Windows lifecycle with a check
before calling the virtual method that the `FlutterWindow` object has
not yet been destructed.
https://github.com/flutter/flutter/issues/131872
*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
- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide] and the [C++,
Objective-C, Java style guides].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I added new tests to check the change I am making or feature I am
adding, or Hixie said the PR is test-exempt. See [testing the engine]
for instructions on writing and running engine tests.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [ ] I signed the [CLA].
- [x] All existing and new tests are passing.
If you need help, consider asking for advice on the #hackers-new channel
on [Discord].
<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#overview
[Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene
[Flutter Style Guide]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo
[C++, Objective-C, Java style guides]:
https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
[testing the engine]:
https://github.com/flutter/flutter/wiki/Testing-the-engine
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes
[Discord]: https://github.com/flutter/flutter/wiki/Chat
---------
Co-authored-by: Loïc Sharma <737941+loic-sharma@users.noreply.github.com>
This change removes GFX and Scenic dependencies from Fuchsia integration
tests. Mainly, it:
- swaps out `fuchsia.ui.scenic.Scenic/GetDisplayInfo` for
`fuchsia.ui.display.singleton.Info/GetMetrics`
- removes the no longer necessary `fuchsia.ui.scenic.Scenic` connections
and component manifest declarations from tests
- removes any extraneous build deps tests have on `fuchsia.ui.gfx`,
`fuchsia.ui.policy`, and `scenic_cpp`
Related bug: fxbug.dev/64206
## Pre-launch Checklist
- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide] and the [C++,
Objective-C, Java style guides].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I added new tests to check the change I am making or feature I am
adding, or Hixie said the PR is test-exempt. See [testing the engine]
for instructions on writing and running engine tests.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I signed the [CLA].
- [x] All existing and new tests are passing.
Adds testing that verifies that the engine is not retained via the FlutterTextureRegistry that is returned from the FlutterTextureRegistrar returned by the engine.
This also simplifies the existing test for a retain cycle via the FlutterBinaryMessenger by avoiding manually casting the binary messenger to a FlutterBinaryMessengerRelay, or knowing any of its implementation details.
Issue: https://github.com/flutter/flutter/issues/116445
[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
This change does the following:
- Refactors `engine.cc`/`.h` and `component_v2.cc`/`.h` to remove GFX ctors and callbacks.
- Removes `gfx_external_view_embedder`, `gfx_platform_view`, `gfx_session_connection`, their tests, and any supporting testing infrastructure (e.g. `fake_session`) from the build. This change does not delete the source files themselves in order to keep the change size smaller (as all these file deletions together are about another ~8K lines worth of deletions.) A separate follow up change will delete these files.
Related bug: fxbug.dev/64206
Previously, FlutterEngine.binaryMessenger returned the FlutterEngine
instance itself, which meant that channels/plugins could hold a strong
reference to the engine and thus cause a retain cycle, preventing the
engine from being deallocated.
We introduce FlutterBinaryMessengerRelay, which implements the
FlutterBinaryMessenger protocol, by delegating back to the engine, to
which it holds a weak reference, thus avoiding the retain cycle.
This also changes the FlutterBinaryMessengerRelay.parent property from
an assign property to a weak property since that code is compiled with
ARC enabled as of https://github.com/flutter/engine/pull/44395.
This patch also rearranges the headers to comply with our style guide:
related headers for this file, C headers, C++ headers, other Flutter
headers, in that order.
Fixes: https://github.com/flutter/flutter/issues/116445
When setting up the paths to assets and ICU data, we were previously returning the underlying char* data in a temporary string returned by `std::filesystem::path::string()`. Since the return value of `string()` is never stored, there's no guarantee that the underlying data pointer is still valid later in the function. By storing the string in a local whose lifetime exceeds that of the running engine instance, we guarantee the string isn't freed until after the Flutter app terminates.
[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
Fixes https://github.com/flutter/flutter/issues/130141
The primary goal of this patch is to move dispatching of `dart:ui` `Canvas` commands to the UI thread.
Before this patch, the architecture is something like:
## UI Thread
- `dart:ui` talks to `DisplayListBuilder`, a `DlCanvas` implementation.
- `DisplayListBuilder` does some clip/bounds tracking and creates a `DisplayList` object that is held by `dart:ui`'s `Picture` objects.
- `DisplayList`s are added to `DisplayListLayer`s in `flow`.
## Raster Thread
- `flow` flattens the various operations into a single `DisplayList` via another `DisplayListBuilder`.
- A `DlOpReceiver`implementation converts that `DisplayList` into an `Aiks` `Canvas`/`Picture`.
After this patch, the architecture instead looks like:
## UI Thread
- No change for Skia.
- If Impeller, use a new `DlCanvasImplementation` that talks to `Aiks`'s `Canvas`.
- If Impeller, `dart:ui` Picture's now hold an `Aiks` `Picture`, which get shared into `AiksLayer`s in `flow`.
## Raster thread
- No change for Skia, but some light refactoring for places that assumed a `DisplayListBuilder` where they really just needed a `DlCanvas`.
- The `Aiks` `Picture`s are combined using new API on `DlCanvas` and still backed by `Aiks`.
These changes show significant improvement on raster times on Android and only very small regressions on UI times in local testing, see https://gist.github.com/dnfield/26528090194c9f5abdbac13cdcbf4f79 for old gallery transition perf numbers.
Many of the other changes in this patch are related to the following:
- Making `DlRTree` usable for Impeller.
- It would be nice to have a version of DlRTree that speaks `impeller::Rect`.
- Creating the requisite classes to support `EmbeddedViews` so that Desktop works.
This patch does not remove the `impeller::DlDispatcher`, which now would only be used in tests.
Reverts flutter/engine#44301
```
Traceback (most recent call last):
File "/Volumes/Work/s/w/ir/cache/builder/src/flutter/testing/run_tests.py", line 1286, in <module>
sys.exit(main())
File "/Volumes/Work/s/w/ir/cache/builder/src/flutter/testing/run_tests.py", line 1269, in main
run_objc_tests(args.ios_variant, args.objc_filter)
File "/Volumes/Work/s/w/ir/cache/builder/src/flutter/testing/run_tests.py", line 721, in run_objc_tests
ensure_ios_tests_are_built(ios_out_dir)
File "/Volumes/Work/s/w/ir/cache/builder/src/flutter/testing/run_tests.py", line 625, in ensure_ios_tests_are_built
assert flutter_dylib_time <= ios_test_lib_time, final_message
AssertionError: /Volumes/Work/s/w/ir/cache/builder/src/out/ios_debug_sim_arm64_extension_safe/libios_test_flutter.dylib is older than /Volumes/Work/s/w/ir/cache/builder/src/out/ios_debug_sim_arm64_extension_safe/libFlutter.dylib. Please run the following commands:
gn --ios --unoptimized --runtime-mode=debug --no-lto --simulator
ninja -C /Volumes/Work/s/w/ir/cache/builder/src/out/ios_debug_sim_arm64_extension_safe ios_test_flutter
```
It failed we in run_test.py we check if the ios_test is built after the framework, which is not true anymore after moving the test inside the build target.
We have tests today that are trying to testwith impeller but using software rendering, so they're not actually testing with impeller.
In an unrelated patch, I'm causing the request to enable impeller to have additional checks that Impeller related objects/configurations are set when using Impeller, which isn't true if software rendering is enabled, and is causing the tests getting disabled here to fail.
The tests are not actually testing Impeller and thus are getting added to the skip list (they now crash with this change). https://github.com/flutter/flutter/issues/131888 tracks re-enabling them. They will almost certainly need different golden files than the Skia ones.
Fixes https://github.com/flutter/flutter/issues/131887
Previously, some common Darwin framework targets existed in:
//flutter/shell/platform/darwin/BUILD.gn
This moves all targets into:
//flutter/shell/platform/darwin/common/BUILD.gn
The framework_shared target has been renamed framework_common for consistency with the directory name, and flutter_channels_unittests has been renamed framework_common_unittests since it's a reasonable target for adding other tests of common framework code.
We also de-duplicate targets with existing targets.
* The `flutter_channels` target duplicates the existing
`framework_shared` target.
* The `common` target already includes the buffer conversions
translation units,
which are only used by the iOS embedder.
No test changes since there are no semantic changes, just a
restructuring of build targets.
## Pre-launch Checklist
- [X] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [X] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [X] I read and followed the [Flutter Style Guide] and the [C++,
Objective-C, Java style guides].
- [X] I listed at least one issue that this PR fixes in the description
above.
- [ ] I added new tests to check the change I am making or feature I am
adding, or Hixie said the PR is test-exempt. See [testing the engine]
for instructions on writing and running engine tests.
- [X] I updated/added relevant documentation (doc comments with `///`).
- [X] I signed the [CLA].
- [X] All existing and new tests are passing.
If you need help, consider asking for advice on the #hackers-new channel
on [Discord].
<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#overview
[Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene
[Flutter Style Guide]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo
[C++, Objective-C, Java style guides]:
https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
[testing the engine]:
https://github.com/flutter/flutter/wiki/Testing-the-engine
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes
[Discord]: https://github.com/flutter/flutter/wiki/Chat
The existing `screenIfViewLoaded` and `windowSceneIfLoaded` functions are private helpers of `FlutterViewController` class. This PR moves the logic to a category of the `UIViewController`, so it can be reused for any `UIViewController`s.
*List which issues are fixed by this PR. You must list at least one issue.*
https://github.com/flutter/engine/pull/43972#discussion_r1282214557
*If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].*
[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
Introduce TextureRegistry.ImageTexture and related machinery.
Introduce ImageReaderPlatformViewRenderTarget.
Introduce HardwareBufferExternalTextureGL and related machinery.
NOTE: ImageReaderPlatformViewRenderTarget requires Android 26.
NOTE: This CL does not enable using ImageReaderPlatformViewRenderTarget
yet.
Related https://github.com/flutter/flutter/issues/130892
---------
Co-authored-by: Jason Simmons <jsimmons@google.com>
Previously, when setting the binary messenger to the current binary messenger, we were freeing the current binary messenger before setting the new (current) binary messenger, triggering a use after free.
[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
In native iOS, users are able to select text and initiate a web search on the selected text. Specifically, this will launch a search using the users selected default search engine. Apple provides a custom url scheme in the form of "x-web-search://?[term]" which will automatically launch a search using the user's preferred browser in Safari. Additionally, this also correctly handles the country code top level domain eg. a user with a selected region in the UK with a preferred Google search engine will automatically have the .co.uk domain appended to the end of the search.
This PR is the engine portion of the changes that will allow Search Web to be implemented
This PR addresses https://github.com/flutter/flutter/issues/82907
More details are available in this [design doc](https://github.com/flutter/engine/pull/flutter.dev/go/add-missing-features-to-selection-controls)
This PR disables the "auto-correction highlight" feature in iOS 17.
This feature was introduced in https://github.com/flutter/flutter/pull/45354 and https://github.com/flutter/engine/pull/13959/ (CC: @LongCatIsLooong who was the original author)
I have created [a new issue](https://github.com/flutter/flutter/issues/131622) to find other approaches to re-enable this feature.
**Note that "auto-correction" itself still works, it's only the "highlight" part is disabled:**
- iOS 16 with highlight:
https://github.com/flutter/engine/assets/41930132/2fe7bbf6-f2db-4212-a020-e420ad8dd5e6
- iOS 17 without highlight:
https://github.com/flutter/engine/assets/41930132/34f34743-6bef-4e93-80d2-d04c92ba59bf
## Why disable this feature?
The original PR uses `UITextInput::firstRectForRange` API for auto-correction, since Apple does not provide any other API when auto-correction should show up, so the original PR used this API as a workaround.
In iOS 17, Apple changed a few `UITextInput` behaviors:
- UIKit does not query `UITextInput::firstRectForRange` for text range of the auto-corrected word any more.
- But instead, it repeatedly queries every single character of the current word (after entering or deleting a character), regardless whether the word should be auto-corrected or not.
I have tried all other `UITextInput` APIs that takes a text range, and none are suitable for auto-correction feature. As a result, I have to disable this feature for iOS 17 for now.
*List which issues are fixed by this PR. You must list at least one issue.*
Fixes https://github.com/flutter/flutter/issues/128406
*If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].*
[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
Introduce TextureRegistry.ImageTexture and
HardwareBufferExternalTextureGL
- Introduce TextureRegistry.ImageTexture and related machinery.
- Introduce HardwareBufferExternalTextureGL and related machinery.
- Introduce ImageReaderPlatformViewRenderTarget.
NOTE: ImageReaderPlatformViewRenderTarget requires Android 26.
NOTE: This CL does not enable using ImageReaderPlatformViewRenderTarget
yet.
Additional fixes:
- Relax JNI lookup for classes and methods that aren't available in API
22
- Add @Keep annotations on code that is only referenced by JNI
- Introduce TextureRegistry.ImageTexture and related machinery.
- Introduce ImageReaderPlatformViewRenderTarget.
- Introduce HardwareBufferExternalTextureGL and related machinery.
NOTE: ImageReaderPlatformViewRenderTarget requires Android 26.
NOTE: This CL does not enable using ImageReaderPlatformViewRenderTarget
yet.
Related https://github.com/flutter/flutter/issues/130892