4879 Commits

Author SHA1 Message Date
Bartek Pacia
de91195bb1 Add support for exposing accessibility identifier as accessibilityIdentifier on iOS (flutter/engine#48858)
This PR is a sibling of #47961 but for iOS
2023-12-11 22:35:06 +00:00
Zachary Anderson
63e00ce106 Fix _availability_version_check for iOS 11 and 12 (flutter/engine#48624)
This PR ports more of the implementation of availability checking from
clang-rt into the Engine. In particular, when the call to look up the
symbol `_availability_version_check` fails, this PR falls back on
reading the platform version information out of a plist file at a
well-known location, as is done
[here](2fd66e6eb6/compiler-rt/lib/builtins/os_version_check.c (L163)).

This change fixes a mistake in
https://github.com/flutter/engine/pull/44711, which didn't account for
`_availability_version_check` not being available on iOS 11 and 12.

Fixes https://github.com/flutter/flutter/issues/138711
2023-12-11 11:51:55 -08:00
John McCutchan
c9528be3c6 Add a new external texture type to Android embedder (flutter/engine#48803)
The `SurfaceProducer` interface exposes only exposes a Surface to render
on, abstracting away the consumer side of the external texture.

The `ImageReaderSurfaceProducer` implementation of this interface is
included as well as a basic test of that code.

Also, a small refactor so that `ImageTexture` and
`ImageReaderSurfaceProducer` can use the same native C++ code in the
engine.

Subsequent CLs will need to address the following:

- A SurfaceTextureSurfaceProducer (your eyes are probably bleeding from
that name) implementation is needed so we can support GL based systems.
- Update Platform Views to use this new SurfaceProducer type instead of
the legacy types.
- Deprecate SurfaceTexture and ImageTexture external texture types.

Related issue
[#139702](https://github.com/flutter/flutter/issues/139702)
2023-12-08 13:20:51 -08:00
Jason Simmons
09e12e0f51 Reland "Replace use of Fontmgr::RefDefault with explicit creation calls" (flutter/engine#48764)
Relands https://github.com/flutter/engine/pull/48571 with a patch that uses the directory-based SkFontMgr as a default font manager on Linux
2023-12-07 15:45:08 +00:00
Jason Simmons
6f48ab3443 Revert "Replace use of Fontmgr::RefDefault with explicit creation calls" (flutter/engine#48755)
This reverts commit d5d8b5de90f40644f23d309c0f68d03e299334eb.

The flutter/tests/skp_generator test (running in flutter_tester on
Linux) was failing, along with some customer tests.
2023-12-06 17:50:14 -08:00
Loïc Sharma
ea34df3c56 [Windows] Set swap interval on raster thread after startup (flutter/engine#47787)
The EGL context can only be used by a single thread at a time. Currently:

1. The platform thread uses the EGL context to configure the render surface when a `FlutterViewController` is created
2. The raster thread uses the EGL context to render

In a multi-view world, a `FlutterViewController` can be created in parallel to a rendering operation. This results in multiple threads attempting to use the EGL context in parallel, which can crash (see https://github.com/flutter/flutter/issues/137973).

This change configures the render surface on the raster thread if the raster thread exists (aka the engine is running).

Addresses https://github.com/flutter/flutter/issues/137973

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-12-06 18:44:17 +00:00
Loïc Sharma
6c6f23360c [Windows] Refactor the GLES proc table (flutter/engine#48688)
GLES functions are resolved at runtime. This refactors how these functions are stored by introducing the `GlProcTable` abstraction.

This is a step towards switching the Windows embedder to `FlutterCompositor` rendering as the present callback will use the `GlProcTable` to render OpenGL backing stores.
 
Part of https://github.com/flutter/flutter/issues/128904

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-12-06 18:19:36 +00:00
Kevin Lubick
d5d8b5de90 Replace use of Fontmgr::RefDefault with explicit creation calls (flutter/engine#48571)
In https://g-issues.skia.org/issues/305780908 Skia is removing the
default SkFontMgr. Previous work consolidated all references to
txt/platform.h and this replaces those last references. I attempted to
mirror the existing functionality, which still responds to GN flags and
the target platform.

After this PR, Flutter should not be depending on the default fontmgr
(and the defines in flutter_defines.gni) will maintain that behavior
until the legacy functions/methods are deleted from Skia. There were a
few tests that I missed on an earlier PR which relied on the default
font (helper added in #47493). These tests were failing because they
were making some assertions related to TextBlobs, which didn't work if
the (now-empty) Typeface they loaded had no glyphs. Thus, I added a few
extra asserts to make sure these textblobs *had* glyphs which make the
failing tests less mysterious, should this issue crop up again.

I cleaned up Flutter's BUILD.gn file for Skia a bit, deleting unused
targets related to the font managers. This involved fixing an implicit
dependency from //third_party/glfw/ to `Gdi32.lib` on Windows.

## 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
2023-12-06 13:02:34 -05:00
Jonah Williams
82a8b5ddcf [Impeller] Vulkan framebuffer fetch via VK_ARM_RASTERIZATION_ORDER_ATTACHMENT_ACCESS (flutter/engine#48458)
Support framebuffer fetch on devices that have the extension VK_ARM_RASTERIZATION_ORDER_ATTACHMENT_ACCESS which gives us a fairly easy way to add subpass self dependencies.

Part of https://github.com/flutter/flutter/issues/120223
2023-12-06 00:55:59 +00:00
Chinmay Garde
4a1f8fa2f3 Avoid non-const sizes in VLAs. (flutter/engine#48693)
I was shocked this was even legal earlier. But a new Clang roll makes this an a warning which gets converted into an error.

I attempted to roll to the Clang roll the roller did and fixed the issues I found. Hopefully, the next roll is unblocked.

Original failure: https://github.com/flutter/engine/pull/48563
2023-12-05 21:11:23 +00:00
Jonny Wang
8a83072ebc A11y enabled state (flutter/engine#48653)
Sets enabled state in Fuchsia a11y via the accessibility bridge.

This was added in Fuchsia API v15, which Flutter is updated to use after
#48233.

b/261482081

## 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.
2023-12-05 18:17:28 +00:00
Loïc Sharma
20e5300477 [Windows] Decouple the GL context from the view (flutter/engine#48636)
In the future, the GL context will be shared between zero or more views. The engine will also need to be able to make the GL context current even if the app is currently in headless mode.

No tests are updated as this is a refactoring with no functionality changes.

Part of https://github.com/flutter/flutter/issues/137267

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-12-04 20:53:03 +00:00
Tong Mu
673fca77cf Multiview ExternalViewEmbedder (flutter/engine#46169)
This PR adds multiview support for `ExternalViewEmbedder`.

## Nomenclature

The term **view** can be ambiguous in `ExternalViewEmbedder`, and therefore the following terms are used:
* A **native view** refers to the final drawing surface that to composite layers to. It is the "view" used in other places of the engine, such as `Shell::AddView`.
* A **platform view** refers a platform view, a layer that holds content to be embedded.

## Change

The lifecycle of `ExternalViewEmbedder` is changed:

<table>
    <thead>
        <tr>
            <th>Before PR</th>
            <th>After PR</th>
            <th>How it's called</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td rowspan=2>BeginFrame</td>
            <td>BeginFrame</td>
            <td>Once per frame</td>
        </tr>
        <tr>
            <td>PrepareFlutterView</td>
            <td>Once per flutter view</td>
        </tr>
        <tr>
            <td>SubmitFrame</td>
            <td>SubmitFlutterView (renamed)</td>
            <td>Once per flutter view</td>
        </tr>
        <tr>
            <td>EndFrame</td>
            <td>EndFrame (unchanged)</td>
            <td>Once per frame</td>
        </tr>
    </tbody>
</table>

* `BeginFrame` should perform per-frame actions, such as merge-unmerging threads.
* `PrepareView` should perform per-native-view preparations, such as recording the view ID and view size.

This change is necessary because some actions in `PrepareView` needs to be refreshed at the beginning of drawing every native view.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-12-04 20:29:49 +00:00
Bartek Pacia
79126777a4 Add support for exposing accessibility identifier as resource-id on Android (flutter/engine#47961)
Accompanying framework PR: https://github.com/flutter/flutter/pull/138331

This PR implements support for exposing `SemanticsProperties.identifier` on Android as `resource-id`. Mainly targeted at https://github.com/flutter/flutter/issues/17988. Would also fix https://github.com/flutter/flutter/issues/issues/137735 but it was marked as duplicate. Anyway, there's a lot of context in that issue.

This PR requires changing the `SemanticsUpdateBuilder` interface (defined in engine) that framework depends on, so it requires introducing a temporary API ([see question I asked on Discord](https://discord.com/channels/608014603317936148/608018585025118217/1174845658033819729) to learn more about this approach).

Steps:
**part 1: [engine] add `SemanticsUpdateBuilderNew`** <-- we are here
part 2: [flutter] use `SemanticsUpdateBuilderNew`
part 3: [engine] update `SemanticsUpdateBuilder` to be the same as `SemanticsUpdateBuilderNew`*
part 4: [flutter] use (now updated) `SemanticsUpdateBuilder` again.
part 5: [engine] remove `SemanticsBuilderNew`

I'd like to do these changes first, and only then continue with [the proper framework PR](https://github.com/flutter/flutter/pull/138331).

*More specifically: update `SemanticsUpdateBuilder.updateNode()` to be the same as `SemanticsUpdateBuilderNew.updateNode()`. Number of arguments that function takes is the only change.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-12-04 19:27:18 +00:00
Matan Lurey
6e99e081fe Roll a new version of googletest (2021->2023). (flutter/engine#48285) 2023-11-30 17:50:30 -08:00
Camille Simon
7965fd759e [Android] Check for text to paste before trying to retrieve data from URI (flutter/engine#48166)
Adds a check to retrieve explicit text from Clipboard items via [`getText`](https://developer.android.com/reference/android/content/ClipData.Item#getText()) before attempting to retrieve data if the Clipboard item (`ClipData.Item`) has an associated URI. Also adds more error handling for edge cases concerning URIs (the URI not having the content scheme or being null).

Fixes https://github.com/flutter/flutter/issues/74320. Some content providers will not send URIs containing the `text/*` pattern or have the content scheme (`content://`), but ultimately we should expect Clipboard items to either fall **not** into one of those categories or have an explicit textual value available via `getText`. In case this is not true, though, checks for non-content URIs and null URIs are added, as well :)

Tested on a Samsung tablet with pasting from MS Word, MS Excel, and Samsung Notes.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-12-01 00:04:42 +00:00
Loïc Sharma
f5cacea14a [Windows] Begin decoupling text input plugin from the view (flutter/engine#47833)
Currently the text input plugin is strongly tied to a single view. This change makes the text input plugin tied to the engine in preparation for multi-view world.

Part of https://github.com/flutter/flutter/issues/115611

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-11-30 21:49:14 +00:00
Bruno Leroux
2a59992ea5 [Android] Add support for the PlatformChannel "Share.invoke" command (flutter/engine#48265)
## Description

This PR adds support for the PlatformChannel `Share.invoke` message on Android (before this PR it is only supported on iOS).

## Related Issue

Engine side for https://github.com/flutter/flutter/issues/138728

## Tests

Adds 2 tests.
2023-11-30 06:12:11 +00:00
Gray Mackall
b9b16eab3c Fix new lint from android 14 upgrade, and remove it from the baseline (flutter/engine#47817)
See https://github.com/flutter/engine/pull/47609#discussion_r1385803721 for context.

It isn't clear to me what the file descriptor here is actually doing, so I'm not actually too sure about this fix. Can it just be deleted?

Update: it seems to me that the motivation here is that `ClipData.Item.coerceToText` [consumes a `SecurityException` here](https://cs.android.com/android/platform/superproject/main/+/main:frameworks/base/core/java/android/content/ClipData.java;l=411;bpv=0;bpt=1), with just a log line that isn't particularly descriptive. And basically we want to run into that same exception so we can [provide a more helpful log line](e5da8d9a87/shell/platform/android/io/flutter/plugin/platform/PlatformPlugin.java (L525)), so we do the same thing that the underlying `coerceToText` method does?

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-11-29 16:04:20 +00:00
auto-submit[bot]
8c6313074f Reverts "binary_messenger missing cstdint" (flutter/engine#48483)
Reverts flutter/engine#48481
Initiated by: matanlurey
This change reverts the following previous change:
Original Description:
This PR adds cstdint to binary_messenger.h.  Without this building plugin support for generic Linux fails.  Not related to the GTK source tree.

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

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

*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-11-29 02:25:18 +00:00
Joel Winarske
26853f24e2 binary_messenger missing cstdint (flutter/engine#48481)
This PR adds cstdint to binary_messenger.h.  Without this building plugin support for generic Linux fails.  Not related to the GTK source tree.

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

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

*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-11-29 02:17:22 +00:00
Robert Ancell
297a817fc9 Fix the application not disposing by breaking circular references on quit (flutter/engine#47684)
GtkApplication windows contain a reference back to the application. This
means the MyApplication object in the Flutter application never
disposes. We workaround this by removing these references before we
quit. This occurs for all GTK applications that quit using this method,
see https://gitlab.gnome.org/GNOME/gtk/-/issues/6190. This may be fixed
upstream at some point but the proposed workaround should solve the
problem for all versions and not conflict with any upstream solution.

Fixes https://github.com/flutter/flutter/issues/136582
2023-11-29 14:01:53 +13:00
Matan Lurey
92a2b041fb Update HeaderFilterRegex once and for all. (flutter/engine#48145)
Includes a test (`header_filter_regex_test.dart`) that hopefully keeps
us on rails going forward.
2023-11-27 15:30:18 -08:00
hangyu
4f5a0eef4c [ios] Send " did gain focus" message from engine to framework (flutter/engine#48252)
issue: https://github.com/flutter/flutter/issues/97747

framework pr :https://github.com/flutter/flutter/pull/135771 
android pr: https://github.com/flutter/engine/pull/47114

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-11-27 20:22:53 +00:00
Matej Knopp
9a823f7768 Reduce number of surfaces required when presenting platform views (flutter/engine#43301)
Fixes https://github.com/flutter/flutter/issues/129710
Fixes https://github.com/flutter/flutter/issues/138936

Implements https://flutter.dev/go/optimized-platform-view-layers

## Example

This scene would normally require 5 surfaces, but with the PR it comes
down to 2 (when drawing over platform views) and 1 when all drawing is
outside of platform views).


https://github.com/flutter/flutter/assets/96958/091da832-bfbc-44a2-8da5-d55d84024c96

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

## Pre-launch Checklist

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

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

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#overview
[Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene
[Flutter Style Guide]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo
[C++, Objective-C, Java style guides]:
https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
[testing the engine]:
https://github.com/flutter/flutter/wiki/Testing-the-engine
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes
[Discord]: https://github.com/flutter/flutter/wiki/Chat
2023-11-27 14:07:43 +01:00
林洵锋
23ed0d9d6a Fix not being able to hide iOS status bar via setEnabledSystemUIMode (flutter/engine#48271)
Fix https://github.com/flutter/flutter/issues/138604 and https://github.com/flutter/flutter/issues/138671

Related PR https://github.com/flutter/engine/pull/45351

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-11-23 00:49:13 +00:00
LouiseHsu
faa3e610ac Fix Share Screen Crash on iPad (flutter/engine#48220)
Fixes https://github.com/flutter/flutter/issues/138550

![Simulator Screenshot - iPad Air (5th generation) - 2023-11-21 at 03 33 37](https://github.com/flutter/engine/assets/36148254/15e10e43-816b-43b1-a5ab-75c8add90899)
2023-11-22 20:49:58 +00:00
Matan Lurey
d5b171165f Finish making shell/platform/linux/... compatible with .clang-tidy. (flutter/engine#48297) 2023-11-21 15:35:36 -08:00
Matan Lurey
aa6fdad4cd Finish making shell/platform/android/... compatible with .clang-tidy. (flutter/engine#48296) 2023-11-21 15:34:06 -08:00
gaaclarke
e80ecd9194 [Impeller] Switched to static linked libc++ in vulkan validation layers. (flutter/engine#48290)
fixes https://github.com/flutter/flutter/issues/138535
test coverage: existing integration tests in flutter repo which look for validation layers

I also verified locally that the `libc++.so` is no longer present and that it runs correctly.

```
$ find lib/arm64-v8a/
lib/arm64-v8a/
lib/arm64-v8a//libflutter.so
lib/arm64-v8a//libVkLayer_khronos_validation.so
```

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-11-21 22:06:05 +00:00
Matan Lurey
0b7f44c8c4 Yet more compliance with .clang_tidy, stragglers edition. (flutter/engine#48291)
Based off the
[failures](https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8763786250936903249/+/u/test:_test:_lint_host_debug/stdout)
in https://github.com/flutter/engine/pull/48145.

Nothing particularly interesting.
2023-11-21 13:39:18 -08:00
Matan Lurey
edb665c82d Make {shell|lib/ui}/... compatible with .clang_tidy. (flutter/engine#48242)
This is mostly just rename `ThreadHost::Type::{IDENTIFIER}` to
`kIdentifier`.

I also ignored some enum violations that are in public APIs.
2023-11-21 12:29:14 -08:00
Jonah Williams
753e9e6ac7 [Impeller] Ensure that overlay surfaces are constructed with wide gamut settings. (flutter/engine#48190)
Fixes https://github.com/flutter/flutter/issues/138373

When constructing overlay layers when there are platform views, make sure the same pixel format and color space as the main view is used.

Add validation to impeller HAL about blitting different pixel formats.
2023-11-21 20:29:05 +00:00
YaTang
950ec4aed6 [PlatformView][Android]VirtualDisplay resize on Android31 and above (flutter/engine#47946)
Resolves: https://github.com/flutter/flutter/issues/128920
2023-11-20 19:16:02 -08:00
Kevin Lubick
0d0d4db144 Replace calls to SkFontMgr::RefDefault (flutter/engine#48179)
Skia is removing this API, so clients must track a default FontMgr if
they want one. See https://issues.skia.org/issues/305780908

## 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-11-20 07:57:02 -05:00
Zachary Anderson
aa3f8e61c1 Moves expat, ocmock, libjpeg-turbo, libwebp, and wuffs to //flutter/third_party (flutter/engine#48193)
As part of eliminating the Flutter buildroot
(https://github.com/flutter/flutter/issues/67373), we are moving all
third-party dependencies from //third_party to //flutter/third_party.

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

No tests changed because there is no semantic change to this PR. This is
simply relocating a dependency.

This PR moves expat, ocmock, libjpeg-turbo, libwebp, and wuffs to
//flutter/third_party.

It also deletes //third_party/fontconfig, which was unused.
2023-11-19 22:53:29 -08:00
Matan Lurey
2b34bf3fe2 Make shell/platform/{darwin|embedder}/... compatible with .clang-tidy. (flutter/engine#48160) 2023-11-18 01:06:05 +00:00
Bartek Pacia
2168e305d1 Fix a few typos (flutter/engine#47960)
I found 3 small typos :)

Supersedes #47929

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-11-17 22:46:51 +00:00
hangyu
cd4c07d7a2 [Android] Send " did gain focus" message from engine to framework (flutter/engine#47114)
issue:https://github.com/flutter/flutter/issues/97747

framework pr:https://github.com/flutter/flutter/pull/135771

## 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

---------

Co-authored-by: Reid Baker <reidbaker@google.com>
2023-11-17 13:31:33 -08:00
Chris Yang
e7f47ca25d [Ios] move flutter_test_ios_mrc unittests to arc (flutter/engine#48162)
Move all tests in flutter_test_ios_mrc to arc

Part of https://github.com/flutter/flutter/issues/137801

Changes mostly involves trivial mrc to arc changes. non-trivial changes are commented inline. 

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-11-17 20:26:16 +00:00
Dan Field
21b2df9815 Reland "[Impeller] Fail if software backend is chosen and Impeller is enabled on iOS." (flutter/engine#46275)
Reverts flutter/engine#46217

cl/568091248 makes this safe to land again.

fyi @jonahwilliams @chinmaygarde
2023-11-17 20:12:48 +00:00
yaakovschectman
bb97ac1d3b Assign mojom kSwitch role to switches (flutter/engine#48146)
We have previously been using the `kToggleButton` role for any widget
that has a toggled state. Our AX library does not expect this role to be
used for switches, and so would not assign the checked state to switches
for MSAA. As far as I can tell, the `Switch` is the only widget that
uses the `toggled` semantic property (`ToggleButtons`, ironically, does
not), so we ought to be able to swap in the `kSwitch` role, for which
the proper states are presented. This will allow screen readers to
announce the state of a switch.

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

## 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 `///`).
- [ ] 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-11-17 14:21:23 -05:00
Matan Lurey
56fc8315cc Re-land "Make flow/embedded_views.h compatible with .clang_tidy." (flutter/engine#48137)
Reverts flutter/engine#48130.

Now that the `runIf` clauses are omitted, CI should be a reliable source
of truth.
2023-11-16 13:05:13 -08:00
Chris Bracken
ee4fcf69da [macOS] Replace pasteboard mock with fake (flutter/engine#48110)
Also replaces the use of OCMock with a fake for tests involving the use of NSPasteboard. This avoids unnecessary use of OCMock in the tests, which has been responsible for flakiness in some tests, in particular where the mock is used across threads. This test was not problematic, but the fake makes the tests more readable.

Issue: https://github.com/flutter/flutter/issues/104789
Issue: https://github.com/flutter/flutter/issues/127441
Issue: https://github.com/flutter/flutter/issues/124840

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-11-16 18:13:50 +00:00
auto-submit[bot]
74d08febd7 Reverts "Make flow/embedded_views.h compatible with .clang_tidy." (flutter/engine#48130)
Reverts flutter/engine#47994
Initiated by: jonahwilliams
This change reverts the following previous change:
Original Description:
Work towards https://github.com/flutter/flutter/issues/134969.

All changes were made automatically (i.e. with `--fix`).
2023-11-16 17:18:18 +00:00
Chris Bracken
87e57d7e14 [macOS] Replace fixture subclasses with usings (flutter/engine#48111)
In cases where we subclassed gtest fixtures purely to get better naming for test output (i.e. displaying/filtering on AccessibilityBridgeMacTest instead of AutoreleasePoolTest, replace these with `using` declarations, which is equally effective and avoids actually subclassing.

This applies no semantic changes to the code or tests.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-11-16 16:55:27 +00:00
Matan Lurey
b741431a73 Make flow/embedded_views.h compatible with .clang_tidy. (flutter/engine#47994)
Work towards https://github.com/flutter/flutter/issues/134969.

All changes were made automatically (i.e. with `--fix`).
2023-11-16 08:47:54 -08:00
Dan Field
d38b0967a0 [Impeller] Gate Vulkan selection on API 29 (flutter/engine#48089)
Platform Views on Android require API 29 when using Vulkan.

~~I'm not sure if I did the CI changes right, want to run it here and see. The added test needs to run on a device or emulator with API 29 or above and API 28 or below to be valid.~~

Makes the following changes to CI:

- Runs the emulator tests on presubmit, but only if `shell/platform/android/**` or `lib/ui/**` or `.ci.yaml` changes.
- Changes the emulator tests to be a regular engine_v2 test that spawns an x86 build. Unfortunately, the older API level emulators are only available for x86, not x86_64, and you cannot run the binary we create unless it matches the ABI.
- Runs the new test on both API 28 and API 34.

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

/cc @johnmccutchan fyi
2023-11-16 02:04:41 +00:00
Chris Bracken
17d7e20c16 [macOS] Clean up allocations in menu plugin test (flutter/engine#48093)
Runs all FlutterMenuPlugin tests in an AutoReleasepoolTest, which                   
ensures all allocations are cleaned up.                                             
                                                                                    
Also extracts out some hackery into the FlutterMenuPluginTest fixture to            
ensure that NSApplication instantiates everything necessary to do menu              
bar manipulation.                                                                   
                                                                                    
Also replaces the use of OCMock in FlutterMenuPluginTest.mm with a fake             
FakePluginRegistrar class. This avoids unnecessary use of OCMock in the             
tests, which has been responsible for flakiness in some tests, in                   
particular where the mock is used across threads. This test was not                 
problematic, but the fake makes the tests more readable.                            
                                                                                    
Also fixes linter warnings about using NSLocalizedString for user-facing            
strings.

Issue: https://github.com/flutter/flutter/issues/104789
Issue: https://github.com/flutter/flutter/issues/127441
Issue: https://github.com/flutter/flutter/issues/124840
2023-11-15 16:40:39 -08:00
Chris Yang
c07e3193e7 [ios] introduce weak_nsobject (flutter/engine#47947)
Introduce weak_nsobject from chromium. 

There are some usages of weak_ptr wrapping Objective-C ids, weak_ptr is not really designed for ids and such usages are blocking the arc migration. 

This PR mostly copies the weak_nsobject from chromium, at the same hash that we copied the ARC/MRC compatible scoped_nsobject: fd625125b8

To match how we used weak_ptr for those ids, I made some changes to the weak_nsobject:
- WeakNSObjects needs to be generated by a WeakNSObjectFactory. The WeakNSObjectFactory is owned by the objc class and acts as the generator of the WeakNSObjects. All the WeakNSObjects' derefing thread should be the same of the WeakNSObjectFactory's creation thread.
- chromuim's WeakNSObjects can be detached from the thread and re-attached to a new thread. To match our weak_ptr behavior, I changed WeakNSObjects to be only accessed from a single thread, the same as weak_ptr

This PR also moves the FlutterEngine to use WeakNSObject and updated related classes.

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

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-11-15 23:43:24 +00:00