5234 Commits

Author SHA1 Message Date
auto-submit[bot]
4c30aee50a Reverts "[ios][platform_view] Use CAShapeLayer as the mask to avoid software rendering (#53072)" (flutter/engine#53220)
Reverts: flutter/engine#53072
Initiated by: jason-simmons
Reason for reverting: compilation errors on iOS targets

```
FlutterPlatformViews_Internal.mm:277:10: error: ARC forbids explicit message send of 'dealloc'
  277 |   [super dealloc];
      |    ~~~~~ ^
 ```

(see https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8746006425774972161/+/u/build_ci_ios_debug_unopt_sim_flutter_testing_scenario_app_flutter_shell_platform_darwin_ios:ios_test_flutter/st
Original PR Author: hellohuanlin

Reviewed By: {cbracken, jonahwilliams}

This change reverts the following previous change:
This PR uses `CAShapeLayer` as the mask to avoid software rendering. 

I kept `UIView` as the mask, so that we can measure just the improvement related to avoiding software rendering. This also allows me to land this change sooner. I created [a separate issue](https://github.com/flutter/flutter/issues/149212) to track removing UIView as the mask. 

Note: the previous behavior seems to be incorrect (or at least not pixel perfect). This PR fixed it. See comments. 

See design doc: https://docs.google.com/document/d/1TqG_N4GK_qctuk73Gk3zOdAiILUrwMqxoCMgroK_AeA/edit?resourcekey=0-jUiidfzIS642ngG2w9vSUA&tab=t.0

*List which issues are fixed by this PR. You must list at least one issue.*

Fixes https://github.com/flutter/flutter/issues/142813
Fixes https://github.com/flutter/flutter/issues/142830

*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
2024-06-05 14:26:47 +00:00
hellohuanlin
d1f28a74ae [ios][platform_view] Use CAShapeLayer as the mask to avoid software rendering (flutter/engine#53072)
This PR uses `CAShapeLayer` as the mask to avoid software rendering. 

I kept `UIView` as the mask, so that we can measure just the improvement related to avoiding software rendering. This also allows me to land this change sooner. I created [a separate issue](https://github.com/flutter/flutter/issues/149212) to track removing UIView as the mask. 

Note: the previous behavior seems to be incorrect (or at least not pixel perfect). This PR fixed it. See comments. 

See design doc: https://docs.google.com/document/d/1TqG_N4GK_qctuk73Gk3zOdAiILUrwMqxoCMgroK_AeA/edit?resourcekey=0-jUiidfzIS642ngG2w9vSUA&tab=t.0

*List which issues are fixed by this PR. You must list at least one issue.*

Fixes https://github.com/flutter/flutter/issues/142813
Fixes https://github.com/flutter/flutter/issues/142830

*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
2024-06-05 02:40:23 +00:00
victorgalo
2b309db996 Add support for setting the heading level for web semantics (#97894) (flutter/engine#41435)
This change adds a new property in Semantics widget that would take an integer value corresponding to the heading levels defined by the ARIA heading role. This is necessary in order to get proper accessibility and usability in a website for users who rely on screen readers and other assistive technologies.

Issue fixed by this PR:
https://github.com/flutter/flutter/issues/97894

Framework part:
https://github.com/flutter/flutter/pull/125771
2024-06-04 23:11:17 +00:00
Jonah Williams
b01c5c3002 [Impeller] wire up bdf and blend detection in experimental canvas. (flutter/engine#53151)
Use the flags in https://github.com/flutter/engine/pull/53104 + context capabilities to determine if we need to begin the first pass as an offscreen.

Part of https://github.com/flutter/flutter/issues/142054
2024-06-04 21:10:01 +00:00
bufffun
507326a5f2 [macOS] Fix FlutterView cursor hit testing (flutter/engine#53171)
fix cursor hit testing in platform view in #52159

We found that the mechanism of `[NSView hitTest: view] `will handle the
flip coordinate automatically. In the previous PR, because the superview
of FlutterView was not flipped, we should not convert the point using
`[self convertPoint:event.locationInWindow fromView:nil]` .The
FlutterView hit test should run under the window coordinate system;
otherwise, FlutterMutatorView will hit a wrong point.

Before the fix:
Actual mouse move: `event.locationInWindow (x = 47.45703125, y =
416.86328125)`
FlutterView HitTest: `(NSPoint) point = (x = 47.45703125, y =
203.13671875)`
FlutterMutatorView HitTest: `(NSPoint) point = (x = 47.45703125, y =
416.86328125)`

After the fix:
Actual mouse move: `event.locationInWindow (x = 47.45703125, y =
416.86328125)`
FlutterView HitTest: `(NSPoint) point = (x = 47.45703125, y =
416.86328125)`
FlutterMutatorView HitTest: `(NSPoint) point = (x = 47.45703125, y =
203.13671875)`


## 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-06-04 18:04:19 +02:00
Robert Ancell
2eff476e2c Fix rendering corruption by Flutter and GDK sharing the same OpenGL context (flutter/engine#53103)
Fix rendering corruption by Flutter and GDK sharing the same OpenGL
context

Solved by having three contexts - one for GDK and two for Flutter.

Regression introduced in https://github.com/flutter/engine/pull/50754

Fixes https://github.com/flutter/flutter/issues/148653
2024-06-04 11:02:09 +12:00
Jonah Williams
34fba02f1d Widen CPU affinity set. (flutter/engine#53136)
For devices with 1 fast core, the current affinity set is less idea because it forces UI and raster on the same thread. Widen this to exclude slow cores instead of including only the fast core.
2024-06-03 21:41:21 +00:00
Kaylee Lubick
89547e5ba6 Migrate off deprecated GrVkBackendContext fields (flutter/engine#53122)
Context: https://g-issues.skia.org/issues/309785258

Skia would like to remove these deprecated fields, so this updates
Flutter's use of them to use the new ways.

Note that `VulkanWindow` seems to be unused (or no longer used?) since
there was a mistyped define (`SK_VUKLAN` -> `SK_VULKAN`) causing the
code I am fixing to never be run.

## 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-06-03 14:48:43 -04:00
Reid Baker
02d2b7c8e1 Google java format relocation and formatting update (flutter/engine#53118)
Fixes https://github.com/flutter/flutter/issues/149319
Caused by https://github.com/flutter/engine/pull/52582

Follow up required to add a flag that fails on missing jar files instead of skipping missing jar files.
2024-05-31 18:09:23 +00:00
Jonah Williams
8afa79a341 Remove assorted bad logs. (flutter/engine#53139)
Fixes https://github.com/flutter/flutter/issues/149376
Fixes https://github.com/flutter/flutter/issues/147081

Lets not log Skia on macOS or anything about transfer queues.
2024-05-31 04:28:19 +00:00
Byoungchan Lee
f1844ade00 Replace several NSAssert with FML_CHECK/DCHECK to unblock the build (flutter/engine#53048)
In https://github.com/flutter/buildroot/pull/860, disabling `NSAssert` in release build was added, and https://github.com/flutter/engine/pull/53005 tries to roll the change into the engine. However, the change is blocked due to several compilation errors in the engine.

This is due to the fact that Google's `DCHECK`(in flutter engine, `FML_DCHECK`) does not make unused variable warning even in release build, while traditional assertion macro like `assert` or `NSAssert` does. For example, the following code will be expanded like this:
code:
```c++
FML_DCHECK(status == kCVReturnSuccess && pxbuffer != nullptr) <<
   "Failed to create pixel buffer";
```
expanded code:
```c++
true || (status == kCVReturnSuccess && pxbuffer != nullptr)
    ? (void)0 ::
    : fml::LogMessageVoidify() &
          ::fml::LogMessage(::fml::kLogFatal, 0, 0, nullptr).stream()
```

However, equivalent code with `NSAssert` will make unused variable warning, since the expanded code doesn't have any reference to the variable:
code:
```c++
NSAssert(status == kCVReturnSuccess && pxbuffer != NULL, @"Failed to create pixel buffer.");
```

expanded code:
```c++
do {
} while (0)
```
To unblock the build, this CL replaces several `NSAssert` with `FML_DCHECK` in the engine codebase. This CL isn't aimed to replace all `NSAssert` with `FML_DCHECK` since discussions in https://github.com/flutter/buildroot/pull/860 are not finalized whether to replace all `NSAssert` with `FML_DCHECK` or not.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-05-30 21:21:20 +00:00
auto-submit[bot]
bc569c90b0 Reverts "[Impeller] enable Impeller by default on Android. (#53099)" (flutter/engine#53125)
Reverts: flutter/engine#53099
Initiated by: jonahwilliams
Reason for reverting: manifest opt out doens't work.
Original PR Author: jonahwilliams

Reviewed By: {bdero, zanderso, chinmaygarde}

This change reverts the following previous change:
All plugin migrations have landed. Enable impeller by default on Android.
2024-05-30 18:15:47 +00:00
auto-submit[bot]
d2efc934df Reverts "Disable Impeller when the manifest explicitly disables it (#53108)" (flutter/engine#53124)
Reverts: flutter/engine#53108
Initiated by: jonahwilliams
Reason for reverting: Probably --no-enable-impeller isn't working
Original PR Author: jiahaog

Reviewed By: {jonahwilliams}

This change reverts the following previous change:
After https://github.com/flutter/engine/pull/53099, impeller is always enabled, even if the manifest disables it using `io.flutter.embedding.android.EnableImpeller`. 

This PR causes it to respect the manifest value if it is explicitly disabled.

Fixes b/343603270

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-05-30 18:10:25 +00:00
Yegor
d3b6b1be14 add SemanticsAction.focus (flutter/engine#53094)
Add `SemanticsAction.focus`. This PR just adds the new enum value without any logic. Adding the enum value first to unblock work that needs to be done on both the engine and framework side that will actually implement all the necessary logic.

This is PR 1 out of ~3 for https://github.com/flutter/flutter/issues/83809
2024-05-30 17:15:53 +00:00
Jia Hao
f037e0db1b Disable Impeller when the manifest explicitly disables it (flutter/engine#53108)
After https://github.com/flutter/engine/pull/53099, impeller is always enabled, even if the manifest disables it using `io.flutter.embedding.android.EnableImpeller`. 

This PR causes it to respect the manifest value if it is explicitly disabled.

Fixes b/343603270

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-05-30 15:03:52 +00:00
Jonah Williams
ca435f46c9 [Impeller] enable Impeller by default on Android. (flutter/engine#53099)
All plugin migrations have landed. Enable impeller by default on Android.
2024-05-30 01:16:22 +00:00
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
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
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
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
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
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