5961 Commits

Author SHA1 Message Date
Gray Mackall
dab310ecb8 Manual revert of #53001 (flutter/engine#53075)
Revert label failed due to conflicts

`FlutterFragmentTest.java` was the only file that had merge issues, everything else is the output of `git revert 802e5d2cd3c9e73f336e3fe43487b64a5fdf98d8`

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-05-28 23:00:20 +00:00
Justin McCandless
6dfec16435 FlutterFragment predictive back (flutter/engine#52302)
Android add-to-app apps now support predictive back when going between Activities or back to the home screen. Predictive back route transitions within the Flutter part of the app are not yet supported.
2024-05-28 12:52:05 -07:00
Gray Mackall
802e5d2cd3 Upgrade all[most] androidx dependencies to latest (flutter/engine#53001)
Upgrades every `androidx` dependency in the `src/third_party/android_embedding_dependencies` bundle to the latest version, except the `lifecycle` group*. Tested running a couple of apps as well because when updating these dependencies in the past I've been able to build the engine but then flutter run fail when trying to run an app.

Fixes https://github.com/flutter/flutter/issues/129307, also unblocks a feature that will eventually be needed for Scribe.

[*]`2.8.0` is the latest there, but I ran into an issue with dexing when I tried to upgrade, due to b/336164417, an AGP bug that had its fix backported to all >`8.0.0` versions, but we still support less than that so we will have to wait on that upgrade.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-05-28 16:58:59 +00:00
johnniwinther
43149fdc24 Remove use of --nnbd-agnostic (flutter/engine#53055)
The Dart VM no longer supports unsound null safety, so we don't need to
generate the platform in agnostic mode.
2024-05-28 10:07:40 +02:00
Byoungchan Lee
d56c301037 Add Linux platform support for fetching refresh rate on startup. (flutter/engine#52934)
This patch addresses the missing implementation of
`platformDispatcher.views` on Linux. It checks the refresh rate of the
renderer's window and returns the value. Without this implementation,
`WidgetsBinding.instance.platformDispatcher.views.first.display.size`
would throw an exception on Linux, preventing safe usage.

Related: https://github.com/flutter/flutter/issues/144230
2024-05-28 12:38:07 +12:00
Chinmay Garde
c8a7439178 Rename Skia specific TUs. (flutter/engine#52855)
Fixes https://github.com/flutter/flutter/issues/148235
2024-05-24 18:40:18 +00:00
John McCutchan
c397bc6dc8 Fix another instance of platform view breakage on Android 14 (flutter/engine#52980)
When you background an activity via the back-gesture the onTrimMemory callback is not invoked but the buggy Android behaviour still occurs.

Workaround this by faking an onTrimMemory callback in the `Activity#onStop` callback.

Fixes #148662
Related #146499

Tested manually on a Pixel 7 Pro running Android 14.
2024-05-22 17:21:06 +00:00
Brandon DeRosier
2ffd763cfb [Impeller] Reland: Remove Entity capture/AiksInspector. (flutter/engine#52932)
Resolves https://github.com/flutter/flutter/issues/134748.

This was a really fun experiment. I learned a lot from it, and it
genuinely helped me solve some coverage-related problems, but the
reality is it was too little too late -- by the time we had this
capture system, we had already solved most of the problems that would
have benefitted from this.

It's been a few months since I've used or extended the capabilities of
this capture system for something, and I don't have the spare
time/energy to give it the love it needs to realize the vision I had
for it. I still almost exclusively use a combination of native frame
captures and print debugging to solve problems.

RIP in peace.

This reverts commit 104eb98e62. (https://github.com/flutter/engine/pull/52680)
2024-05-21 00:59:14 +00:00
Matan Lurey
1bfe32e757 Issue anERROR instead of an INFO for a non-working API. (flutter/engine#52892)
Work towards https://github.com/flutter/flutter/issues/139702.

I think we should also `@Deprecate`/cleanup the API surface in
`FlutterView`, but that needs a bit more a discussion.

/cc @johnmccutchan
2024-05-17 08:40:45 -07:00
auto-submit[bot]
ea811b97ba Reverts "Manual roll of Clang from 725656bdd885 to 145176dc0c93 (#52823)" (flutter/engine#52890)
Reverts: flutter/engine#52823
Initiated by: zanderso
Reason for reverting: Engine crashes on framework CI following this roll https://ci.chromium.org/ui/p/flutter/builders/prod/Linux_android%20flutter_gallery__transition_perf_with_semantics/12126/overview
Original PR Author: jason-simmons

Reviewed By: {zanderso}

This change reverts the following previous change:
See https://github.com/flutter/flutter/issues/143178
2024-05-16 22:01:38 +00:00
Jason Simmons
31d7cb2870 Manual roll of Clang from 725656bdd885 to 145176dc0c93 (flutter/engine#52823)
See https://github.com/flutter/flutter/issues/143178
2024-05-16 17:16:21 +00:00
Jenn Magder
bae1009cd1 Migrate TextInputSemanticsObject to ARC (flutter/engine#52785)
1. Migrate TextInputSemanticsObject to ARC
2. Rename the Objective-C-only `accessibility_text_entry.*` files to `TextInputSemanticsObject.*`
3. Move `FlutterInactiveTextInput` interface from the header file into the implementation, the only place it's used.

Blocked on `SemanticsObject` ARC migration https://github.com/flutter/engine/pull/52824

Part of https://github.com/flutter/flutter/issues/137801.
2024-05-15 19:10:24 +00:00
Jenn Magder
a4dc4d92ba Migrate SemanticsObject and FlutterSemanticsScrollView to ARC (flutter/engine#52824)
On top of the `SemanticsObject` refactor https://github.com/flutter/engine/pull/52729 migrate `SemanticsObject` and `FlutterSemanticsScrollView` to ARC.

Part of https://github.com/flutter/flutter/issues/137801.
2024-05-15 04:23:25 +00:00
Gray Mackall
b6bb39ad2d Fix non-vd android platform view input event offsets (flutter/engine#52532)
Fixes https://github.com/flutter/flutter/issues/146570, which tracks a regression from https://github.com/flutter/engine/pull/49268 regarding platform view inputs in some specific cases.

This PR translates the input event location to be the same as the location we calculated before https://github.com/flutter/engine/pull/49268, returning to the previous behavior, while maintaining the input event's verified status (I checked this manually with the `InputManager`).

Tested manually with the reproduction in the linked issue.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-05-14 23:07:53 +00:00
Jenn Magder
e4e7b3242e Refactor Semantics in preparation for ARC migration (flutter/engine#52729)
Split the too-large `Semantics` [MRC to ARC migration](https://github.com/flutter/flutter/issues/137801) into two PRs: this one, which refactors, and the next which will actually do the migration.

1. Use properties instead of their backing ivars (except in the usual init, dealloc, getters/setters)
2. For Foundation collections prefer `copy` over `strong`.
3. Dot notation for properties
4. Change `privateSetParent:` to instead use a `readwrite` property in `SemanticsObject ()`. 
5. Switch the `semanticsObject` property from `weak` to `retain` to get the synthesized property (keeping it as `weak` is a compilation error in MRC) but I'll swap it back to a `weak` in the ARC migration PR coming next.
6. `SemanticsObjectTest` fails on my machine and passes on CI.  Switched the cleaner `CGRectEqualToRect` (and related) checks to instead assert x, y, width, height so we can see the value when it fails:
```
((CGSizeEqualToSize( scrollView.contentSize, CGSizeMake((w + scrollExtentMax) * effectivelyScale, h * effectivelyScale))) is true) failed
```
becomes:
```
((scrollView.contentSize.height) equal to (h * effectivelyScale)) failed: ("33.3333333333") is not equal to ("33.333336")
```
Use `XCTAssertEqualWithAccuracy` now that I can see it's a floating point precision issue.
2024-05-14 16:30:52 +00:00
Dustin Green
cb40a91c25 [fuchsia][sysmem2] route fuchsia.sysmem2.Allocator (flutter/engine#52708)
Route fuchsia.sysmem2.Allocator everywhere that
fuchsia.sysmem.Allocator is routed.

fixes flutter/flutter#146858
2024-05-13 19:24:46 -07:00
Chinmay Garde
f3934883b0 Delete Settings::msaa_samples. (flutter/engine#52780)
Fixes https://github.com/flutter/flutter/issues/148257
2024-05-13 23:51:11 +00:00
Jenn Magder
ea38b72a0d ios_external_view_embedder to ARC (flutter/engine#52782)
`ios_external_view_embedder` is only C++ and there was nothing to migrate.

Also add a few missing `FLUTTER_ASSERT_ARC` macros.

Part of https://github.com/flutter/flutter/issues/137801.
2024-05-13 23:14:10 +00:00
Chinmay Garde
f20b17a2ae [Impeller] Prepare a SkiaGPU-less iOS build. (flutter/engine#52748)
The size of the LTO build of the engine with the dylib compressed is as follows:

```sh
$ du -k libFlutter*
5236	libFlutter.dylib.tar.gz
4324	libFlutterSlimpeller.dylib.tar.gz
```

Sizes are in KiB. This represents a binary size reduction of 17.41% of the compressed artifacts. The compression ratios will likely differ based on the compression scheme.

Uncompressed, the sizes are:

```sh
$ du -k libFlutter*
16920	libFlutter.dylib
14044	libFlutterSlimpeller.dylib
```

This represents a binary size reduction of 16.99% which is in the same ballpark.

The really mucky bit was backing out the raster cache and persistent cache. I want to clean that up in a later patch so that those TUs are part of a separate submodule.

Opting out of Impeller will lead to a fatal log at startup saying the opt-out is disallowed.

Fixes https://github.com/flutter/flutter/issues/126606
2024-05-13 21:43:47 +00:00
Jenn Magder
4261e6bab1 Remove -[NSNotificationCenter removeObserver:] in deallocs (flutter/engine#52772)
Removing `NSNotificationCenter` observers in dealloc hasn't been necessary since iOS 8 or macOS 10.10.

> If your app targets iOS 9.0 and later or macOS 10.11 and later, and you used [addObserver:selector:name:object:](https://developer.apple.com/documentation/foundation/nsnotificationcenter/1415360-addobserver), you do not need to unregister the observer. If you forget or are unable to remove the observer, the system cleans up the next time it would have posted to it.

https://developer.apple.com/documentation/foundation/nsnotificationcenter/1413994-removeobserver

Remove it.
2024-05-13 20:50:42 +00:00
Jenn Magder
48ea1c2f79 Migrate FlutterDartProject and FlutterPluginAppLifeCycleDelegate to ARC (flutter/engine#52719)
- Migrate `FlutterDartProject` and `FlutterPluginAppLifeCycleDelegate` from MRC to ARC.  
- Swap a few dictionary `objectForKey:` to subscripting.
- Header cleanup.
- Cleanup build DEPS.

Part of https://github.com/flutter/flutter/issues/137801.
2024-05-13 19:16:16 +00:00
Jonah Williams
578e769483 [Impeller] treat glyph atlas texture as source of truth, remove copy of SkBitmap. (flutter/engine#52567)
Work towards part of https://github.com/flutter/flutter/issues/138798

Allow updating single glyphs in the glyph atlas, without replacing the entire bitmap. Required to efficiently append/update to large atlases.
2024-05-10 21:39:47 +00:00
Jenn Magder
c24f7454d0 Migrate FlutterView, FlutterPlatformViews, FlutterOverlayView to ARC (flutter/engine#52535)
Smart pointers support ARC as of
https://github.com/flutter/engine/pull/47612, and the unit tests were
migrated in https://github.com/flutter/engine/pull/48162.

Migrate `FlutterView`, `FlutterPlatformViews`, and `FlutterOverlayView`
from MRC to ARC.

Part of https://github.com/flutter/flutter/issues/137801.
2024-05-10 12:07:30 -07:00
Kihara, Takuya
fbab4c0057 [iOS] Fix App crash when use WebView with iOS VoiceOver (flutter/engine#52484)
This PR fix the issue [flutter/flutter
#140528](https://github.com/flutter/flutter/issues/140528).

This fix cleans up declarations regarding `retain` and `release`.
`flutterAccessibilityContainer` needs to be managed in
`FlutterPlatformViews.mm`, and problems will occur if `retain` or
`release` is performed in `SemanticsObject.mm`.

This fix is checked by the `testFlutterPlatformViewSemanticsContainer`
function in the `SemanticsObjectTest.mm`.
The result is not changed.

## 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 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 `///`).
- [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
[test-exempt]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#tests
[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
2024-05-09 20:40:41 -07:00
Jenn Magder
d4f698b036 Fix UIVisualEffectView leak in platform view filter (flutter/engine#52591)
I found this while migrating `FlutterPlatformViews_Internal.mm` to ARC https://github.com/flutter/engine/pull/52535.  I'll land this first.

```objc
  if (_backdropFilterView != visualEffectView) {
    _backdropFilterView = [visualEffectView retain];
  }
```
should instead be something like:
```objc
  if (_backdropFilterView != visualEffectView) {
    id oldBackdropFilterView = _backdropFilterView;
    _backdropFilterView = [visualEffectView retain];
    [oldBackdropFilterView release];
  }
```
But that's already what the built-in MRC `nonatomic, retain` property setter does, so use that instead.

Added a test that passes on this PR and fails on main.
2024-05-08 22:40:16 +00:00
gaaclarke
104eb98e62 Revert 7130c5c3b3f16d549bca6b81c51c751780c454d4 (flutter/engine#52680)
reverts https://github.com/flutter/engine/pull/52526
fixes https://github.com/flutter/flutter/issues/147989

That PR has broken playgrounds.  It's non essential so we can revert it an bdero can take a look whenever he gets another chance.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-05-08 18:27:32 +00:00
Jonah Williams
0fefa45af5 [Impeller] support requires readback from onscreen texture in experimental canvas. (flutter/engine#52640)
This doesn't yet add support for backdrop filters or emulated advanced blends, but will allow them to work if `surface_frame.framebuffer_info().supports_readback` is true.

part of https://github.com/flutter/flutter/issues/142054
2024-05-08 05:06:09 +00:00
Jonah Williams
5a028e336d [Impeller] eagerly bootstrap content context. (flutter/engine#52590)
![image](https://github.com/flutter/engine/assets/8975114/5238d169-a68b-4905-848b-3ee7a7972de8)

Work around for https://github.com/flutter/flutter/issues/143540 by running shader bootstrap as early as possible. I was looking at this code for unrelated reasons (include removal) and realized it would be a trivial change.

If we're using the KHR swapchain instead of the AHB swapchain, in theory the pixel format could change but since we hash the pixel format the only bad thing would be the wasted work.
2024-05-07 03:05:18 +00:00
Jason Simmons
c1e5a9c1a3 Migrate third_party/android_tools to flutter/third_party (flutter/engine#52582)
Continuation of https://github.com/flutter/engine/pull/52034
2024-05-06 20:54:06 +00:00
Dustin Green
561a3c968b [fuchsia] route fuchsia.sysmem2.Allocator pt 2 (flutter/engine#52509)
Fuchsia's fake-display will be migrating to sysmem2, which requires
fuchsia.sysmem2.Allocator to be routed.

fixes https://github.com/flutter/flutter/issues/146858
2024-05-02 18:43:30 -07:00
Brandon DeRosier
7130c5c3b3 [Impeller] Remove Entity capture/AiksInspector. (flutter/engine#52526)
Resolves https://github.com/flutter/flutter/issues/134748.

This was a really fun experiment. I learned a lot from it, and it genuinely helped me solve some coverage-related problems, but the reality is it was too little too late -- by the time we had this capture system, we had already solved most of the problems that would have benefitted from this.

It's been a few months since I've used or extended the capabilities of this capture system for something, and I don't have the spare time/energy to give it the love it needs to realize the vision I had for it. I still almost exclusively use a combination of native frame captures and print debugging to solve problems.

RIP in peace.
2024-05-03 01:08:22 +00:00
Ian Hickson
8966c48831 Remove rasterizerTracingThreshold, checkerboardRasterCacheImages, and checkerboardOffscreenLayers, etc (flutter/engine#52446) 2024-05-02 04:35:04 +00:00
Jenn Magder
374dc4a4e3 Migrate PlatformMessageHandlerIos to ARC (flutter/engine#52226)
Smart pointers support ARC as of https://github.com/flutter/engine/pull/47612, and the unit tests were migrated in https://github.com/flutter/engine/pull/48162.

Migrate `PlatformMessageHandlerIos` from MRC to ARC.  Clean up the `#include`s.

Part of https://github.com/flutter/flutter/issues/137801.
2024-05-01 21:07:07 +00:00
chunhtai
c4415fb8e0 macOS fluttertextinputplugin drops selector called if no client (flutter/engine#52495)
The observed behavior is that if a keypress both reach framework and flutter textinputplugin selector and the keypress handler in framework causes the the textinputplugin to resign first responder, the selector will still go through even if the textinputplugin has already resigned.

The pr makes it so textinputplugin will ignore these selector call

fixes https://github.com/flutter/flutter/issues/143270

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-05-01 20:57:39 +00:00
Chinmay Garde
6115e5ac3a [Impeller] Wire up hardware buffer backed swapchains on Android. (flutter/engine#52087)
This wires up Android Hardware Buffer backed swapchains on platform that support
it (Android >= 29) with a KHR swapchain fallback (which can be removed later to
save on some binary size if needed).

Some salient features of these swapchains and their differences with the KHR
variant:

* All swapchain images are guaranteed to R8G8B8A8. This could potentially allow
  for earlier creation of the context and the PSO libraries.
* All swapchain allocations are lazy. This should greatly reduce the time it
  takes to create and resize a swapchain. However, swapchain image acquisition
  may take longer for the first few frame where there is no pre-pooled image
  available. Resizes should be similarly faster since the swapchain images for
  the intermediate sizes are never created.
* Swapchain transients allocations (the attachments for the root render target)
  are also lazily allocated.
* Swapchain images are pool and reused. The size of the pool is user specified
  (currently 2). If an image in the pool ages past a user supplied value
  (currently 1 second), it is collected as well. Applications that don't render
  frames for a long period of time should see less memory use because of
  swapchain image allocations.
* The present mode of AHB swapchains behave similar to KHR swapchains but with
  VK_PRESENT_MODE_MAILBOX_KHR. In cases where there is no application managed
  frame pipelining, this might cause images to never be presented if a newer
  image is available. This wasted work can only be avoided by application
  provided pipelining.
* There are no client side waits during image presentation. Instead, a new type
  of fence is wired up that exports its state as a sync file descriptor. The
  fence signal operation is enqueued on the client side and the buffer is set on
  the surface control. The presentation engine then performs the wait.
* On Qualcomm devices, Chromium seems to be setting vendor specified flags for
  opting the hardware buffers into using UBWC. AFAICT, this is similar to AFBC
  (and NOT AFRC) on ARM Mali. This has not been wired up since I don't have a
  Qualcomm device at the moment and cant verify bandwidth use using GPU
  counters. I would also like to verify that UBWC is safe to use to images that
  can be used as input attachments.
2024-05-01 19:54:13 +00:00
gaaclarke
4429b2f2fe [Impeller] Implements retry for Picture.toImage (flutter/engine#52470)
fixes https://github.com/flutter/flutter/issues/146990

## 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 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
[test-exempt]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#tests
[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
2024-05-01 08:53:54 -07:00
John McCutchan
845c75ce6c Workaround HardwareRenderer breakage in Android 14 (flutter/engine#52370)
- Destroy ImageReaders on memory trim.
- Unset the VirtualDisplay's surface on memory trim.
- On resume, recreate ImageReaders.
- On resume, do a dumb little dance and then set the VirtualDisplay's surface

Fixes: https://github.com/flutter/flutter/issues/146499
Fixes: https://github.com/flutter/flutter/issues/144219

Internal bug: b/335646931
Android Fix: https://googleplex-android-review.git.corp.google.com/c/platform/frameworks/base/+/27015418

Android 15 will include the fix. Unclear if Android 14 will be patched.
2024-04-30 05:09:05 +00:00
Zachary Anderson
448613ae74 Remove references to goma (flutter/engine#52411)
This removes goma most places except for the arguments to the `gn`
script, which are referenced by recipes. This does not remove goma
capabilities from the GN build entirely. That requires changes in the
buildroot which have to be staged after this change.
2024-04-29 09:40:16 -07:00
Robert Ancell
2ab69c9f42 Use a AT-SPI socket/plug to export the Flutter accessibility state. (flutter/engine#52355)
This will be useful when using GTK4, which doesn't support custom a11y
code in GTK and will require the Flutter code to be exported in a plug.
2024-04-29 09:34:20 +12:00
Jonah Williams
584a0394aa [Impeller] remove image upload from IO thread, limit concurrent worker threads. (flutter/engine#52423)
Fixes https://github.com/flutter/flutter/issues/123058
Fixes https://github.com/flutter/flutter/issues/135443

We're currently using the IO thread to bottleneck image uploads. Instead, just use fewer concurrent worker threads - and cap the limit at something small. For a Pixel device, this should use about 2 threads maximum, instead of  5 (4 worker and 1 IO).
2024-04-28 17:22:15 +00:00
Tong Mu
94448fc97f Move PointerDataPacketConverter from PlatformView to RuntimeController (flutter/engine#51952)
This is a refactor that moves the `PointerDataPacketConverter` from `PlatformView` to `RuntimeController`. 

This change is made for the following reasons:
- Currently, the pointer data conversion contains no platform specific logic (because the current converter's only responsibility is to make the event sequence conform Flutter's protocol). Therefore these logics should reside in a platform-independent place.
- The converter typically converts one event to many. It's better to have this conversion later than earlier.
- It removes a member from `PlatformView`, making it closer to a pure virtual class.

The reason to choose `RuntimeController` as the destination is because `RuntimeController` manages a map for views, which is required for the converter to implement a later patch https://github.com/flutter/engine/pull/51925.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-04-26 23:45:21 +00:00
Dustin Green
1bdc2a83c6 [fuchsia] route fuchsia.sysmem2.Allocator (flutter/engine#52187)
Fuchsia's fake-display will be migrating to sysmem2, which requires fuchsia.sysmem2.Allocator to be routed in a few places.

fixes flutter/flutter#146858

- [y] I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
- [y] I read the [Tree Hygiene] wiki page, which explains my responsibilities.
- [na] I read and followed the [Flutter Style Guide] and the [C++, Objective-C, Java style guides].
- [y] I listed at least one issue that this PR fixes in the description above.
- [fixes to existing tests] I added new tests to check the change I am making or feature I am adding, or the PR is [test-exempt]. See [testing the engine] for instructions on writing and running engine tests.
- [na] I updated/added relevant documentation (doc comments with `///`).
- [na / googler] I signed the [CLA].
- [y] All existing and new tests are passing.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-04-26 20:05:09 +00:00
Jason Simmons
bef76e554e Fix function type cast warnings for macOS embedder callbacks (flutter/engine#52377)
The latest version of Clang is reporting warnings from the -Wcast-function-type-mismatch check when a function taking a __strong pointer parameter is converted to a void* parameter.
2024-04-26 15:28:11 +00:00
Jonah Williams
45d5af365f [Impeller] Vulkan validation off by default. (flutter/engine#52397)
Fixes https://github.com/flutter/flutter/issues/142659

can be turned on via --enable-vulkan-validation cmd line flag.
2024-04-25 21:04:04 +00:00
Jonah Williams
9dbe934a9b [Impeller] kick off registration and initial PSO compilation of runtime effect earlier. (flutter/engine#52381)
I thought about changing this API so that it blocks on compilation, but I think that isn't necesasary as the workload can happen while the UI thread is building. Plus, even blocking on shader completion does not guarantee that we won't need to compile a variant anyway.

While I was at it I moved the descriptor sets computation to the runtime effect constructor.

With this change the pipleine variant used during the frame is produced much faster than the initial 12ms compilation.

![image](https://github.com/flutter/engine/assets/8975114/42626676-0a71-4503-a3e9-4109c36fbbef)

Fixes https://github.com/flutter/flutter/issues/113719
Fixes https://github.com/flutter/flutter/issues/141222
2024-04-25 20:23:56 +00:00
Tong Mu
43fed272aa [macOS] Remove extra setViewController and extra import (flutter/engine#52255)
This stub PR removes and extra `setViewController`, which is unnecessary because the view controller's initializer already attaches itself to the engine.

This PR also removes an extra import since `FlutterCompositor` is not used in the engine's definition. As a result, `FlutterEngineTest.mm` needs to import it explicitly.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-04-25 00:26:12 +00:00
Victoria Ashworth
f2c245f93e Remove UIAccessibilityTraitKeyboardKey to fix touch typing (flutter/engine#52333)
`UIAccessibilityTraitKeyboardKey` was added in https://github.com/flutter/engine/pull/4575 so that `TextInputSemanticsObject` supported VoiceOver gestures for text editing features, such as pinch to select text, and up/down fling to move cursor. After experimenting with it, I found that those features were still available even after removing `UIAccessibilityTraitKeyboardKey`. 

Fixes https://github.com/flutter/flutter/issues/94465.

In Touch Typing Mode:

https://github.com/flutter/engine/assets/15619084/ccfe90ff-d3bc-427b-b1aa-9ec1242c0c89

In Standard Typing Mode:

https://github.com/flutter/engine/assets/15619084/c78b1fb0-0816-41fb-9dd5-ed8b8a4cda2d

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-04-24 21:05:13 +00:00
Byoungchan Lee
011c50a4c5 [darwin] Update pixel format handling in FlutterTexture (flutter/engine#52326)
CVPixelBuffers from the application can have arbitrary pixel formats. However, current implementation doesn't support all pixel formats. To address this, add a comment to the FlutterTexture class to clarify which pixel formats are supported. Also, reject unsupported pixel formats so that the application can handle them properly.

Fixes [#147242](https://github.com/flutter/flutter/issues/147242).

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-04-24 18:10:17 +00:00
Jenn Magder
382620c0ef Migrate ios_surface files to ARC (flutter/engine#52139)
Smart pointers support ARC as of https://github.com/flutter/engine/pull/47612, and the unit tests were migrated in https://github.com/flutter/engine/pull/48162.

Migrate `ios_surface` classes from MRC to ARC.

Decorate C functions that take or return Objective-C objects or structs containing Objective-C objects with [`cf_audited_transfer`](https://clang.llvm.org/docs/AutomaticReferenceCounting.html#auditing-of-c-retainable-pointer-interfaces).  

Part of https://github.com/flutter/flutter/issues/137801.
2024-04-24 17:54:09 +00:00
Jason Simmons
b84c057bfb Fix some warnings reported by recent versions of clang-tidy (flutter/engine#52349)
* Invalid enum values in the embedder library
* Disable a check that warns about standard usage of GTK macros in the Linux embedder
2024-04-24 17:46:19 +00:00