5446 Commits

Author SHA1 Message Date
Dan Field
1e318d57d4 [Impeller] flutter_tester --enable-impeller (flutter/engine#46389)
This patch does the following:

- Updates `flutter_tester` to set up an Impeller rendering context and surface if `--enable-impeller` is set to true, using the Vulkan backend with Swiftshader.
- Updates `run_tests.py` to run all tests except the smoke test (that one really has no rendering impact whatsoever) with and without `--enable-impeller`.
- Updates a few tests to work that were trivial:
  - A couple tests needed updated goldens for very minor rendering differences. Filed https://github.com/flutter/flutter/issues/135684 to track using Skia gold for this instead.
  - Disabled SKP screenshotting if Impeller is enabled, and updated the test checking that to verify an error is thrown if an SKP is requested.
  - The Dart GPU based test now asserts that the gpu context is available if Impeller is enabled, and does not deadlock if run in a single threaded mode.
  - We were missing some trace events around `Canvas::SaveLayer` for Impeller as compared to Skia.
  - A couple other tests had strict checks about exception messages that are slightly different between Skia and Impeller.
- I've filed bugs for other tests that may require a little more work, and skipped them for now. For FragmentProgram on Vulkan I reused an existing bug.

This is part of my attempt to address https://github.com/flutter/flutter/issues/135693, although @chinmaygarde and I had slightly different ideas about how to do this.

The goals here are:

- Run the Dart unit tests we already have with Impeller enabled.
- Enable running more of the framework tests (including gold tests) with Impeller enabled.
- Run all of these tests via public `dart:ui` API rather than mucking around in C++ internals in the engine.
2023-10-11 21:42:24 +00:00
Gray Mackall
0d5c0a660f Revert "[Android] Add support for text processing actions (#44579)" (flutter/engine#46788)
This reverts commit 01345c3ce8c06f09625ea2e1a971187e7ed9c049.

This change is causing integration tests to fail on attempts to roll the latest master version of flutter into the packages repo.

See a sample failure here: https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8767521956894285553/+/u/Run_package_tests/native_integration_tests/stdout

The root cause seems to be that we are getting request codes in `onActivityResult` that we never added to the `requestsByCode` map, so the call to remove returns null (and we then call success getting a NPE).

More info: 
1. There is a [discussion in discord here](https://discord.com/channels/608014603317936148/1161718667566919761/1161721935927980052)
2. And the failure can be reproduced by running `dart run script/tool/bin/flutter_plugin_tools.dart native-test --android --packages file_selector` from the root of the packages repo (with a flutter checkout that contains these changes).

cc @bleroux 

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-10-11 20:49:51 +00:00
John McCutchan
3bd2efe1d3 Rename HardwareBufferExternalTexture* to ImageExternalTexture* (flutter/engine#46786)
Image is the more accurate name and we will eventually have a
HardwareBufferExternalTexture in the future (see
https://developer.android.com/reference/android/graphics/HardwareBufferRenderer
available on Android >= 34).
2023-10-11 12:35:36 -07:00
John McCutchan
da447b9297 Fix 303652511 and add a regression test (flutter/engine#46743)
Fixes internal bug b/303652511 and includes a regression test.

The TL;DR of the bug is that when re-launching a singleton-cached-engine
Flutter activity using FLAG_ACTIVITY_CLEAR_TASK, the teardown of the
previous Flutter activity interleaves with the creation of the new
Flutter activity, resulting in the Flutter engine ending up incorrectly
in the AppLifecycleState.detached state. This then results in the app
being completely unresponsive because Flutter doesn't draw frames in
this state. I don't know if the issue is reproducible in production
under normal user operation, but I'm concerned it very easily could be.
There's also nothing stopping other apps or Android system code from
launching an app using this flag.
2023-10-11 11:29:04 -07:00
Bruno Leroux
01345c3ce8 [Android] Add support for text processing actions (flutter/engine#44579)
## Description

This Android related PR adds a channel buffer and a plugin to interact with Android 'process text' feature. It makes it possible to query text processing actions and to run those actions (for instance 'calling' Google translate).
Text actions that outputs a processed text are supported.

The implementation is based on the great sample provided by @gualse , see https://github.com/flutter/flutter/issues/107603#issuecomment-1646629158. 

In order to return a non empty list of text actions, the implementation will require adding a section to the Android manifest file (see https://github.com/flutter/flutter/issues/107603#issuecomment-1683487087).
Adding this section automatically to new or existing Flutter apps is not part of this PR but will be tackled in a future PR.

## Related Issue

Android engine side for https://github.com/flutter/flutter/issues/107603

## Tests

Adds 3 tests.
2023-10-11 09:33:00 +00:00
Chris Bracken
ee313fa40f Move //third_party/glfw to //flutter/third_party/glfw (flutter/engine#46733)
As part of eliminating the Flutter buildroot (#67373), we are moving all
third-party dependencies from //third_party to //flutter/third_party.

This is the engine-side follow-up to flutter/buildroot#777.

Once all third-party dependencies have been migrated, tooling and config
will be moved and the buildroot will be eliminated altogether.

Issue: https://github.com/flutter/flutter/issues/136284

No tests changed because there is no semantic change to this PR. This is
simply relocating a dependency.
2023-10-10 18:21:54 -07:00
John McCutchan
d9469ed169 Fix high FPS screen flicker of Platform Views when using ImageReaderPlatformViewRenderTarget (flutter/engine#46724)
The root bug (b/300627634) was that we were holding onto HardwareBuffers
after the owning Image was closed. This CL refactors the C++ code to
properly hold a reference to the Image until it is safe to dispose of.

This CL also refactors the Impeller GL and Skia GL code paths to share
more code.
2023-10-10 13:36:56 -07:00
Jonah Williams
724d1ae6fc [Impeller] Implement framebuffer fetch support for OpenGLES. (flutter/engine#46585)
https://github.com/flutter/flutter/issues/120223 for OpenGLES. Checks for support of the framebuffer fetch extension: https://registry.khronos.org/OpenGL/extensions/EXT/EXT_shader_framebuffer_fetch.txt . This is supported on a Pixel 6 at least, we should double check the distribution of the extension.

![d3c](https://github.com/flutter/engine/assets/8975114/d2392dc8-e1b1-4084-ac5d-c5744c651a39)
2023-10-10 19:10:11 +00:00
Alexander Aprelev
eb374b3881 [fuchsia] Remove hardcoded fuchsia-imported packages 2.12 sdk version (flutter/engine#46629)
Use sdk version from imported package pubspec.yaml instead.

This unblocks dart->engine roll that currently is failing
https://ci.chromium.org/ui/p/flutter/builders/try/Linux%20Fuchsia/83386/overview.
2023-10-06 14:01:28 -07:00
Kevin Lubick
5d70f10ebb Add Base64::EncodedSize to tidy up allocations (flutter/engine#46624)
As a follow-up to #46543, this adds a dedicated function to compute the
size of the buffer needed to encode data using Base64 instead of calling
the encode function with nullptr.

## 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].
- [ ] 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
2023-10-06 16:50:20 -04:00
Kevin Lubick
ec62430ff1 Replace use of Skia's Base64 Encoding/Decoding logic with a copy of the equivalent code (flutter/engine#46543)
Skia would like to remove SkBase64.h from its public API. This ports the
same functionality into Flutter's codebase with tests.

The implementation was copied from
[Skia](387853af19/src/utils/SkBase64.cpp)
then modified to match Flutter's style and have readable tests.

In a follow-up PR, I would like to add a function to pre-flight the
calculation needed to figure out how many
bytes are needed to be allocated, to avoid the clunky double API
call (see the TODOs).

I chose to put the code in `//shell/common` at the suggestion of Flutter
devs, but it needs to be in its own source_set because it is used in a
few other places (for now) and we want to avoid dependency cycles.

## 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].
- [ ] 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
2023-10-05 10:21:39 -04:00
Robert Ancell
53d379bfac Use GdkEvent methods to access values, direct access is removed in GTK4. (flutter/engine#46526)
This should have no effect on the current implementation, and will be
one less thing needed when we migrate to GTK4.
2023-10-05 13:46:51 +13:00
Chris Yang
4ccef45a9a [ios] Link PlatformView back to semantics tree (flutter/engine#46471)
The PlatformView does not have a semantics container when added to semantics tree, this PR gives it a semantics container to ensure accessibility traversal works.

This fixes https://github.com/flutter/flutter/issues/135504, which is a regression of 738b1ad94d

Before 738b1ad94d, the traversal works because the PlatformView is added to the accessibilityElements of the FlutterPlatFormViewSemanticsContainer, which implicitly made the FlutterPlatFormViewSemanticsContainer as the PlatformVIew's AccessibilityContainer. 

Now we use the PlatformVIew as the nativeAccessibility of the  FlutterPlatFormViewSemanticsContainer, we need to expilicitly set the container. 

This needs to be cherry-picked since the commit caused the regression was cherry-picked in 738b1ad94d

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-10-04 21:41:53 +00:00
John McCutchan
6a0fe28dac Restrict ImageReader backed Platform Views to Android 33+ (flutter/engine#46478)
This is necessary to be able to access the fence associated with each
frame that is produced. This API is not available below 33.
2023-10-02 19:23:51 -06:00
Bruno Leroux
2475a550db [Linux] Rename 'set_allow_channel_overflow' to 'set_warns_on_channel_… (flutter/engine#46360)
## Description

This PR is a follow-up to https://github.com/flutter/engine/pull/44636 which introduces the `set_allow_channel_overflow` function. It renames this function to `set_warns_on_channel_overflow`.

The previous naming was inspired by the framework side implementation.
c00c022036/lib/ui/channel_buffers.dart (L574)

During the review of the iOS/macOS implementation, https://github.com/flutter/engine/pull/44848#discussion_r1310463864, we agreed that the existing naming is confusing because it implies that overflow will be allowed, but this not the case this function is used to enable/disable error messages when a channel overflows. 

## Related Issue

Follow-up for https://github.com/flutter/flutter/issues/132386.

## Tests

Updates 2 tests.
2023-10-02 05:36:16 +00:00
John McCutchan
af107ceba5 Add an AndroidManifest.xml flag to disable ImageReader backed Platform Views (flutter/engine#46430)
An internal customer is seeing flickering on some high FPS phones.

While we try and reproduce / gain more knowledge of this problem this PR adds a AndroidManifest.xml flag to disable their usage.

The boolean flag is:
```
"io.flutter.embedding.android.DisableImageReaderPlatformViews"
```

Adding the following to your manifest will disable their usage:

```
<meta-data
  android:name="io.flutter.embedding.android.DisableImageReaderPlatformViews"
  android:value="true" />
```
2023-09-30 00:33:33 +00:00
Casey Hillers
f61c3b45a2 Disable enableHardwareBufferRenderingTarget (flutter/engine#46425)
* Causing flickering in web views
* Follow up of cl/569435819 for Google to unblock the rolls
2023-09-29 22:56:07 +00:00
Tong Mu
c7f206212a Multi-view Rasterizer (flutter/engine#45512)
This PR refactors `Rasterizer` so that it's more suitable for multi-view.

Design doc: [flutter.dev/go/multi-view-pipeline-and-rasterizer](http://flutter.dev/go/multi-view-pipeline-and-rasterizer)

With this change, `Rasterizer::DrawToSurfaces` has a structure that can handle drawing to multiple views, although the lack of some functionality still blocks it, mostly related to `ExternalViewEmbedder` and `RasterCache`. 

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-09-29 21:43:55 +00:00
Matej Knopp
d4d0a41bd7 [macOS] Ensure first responder is consistent during and after text input (flutter/engine#46032)
Fixes https://github.com/flutter/flutter/issues/134906
Fixes https://github.com/flutter/flutter/issues/133832

This ensures that there are only two first responder widgets -
`FlutterView` when text input is not active and `TextInputPlugin` when
text input is active. The PR also prevents `FlutterView` stealing first
responder status on mouse click events during text input.

Previously when `TextInputClient` resigned it made `nextResponder` the
first responder, but that was incorrect - `nextResponder` being the
superview (`FlutterViewWrapper`).

## 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
2023-09-29 11:02:42 +02:00
Matej Knopp
fab42e688a Reland: [macOS] performKeyEquivalent cleanup (flutter/engine#46377)
Fixes the issue in original PR where `FlutterViewWrapper` does not pass the key equivalent to subviews thus prevents `TextInputPlugin` from receiving it. Also adds a regression test for this scenario.

Note that key equivalent flow does not respect the regular responder chain. It is passed from root view to down to subviews and if unhandled will be forwarded to menus.

Original message: 

https://github.com/flutter/engine/pull/40706 added a duplicate `NSEvent (KeyEquivalentMarker)` category. This PR removes it. It also removes the call to `markAsKeyEquivalent` from `FlutterViewController`. That call is internal to `FlutterTextInputPlugin` and classes outside should not be calling it.

*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
2023-09-28 20:41:11 +00:00
Matej Knopp
839d6adae7 [macOS] TextInputPlugin should mark navigation events in IME popover as handled (flutter/engine#46141)
Fixes https://github.com/flutter/flutter/issues/134699

Because of NSTextInputContext API limitations it is not straightforward to determine whether `TextInputPlugin` has handled a text equivalent event or whether it should pass it on. Previously we marked all event  that didn't result in a TextInputClient action as unhandled, but that's does not work for arrow key events while the IME popover is active.

This PR will mark arrow keys event as handled if there is active composition.

*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
2023-09-28 20:37:47 +00:00
Joel Winarske
40b832a838 [Impeller] Fix OpenGLES EGL_BAD_ACCESS due to context being current on multiple threads. (flutter/engine#46287)
On Linux setting the EGL context from one thread, then setting from another thread will trigger a EGL_BAD_ACCESS error.  The resolution is to clear the context after use on the thread that set it.

https://github.com/flutter/flutter/issues/130619
2023-09-28 20:10:09 +00:00
AJI
86b582a6bc Fix damage calculation when not providing populate_existing_damage for gl embedder (flutter/engine#45611)
# Description

This PR fixes the `gl_populate_existing_damage` in embedder.cc, which currently returns an empty rectangle when a full repaint is needed. This leads to the `frame_damage` being considered empty in rasterizer.cc, causing incorrect partial repaint within Flutter when `gl_populate_existing_damage` is not provided by the embedder.

# Related Issue

https://github.com/flutter/flutter/issues/119601

# Tests

Add a new test. Also fixes damage calculation related tests in EmbedderTest by

* Use a new Dart embedder fixture entry point `render_gradient_retained` which retains the old layer to make sure layer tree diff happens.
* Add `latch.Wait()` after `SetGLPresentCallback` to make sure assertions have been executed.
* Make `existing_damage_rects` static since it should be valid after `populate_existing_damage` returns.
2023-09-28 20:06:51 +00:00
Matej Knopp
c94d335b6b [macOS] FlutterTextInputPlugin should clip to bounds (flutter/engine#46142)
Fixes https://github.com/flutter/flutter/issues/135219
(formerly https://github.com/flutter/flutter/issues/128956)

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-09-28 19:05:55 +00:00
Chris Bracken
87e27ff202 Revert "[macOS] performKeyEquivalent cleanup (#45946)" (flutter/engine#46374)
This broke some keyboard shortcut handling (e.g. cmd-a to select all).

This reverts commit 0deacc6c7023789c4a75155e6798b3cccdc6384a.


## Pre-launch Checklist

- [ ] 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 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.

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
2023-09-28 10:45:11 -07:00
Matej Knopp
0deacc6c70 [macOS] performKeyEquivalent cleanup (flutter/engine#45946)
https://github.com/flutter/engine/pull/40706 added a duplicate `NSEvent (KeyEquivalentMarker)` category. This PR removes it. It also removes the call to `markAsKeyEquivalent` from `FlutterViewController`. That call is internal to `FlutterTextInputPlugin` and classes outside should not be calling it.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-09-28 17:28:47 +00:00
Bruno Leroux
f732952384 [Android] Rename allowChannelBufferOverflow to `setWarnsOnChannelOv… (flutter/engine#46361)
## Description

This PR is a follow-up to https://github.com/flutter/engine/pull/44434 which introduces the `allowChannelBufferOverflow` function. It renames this function to `setWarnsOnChannelOverflow`.

The previous naming was inspired by the framework side implementation.
c00c022036/lib/ui/channel_buffers.dart (L574)

During the review of the iOS/macOS implementation, https://github.com/flutter/engine/pull/44848#discussion_r1310463864, we agreed that the existing naming is confusing because it implies that overflow will be allowed, but this not the case this function is used to enable/disable error messages when a channel overflows. 

## Related Issue

Follow-up for https://github.com/flutter/flutter/issues/132386.

## Tests

Updates 1 test.
2023-09-28 14:08:12 +00:00
Chris Yang
e2bc37bba7 Reland "Reverts "[ios] Fix app extension not able to find assets from… (flutter/engine#46329)
Relands https://github.com/flutter/engine/pull/46283

The original PR had a bug where the relative assets path is reset after not being found in the `bundle`. It should not be reset unless it was not found inside the info.plist in `bundle`

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

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-09-28 00:02:04 +00:00
auto-submit[bot]
8a97e55da3 Reverts "[ios] Fix app extension not able to find assets from unloaded bundle" (flutter/engine#46328)
Reverts flutter/engine#46283
Initiated by: CaseyHillers
This change reverts the following previous change:
Directly use "flutter_assets" as the default path to find the asset path, this works for app extension when the bundle is unloaded.

This PR also adds integration tests for app extensions, which also tests the asset path. 

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

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-09-27 17:57:18 +00:00
Loïc Sharma
f020b2c7c9 [Windows] Improve logic to update swap intervals (flutter/engine#46172)
This relands https://github.com/flutter/engine/pull/45310 to unblock the ANGLE roll with the fix for https://github.com/flutter/flutter/issues/134262.

## Background

### Swap interval

If the Windows system compositor is enabled, the Windows embedder disables the swap interval so that presenting to a surface does not block until the v-blank. If the Windows system compositor is disabled (which is possible on Windows 7), the Windows embedder enables swap interval to prevent screen tearing.

### GL context threading

Our current version of ANGLE allows making a GL context current on multiple threads. However, the latest version of ANGLE errors if a GL context is made current on multiple threads. This is causing the ANGLE roll to fail ([example](https://ci.chromium.org/ui/p/flutter/builders/try/Windows%20Engine%20Drone/203788/overview)).

The Windows embedder has two GL context threading issues:

1. At startup, the platform thread creates and binds the GL context. This change ensures the GL context is released from the platform thread so that the raster thread can use the GL context for rendering.
2. When the system compositor updates, the GL context is bound to the platform thread to update the swap interval. This change ensures the swap interval update happens on the raster thread.

### Window resizing

Resizing the window recreates the GL surface and resets the swap interval.

The previous fix released the current GL context after updating the swap interval (this ensured the platform thread released the GL context at startup). This broke window resizing as it caused the engine to "lose" its GL context during rendering (see https://github.com/flutter/flutter/issues/134262). This reland releases the GL context only if on the startup case.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-09-27 17:52:17 +00:00
Jason Simmons
bfc3acee24 Declare native wrapper classes in Fuchsia packages as base classes (flutter/engine#46305)
This prohibits other implementations of the class interface that can not act as native wrappers.

See https://github.com/flutter/flutter/issues/123756
2023-09-27 15:44:58 +00:00
Matej Knopp
066459ce65 [macOS] Synchronise modifiers from mouse events for RawKeyboard (flutter/engine#46230)
Fixes https://github.com/flutter/flutter/issues/135349

This has been done for FlutterEmbedderKeyResponder in
https://github.com/flutter/engine/pull/37870, but has not been
implemented for FlutterChannelKeyResponder, which results in RawKeyboard
being out of sync with HardwareKeyboard.

## 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
2023-09-27 17:09:49 +02:00
Kevin Lubick
8656e6b1d4 Update to use GrDirectContexts::MakeGL (flutter/engine#46308)
This was added in https://skia-review.googlesource.com/c/skia/+/760017
and the old versions were deprecated.

## 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].
- [ ] 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].
- [ ] 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
2023-09-27 10:17:05 -04:00
Chris Yang
043c5a377a [ios] Fix app extension not able to find assets from unloaded bundle (flutter/engine#46283)
Directly use "flutter_assets" as the default path to find the asset path, this works for app extension when the bundle is unloaded.

This PR also adds integration tests for app extensions, which also tests the asset path. 

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

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-09-26 21:47:13 +00:00
Bruno Leroux
ce5194184d [Android] Fix enableSuggestions set to false not honored (flutter/engine#46037)
## Description

This PR fixes an issue where setting `TextField.enableSuggestions` to false was not honored on Android.

Several Android devices (Samsung) and/or IMEs (including GBoard) does not disabled suggestions when `InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS `flag is set. The common solution is to rely on the following flag:  ~~`InputType.TYPE_TEXT_VARIATION_PASSWORD`~~ `InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD`.

Reference:
- https://issuetracker.google.com/issues/36934423#comment4
- https://stackoverflow.com/questions/33148168/inputtype-type-text-flag-no-suggestions-in-samsung/33227237#33227237
- Existing comment on the codebase:
195a313245/shell/platform/android/io/flutter/plugin/editing/TextInputPlugin.java (L270)

## Related Issue

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

## Tests

Adds 1 test.
2023-09-26 20:39:05 +00:00
Ian McKellar
a02355a95c fuchsia: Update FIDL for unknown interactions (flutter/engine#45773)
This is part of a language change in FIDL. This should have no effect.

See: [https://fxbug.dev/88366](https://fxbug.dev/88366)
2023-09-25 19:15:36 +00:00
Jonah Williams
f5ff960253 [Engine] use QoS classes in iOS engine. (flutter/engine#46265)
Hint to the CPU scheduler which of our threads are more important. This change should result in more stable rendering times on CI, but likely doesn't have any other observable effects.
2023-09-25 19:06:09 +00:00
Chris Yang
c889e14d4c [ios] Fix default assets url (flutter/engine#46214)
When reverting the default asset url code, the old "flutter_assets" path was also copied in https://github.com/flutter/engine/pull/46073
This PR uses the correct URL. Although I'm unsure why the video player test passed before my change for the asset urls. 

I'm going to take another look at it but meanwhile this PR can unblock the roll once rolled into the framework.

fixes of https://github.com/flutter/flutter/issues/135323

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-09-23 11:43:21 +00:00
Casey Hillers
27e8b0633d Revert "[Impeller] fail if software backend is chosen and Impeller is enabled on iOS" (flutter/engine#46217)
Reverts flutter/engine#46124

See b/301660190. This is breaking a few Google iOS tests due to test bed configurations. We'll need more time to investigate fixing those tests before relanding.
2023-09-23 02:15:50 +00:00
Jonah Williams
7cd7603dfa [Impeller] Reland: construct text frames on UI thread. (flutter/engine#46115)
Due to https://github.com/flutter/flutter/issues/127500 , we can get in a state where enable-impeller is true but we're using Skia. We need to either fall back completely to Skia, make this configuration fatal, or remote the check

----------------

Conversion of SkTextBlobs to impeller::TextFrame objects is one of the most expensive operations in display list dispatching. While the rest of the engine and framework makes a reasonable attempt to cache the SkTextBlobs generated during paragraph construction, the design of the dl dispatcher means that these the Impeller backend will always reconstruct all text frames on each frame - even if the display list/picture that contained those text frames was unchanged.

Removing this overhead is one of the goals of https://github.com/flutter/engine/pull/45386 , however this patch is also fairly risky and will be difficult to land. As a more incremental solution, we can instead construct the impeller::TextFrame objects when performing paragraph painting and record them in the display list. This both moves the text frame construction to the UI thread and allows the framework/engine to cache unchanged text frames.

This also does not conflict with the dl_aiks_canvas patch directly, and is fine to land before or after it does. (though I'd argue we should land this first).

To compare the current performance levels, I ran the complex_layout_scroll perf test, since this is fairly text filled. On a Pixel 6 pro. Across several runs this is a fairly consistent ~1ms raster time improvement.

Fixes https://github.com/flutter/flutter/issues/133204
2023-09-22 17:46:32 +00:00
Bruno Leroux
87139861e6 [iOS] Disable spelling corrections when auto correction is disabled (flutter/engine#46144)
## Description

This iOS PR disables spellchecking when auto correction is disabled.

## Related Issue

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

## Tests

Adds 1 test.
2023-09-22 06:00:58 +00:00
Dan Field
3ade44e1c7 [Impeller] fail if software backend is chosen and Impeller is enabled on iOS (flutter/engine#46124)
Fixes https://github.com/flutter/flutter/issues/127408

This is also related to https://github.com/flutter/engine/pull/44346, which made it fatal to explicitly request both impeller and the software backend.

Before landing this, we need to update some google internal tests that end up in this state to explicitly request Skia (or to get into a mode where they can actually use metal).
2023-09-22 00:31:00 +00:00
John McCutchan
72c674cc1c Re-enable HardwareBuffer backed Platform Views on Android >= 29 (flutter/engine#46071) 2023-09-21 14:40:31 -07:00
Tong Mu
38b8ce1c29 Reland: Enforce the rule of calling FlutterView.Render (#45300) (flutter/engine#45555)
This PR relands #45300 which was reverted in https://github.com/flutter/engine/pull/45525 due to hanging on a windows startup test. The culprit test still calls `FlutterView.render` in the illegal way, which is ignored, causing no frame being ever produced. This has been fixed in https://github.com/flutter/flutter/pull/134245. I've also searched through the framework repo for `render(` to ensure there are no other cases.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-09-21 21:11:03 +00:00
Matan Lurey
476b46954c Migrate from LOG_X to kLogX. (flutter/engine#46107)
These should be entirely non-breaking, i.e. 1:1 and same backing `int`
value.

(See https://github.com/flutter/engine/pull/46052)
2023-09-20 13:24:01 -07:00
Chris Yang
bc8e93271b [ios] fix asset url not found when loading app extension (flutter/engine#46073)
In b3fc48b91b, I refactored the assetsPath to use NSURL. It turns out that when the app bundle is not loaded (during launching app exgtension), the assetURL will return nil using the `URLForResource`, but the `pathForResource` successfully returns the raw path.

This PR reverts back to the raw path solution.

part of https://github.com/flutter/flutter/issues/124287

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-09-20 19:55:47 +00:00
Matan Lurey
792830c13f Make a variety of low-impact Clang tidy fixes. (flutter/engine#46114)
Work towards https://github.com/flutter/flutter/issues/134969.

These are all self-contained, so I bundled them all together.

All fixes are generated by `clang-tidy --fix`, and manual search/replace if that wasn't sufficient.
2023-09-20 19:52:03 +00:00
Jonah Williams
dc05767b39 [Impeller] Affinity adjustments for Vulkan backend. (flutter/engine#46063)
Runs the waiter threads with efficiency affinity and the worker thread with "not performance" affinity.
2023-09-19 23:34:11 +00:00
gaaclarke
8ddfb38703 [Impeller] adds hardware gate for wide gamut (flutter/engine#46051)
fixes https://github.com/flutter/flutter/issues/133015

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-09-19 22:27:36 +00:00
gaaclarke
70b4e83c3d Made the warning about downgrading wide gamut happen at the correct time (flutter/engine#46064)
fixes https://github.com/flutter/flutter/issues/135033

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-09-19 21:45:35 +00:00