5290 Commits

Author SHA1 Message Date
Yegor Pomortsev
62b3a0cfa7 Remove dependencies on fuchsia.sys.* FIDL protocols (flutter/engine#44614)
The fuchsia.sys FIDL library, used to implement v1 components, is
deprecated in the Fuchsia platform and is being removed.

Flutter now implements Components v2 but still imports the old library.

Bug: https://fxbug.dev/109013
2023-08-12 10:41:38 +10:00
John McCutchan
41331e0315 Rename impeller::TextureIntent to impeller::TextureCoordinateSystem (flutter/engine#44628) 2023-08-11 13:28:03 -07:00
stuartmorgan
0f08a911aa Allow macOS plugins to register as app delegates (flutter/engine#44587)
Adds `addApplicationDelegate:` to the macOS plugin registrar, following the corresponding iOS method, and wires it up to the existing app delegation forwarding that was recently added for use at the application level. (The actual delegate is non-trivially different between iOS and macOS, but that's not resolveable without a complex migration on the iOS side, so the APIs currently diverge after the level of the `addApplicationDelegate:` method itself.)

This doesn't add any new methods to the delegation; those will be added in a follow-up PR.

Also fixes a retain cycle in the termination handler that prevented the new test from working.

Most of https://github.com/flutter/flutter/issues/41471

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-08-11 19:57:06 +00:00
Loïc Sharma
649b38752e [Embedder] Refactor how semantic updates are mapped (flutter/engine#44553)
This refactors how engine semantic updates are mapped to embedder semantic updates. There are no behavioral changes.

Part of https://github.com/flutter/flutter/issues/119970, https://github.com/flutter/flutter/issues/98948

Next PR: https://github.com/flutter/engine/pull/44616

## Background
For https://github.com/flutter/flutter/issues/119970, we will need to update the embedder API to add string attributes to semantic nodes' text values. There are multiple kinds of string attributes, and each text value can have multiple string attributes. This requires gnarly mapping code that's best kept out of `embedder.cc`.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-08-11 16:22:10 +00:00
John McCutchan
bcd2be5d8a Add support for HardwareBuffer backed Android Platform Views under Impeller/GLES (flutter/engine#44617)
- Implement Impeller/GLES code paths.
- A couple of fixes for EXTERNAL_OES textures via bdero@
2023-08-11 00:41:53 -07:00
Chris Bracken
234063b3ae [shell] Add references to VsyncWaiter docs (flutter/engine#44607)
Point users in the direction of VsyncWaiterAndroid, VsyncWaiterEmbedder.

No new tests since this patch introduces no semantic changes.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-08-10 22:00:07 +00:00
LoveJello
c309b2295b Fix unexpected pointer change issue and Add test case (flutter/engine#43949)
Fix issue 129765 and Add test case, see  issue
Fixes https://github.com/flutter/flutter/issues/129765

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

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-08-10 20:04:46 +00:00
chunhtai
e7cb4195f2 Reland "Android a11y bridge sets importantness" (flutter/engine#44589)
The previous pr was reverted due to test failures. The failure was due to API not supported in order android version. The fix is in the second commit.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-08-10 20:02:12 +00:00
John McCutchan
c3606872fb Support for Android Platform Views under Impeller/Vulkan (flutter/engine#44571)
- Introduce AndroidHardwareBufferTextureSourceVK.
- Enable the necessary Vulkan extensions to support
AndroidHardwareBufferTextureSourceVK.
- Refactor HardwareBufferExternalTextureGL into a base class and a GL
and VK specializations.
- Switch ImageReaderPlatformView to use the PRIVATE image format
(enables DRM'd content to be captured in the texture).
- Add a AHardwareBuffer_describe to NDKHelpers.
- Misc cleanups.
2023-08-10 12:54:47 -07:00
yaakovschectman
c2cc8508b6 Reintroduce Windows lifecycle with guard for posthumous OnWindowStateEvent (flutter/engine#44344)
Previously, destruction of `Window` called `DestroyWindow`, which may
send `WM_KILLFOCUS` to the to-be-destroyed window. Because `Window`'s
destructor is called after `FlutterWindow`'s, the `FlutterWindow` vtable
was already destroyed at this point, and the subsequent call to the
virtual method `OnWindowStateEvent` would cause a crash. This PR
reintroduces the reverted changes for Windows lifecycle with a check
before calling the virtual method that the `FlutterWindow` object has
not yet been destructed.

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

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

## Pre-launch Checklist

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

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

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#overview
[Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene
[Flutter Style Guide]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo
[C++, Objective-C, Java style guides]:
https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
[testing the engine]:
https://github.com/flutter/flutter/wiki/Testing-the-engine
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes
[Discord]: https://github.com/flutter/flutter/wiki/Chat

---------

Co-authored-by: Loïc Sharma <737941+loic-sharma@users.noreply.github.com>
2023-08-10 15:37:04 -04:00
Matt2D
68dccebb48 Flutter iOS Interactive Keyboard: Fixing Behavior Issue (flutter/engine#44586)
This PR addresses an issue with the behavior of the keyboard. Originally the behavior of the keyboard was to see if the pointer was above or below the middle of the keyboards full size and then animate appropriately. However we found that the behavior is instead based on velocity. This PR adjust the code to match this behavior.

Design Document:
https://docs.google.com/document/d/1-T7_0mSkXzPaWxveeypIzzzAdyo-EEuP5V84161foL4/edit?pli=1

Issues Address:
https://github.com/flutter/flutter/issues/57609

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-08-10 19:02:08 +00:00
Zachary Anderson
2ecdda61fa Revert "Android a11y bridge sets importantness" (flutter/engine#44569)
Reverts flutter/engine#44452

Failing the roll to the framework on FTL tests:
https://ci.chromium.org/ui/p/flutter/builders/try/Linux%20firebase_android_embedding_v2_smoke_test/58307/overview
2023-08-09 19:51:22 -07:00
Matt2D
9fb889d3a8 Flutter iOS Interactive Keyboard: Fixing Animation Issue (flutter/engine#44514)
This PR addresses an issue with the animation of the keyboard. In iOS 16.0 a delay was included in UIView becomeFirstResponder where the areAnimationsEnabled boolean is no longer immediately read. In response to this issue a delay is added that allows for the animation to be properly disabled. 

Design Document:
https://docs.google.com/document/d/1-T7_0mSkXzPaWxveeypIzzzAdyo-EEuP5V84161foL4/edit?pli=1

Issues Address:
https://github.com/flutter/flutter/issues/57609

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-08-09 21:22:05 +00:00
chunhtai
1cffdd164a Android a11y bridge sets importantness (flutter/engine#44452)
Accessibility scanner uses isImportantForAccessibility to decide whether to scan the node. If not set, the isImportantForAccessibility is default to false, thus skips all node except for the rootview which defaults to true.

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

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-08-09 16:58:01 +00:00
ftsui
f0d7c4c4c2 Request GLES version 2 interface. (flutter/engine#44504)
- SKIA requires at least GLES version 2.0

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-08-09 16:38:28 +00:00
Caroline Liu
4e424a605d Remove GFX and Scenic dependencies from Fuchsia integration tests (flutter/engine#44498)
This change removes GFX and Scenic dependencies from Fuchsia integration
tests. Mainly, it:
- swaps out `fuchsia.ui.scenic.Scenic/GetDisplayInfo` for
`fuchsia.ui.display.singleton.Info/GetMetrics`
- removes the no longer necessary `fuchsia.ui.scenic.Scenic` connections
and component manifest declarations from tests
- removes any extraneous build deps tests have on `fuchsia.ui.gfx`,
`fuchsia.ui.policy`, and `scenic_cpp`

Related bug: fxbug.dev/64206

## Pre-launch Checklist

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

This PR updates the Windows engine in order to answer to keyboard pressed state queries from the framework (as implemented in https://github.com/flutter/flutter/pull/122885).

## Related Issue

Windows engine implementation for https://github.com/flutter/flutter/issues/87391.

Similar to:
- Linux: https://github.com/flutter/engine/pull/42346
- Android: https://github.com/flutter/engine/pull/42758
- macOS: https://github.com/flutter/engine/pull/42878

## Tests

Adds 2 tests.
2023-08-09 06:31:05 +00:00
Chris Bracken
551fe982eb [macOS] Improve engine retain cycle testing (flutter/engine#44509)
Adds testing that verifies that the engine is not retained via the FlutterTextureRegistry that is returned from the FlutterTextureRegistrar returned by the engine.

This also simplifies the existing test for a retain cycle via the FlutterBinaryMessenger by avoiding manually casting the binary messenger to a FlutterBinaryMessengerRelay, or knowing any of its implementation details.

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

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-08-08 22:18:46 +00:00
Matt2D
d669ddd4f4 Flutter iOS Interactive Keyboard: Handle Pointer Up (flutter/engine#44457)
This PR address the movement aspect of the flutter interactive keyboard. It handles pointer up while a scroll view widget is visible, and the interactive behavior is chosen for keyboardDismissBehavior. This is a desired behavior of the keyboard that has not yet been implemented.
Design Document:
https://docs.google.com/document/d/1-T7_0mSkXzPaWxveeypIzzzAdyo-EEuP5V84161foL4/edit?pli=1

Issues Address:
https://github.com/flutter/flutter/issues/57609

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-08-08 19:09:44 +00:00
Caroline Liu
e493b1011e Remove GFX branches from Flutter engine (flutter/engine#44401)
This change does the following:
- Refactors `engine.cc`/`.h` and `component_v2.cc`/`.h` to remove GFX ctors and callbacks.
- Removes `gfx_external_view_embedder`, `gfx_platform_view`, `gfx_session_connection`, their tests, and any supporting testing infrastructure (e.g. `fake_session`) from the build. This change does not delete the source files themselves in order to keep the change size smaller (as all these file deletions together are about another ~8K lines worth of deletions.) A separate follow up change will delete these files.

Related bug: fxbug.dev/64206
2023-08-08 18:20:09 +00:00
Jason Simmons
2ae4942db0 Use the Clang unreachable code warning flag in the engine tree (flutter/engine#44458) 2023-08-08 17:40:03 +00:00
Chris Bracken
e43adf1acd [macOS] Fix engine/binaryMessenger retain cycle (flutter/engine#44471)
Previously, FlutterEngine.binaryMessenger returned the FlutterEngine
instance itself, which meant that channels/plugins could hold a strong
reference to the engine and thus cause a retain cycle, preventing the
engine from being deallocated.

We introduce FlutterBinaryMessengerRelay, which implements the
FlutterBinaryMessenger protocol, by delegating back to the engine, to
which it holds a weak reference, thus avoiding the retain cycle.

This also changes the FlutterBinaryMessengerRelay.parent property from
an assign property to a weak property since that code is compiled with
ARC enabled as of https://github.com/flutter/engine/pull/44395.

This patch also rearranges the headers to comply with our style guide:
related headers for this file, C headers, C++ headers, other Flutter
headers, in that order.

Fixes: https://github.com/flutter/flutter/issues/116445
2023-08-08 09:26:28 -07:00
Jason Simmons
0413e2710d Revert "[Impeller] DlCanvas implementation wrapping Aiks canvas" (flutter/engine#44466)
This reverts commit 1785eb5cb8cba53da249614158065d1d53f8f863.

See https://github.com/flutter/flutter/issues/132071
2023-08-07 23:59:47 +00:00
ftsui
0cc053b836 Fix use-after-free crash in glfw embedder (flutter/engine#44358)
When setting up the paths to assets and ICU data, we were previously returning the underlying char* data in a temporary string returned by `std::filesystem::path::string()`. Since the return value of `string()` is never stored, there's no guarantee that the underlying data pointer is still valid later in the function. By storing the string in a local whose lifetime exceeds that of the running engine instance, we guarantee the string isn't freed until after the Flutter app terminates.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-08-07 19:11:24 +00:00
Jason Simmons
75f91264d1 Do not log exceptions from JNI lookups of APIs that are known to be unavailable on older devices (flutter/engine#44357)
These exceptions are benign but were being logged every time an app is launched on a device with an Android API level below 26.
2023-08-07 14:35:05 +00:00
Chris Bracken
fe643d0859 [Darwin] Move FlutterBinaryMessengerRelay to common (flutter/engine#44395)
Migrates FlutterBinaryMessengerRelay to
//flutter/shell/platform/darwin/common so that it can be used in a
followup patch on macOS, to fix a memory leak due to a retain cycle.

Migrates the unit tests to be compatible with gtest, which is used by
the darwin/common unit tests.

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


## 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-08-04 15:24:22 -07:00
Chris Bracken
540a6f106b [Darwin] Enable ARC in darwin/common unit tests (flutter/engine#44396)
The end goal is for all Objective-C code to be compiled with ARC enabled. The common framework code is already compiled with ARC enabled; this enables it for the tests as well.

This is prework before migrating FlutterBinaryMessengerRelay to the common Darwin code.

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

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-08-04 19:59:06 +00:00
Matt2D
24596f463d Flutter iOS Interactive Keyboard: Take Screenshot and Handle Pointer Movement (flutter/engine#43972)
This PR address the movement aspect of the flutter interactive keyboard. It handles pointer movement while a scroll view widget is visible, and the interactive behavior is chosen for keyboardDismissBehavior. This is a desired behavior of the keyboard that has not yet been implemented. 
Design Document:
https://docs.google.com/document/d/1-T7_0mSkXzPaWxveeypIzzzAdyo-EEuP5V84161foL4/edit?pli=1

Issues Address:
https://github.com/flutter/flutter/issues/57609

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-08-04 18:25:09 +00:00
Dan Field
1785eb5cb8 [Impeller] DlCanvas implementation wrapping Aiks canvas (flutter/engine#44248)
Fixes https://github.com/flutter/flutter/issues/130141

The primary goal of this patch is to move dispatching of `dart:ui` `Canvas` commands to the UI thread.

Before this patch, the architecture is something like:

## UI Thread
- `dart:ui` talks to `DisplayListBuilder`, a `DlCanvas` implementation.
- `DisplayListBuilder` does some clip/bounds tracking and creates a `DisplayList` object that is held by `dart:ui`'s `Picture` objects.
- `DisplayList`s are added to `DisplayListLayer`s in `flow`. 

## Raster Thread
- `flow` flattens the various operations into a single `DisplayList` via another `DisplayListBuilder`.
- A `DlOpReceiver`implementation converts that `DisplayList` into an `Aiks` `Canvas`/`Picture`.

After this patch, the architecture instead looks like:

## UI Thread

- No change for Skia.
- If Impeller, use a new `DlCanvasImplementation` that talks to `Aiks`'s `Canvas`.
- If Impeller, `dart:ui` Picture's now hold an `Aiks` `Picture`, which get shared into `AiksLayer`s in `flow`.

## Raster thread

- No change for Skia, but some light refactoring for places that assumed a `DisplayListBuilder` where they really just needed a `DlCanvas`.
- The `Aiks` `Picture`s are combined using new API on `DlCanvas` and still backed by `Aiks`.

These changes show significant improvement on raster times on Android and only very small regressions on UI times in local testing, see https://gist.github.com/dnfield/26528090194c9f5abdbac13cdcbf4f79 for old gallery transition perf numbers.

Many of the other changes in this patch are related to the following:

- Making `DlRTree` usable for Impeller.
  - It would be nice to have a version of DlRTree that speaks `impeller::Rect`.
- Creating the requisite classes to support `EmbeddedViews` so that Desktop works.

This patch does not remove the `impeller::DlDispatcher`, which now would only be used in tests.
2023-08-04 17:35:14 +00:00
Chris Yang
35e6c2e48d Revert "Build iOS unittest target in unopt builds" (flutter/engine#44356)
Reverts flutter/engine#44301

```
Traceback (most recent call last):
  File "/Volumes/Work/s/w/ir/cache/builder/src/flutter/testing/run_tests.py", line 1286, in <module>
    sys.exit(main())
  File "/Volumes/Work/s/w/ir/cache/builder/src/flutter/testing/run_tests.py", line 1269, in main
    run_objc_tests(args.ios_variant, args.objc_filter)
  File "/Volumes/Work/s/w/ir/cache/builder/src/flutter/testing/run_tests.py", line 721, in run_objc_tests
    ensure_ios_tests_are_built(ios_out_dir)
  File "/Volumes/Work/s/w/ir/cache/builder/src/flutter/testing/run_tests.py", line 625, in ensure_ios_tests_are_built
    assert flutter_dylib_time <= ios_test_lib_time, final_message
AssertionError: /Volumes/Work/s/w/ir/cache/builder/src/out/ios_debug_sim_arm64_extension_safe/libios_test_flutter.dylib is older than /Volumes/Work/s/w/ir/cache/builder/src/out/ios_debug_sim_arm64_extension_safe/libFlutter.dylib. Please run the following commands: 
gn --ios --unoptimized --runtime-mode=debug --no-lto --simulator
ninja -C /Volumes/Work/s/w/ir/cache/builder/src/out/ios_debug_sim_arm64_extension_safe ios_test_flutter
```

It failed we in run_test.py we check if the ios_test is built after the framework, which is not true anymore after moving the test inside the build target.
2023-08-03 23:22:55 +00:00
Dan Field
528d5bfddc [Impeller] Fail loudly if --enable-software-rendering is used. (flutter/engine#44346)
We have tests today that are trying to testwith impeller but using software rendering, so they're not actually testing with impeller.

In an unrelated patch, I'm causing the request to enable impeller to have additional checks that Impeller related objects/configurations are set when using Impeller, which isn't true if software rendering is enabled, and is causing the tests getting disabled here to fail.

The tests are not actually testing Impeller and thus are getting added to the skip list (they now crash with this change). https://github.com/flutter/flutter/issues/131888 tracks re-enabling them. They will almost certainly need different golden files than the Skia ones.

Fixes https://github.com/flutter/flutter/issues/131887
2023-08-03 23:01:05 +00:00
John McCutchan
6e79ecd59d Remove WARNINGs from JNI load path as we can't suppress them (flutter/engine#44348)
Help unblock roll
2023-08-03 14:22:36 -07:00
Chris Yang
91773de5cb Build iOS unittest target in unopt builds (flutter/engine#44301)
build ios unittest target in unopt builds. 

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-08-03 20:33:04 +00:00
Chris Bracken
d86ab60601 [darwin] Move common targets to common/BUILD.gn (flutter/engine#44335)
Previously, some common Darwin framework targets existed in: 
//flutter/shell/platform/darwin/BUILD.gn

This moves all targets into:
//flutter/shell/platform/darwin/common/BUILD.gn

The framework_shared target has been renamed framework_common for consistency with the directory name, and flutter_channels_unittests has been renamed framework_common_unittests since it's a reasonable target for adding other tests of common framework code.

We also de-duplicate targets with existing targets.
* The `flutter_channels` target duplicates the existing
`framework_shared` target.
* The `common` target already includes the buffer conversions
translation units,
  which are only used by the iOS embedder.

No test changes since there are no semantic changes, just a
restructuring of build targets.

## Pre-launch Checklist

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

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

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#overview
[Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene
[Flutter Style Guide]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo
[C++, Objective-C, Java style guides]:
https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
[testing the engine]:
https://github.com/flutter/flutter/wiki/Testing-the-engine
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes
[Discord]: https://github.com/flutter/flutter/wiki/Chat
2023-08-03 13:21:35 -07:00
Kevin Lubick
ecda6a659e Migrate GL calls of GrBackend* (flutter/engine#44334)
In https://skia-review.googlesource.com/c/skia/+/701398 Skia refactored
GrBackend* to not require #ifdefs. This changes
callsites in Flutter to use static functions instead of methods that
were conditionally compiled on those classes.

There should be no functional change with these. As I was updating these
callsites, I saw uses of the deprecated GrMipMapped enum and used the
updated skgpu::Mipmapped (the former is an alias to the latter).

## 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.
- [ ] I added new tests to check the change I am making or feature I am
adding, or Hixie said the PR is test-exempt. See [testing the engine]
for instructions on writing and running engine tests.
- [ ] I updated/added relevant documentation (doc comments with `///`).
- [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-08-03 15:46:14 -04:00
John McCutchan
0cb36c4ad8 Add @Keep annotations to avoid dead code elimination of classes only referenced by JNI (flutter/engine#44337)
Missing piece
2023-08-03 11:50:52 -07:00
hellohuanlin
8b783056f4 [ios]make the screenIfViewLoaded and windowSceneIfLoaded helpers reusable (flutter/engine#44303)
The existing `screenIfViewLoaded` and `windowSceneIfLoaded` functions are private helpers of `FlutterViewController` class. This PR moves the logic to a category of the `UIViewController`, so it can be reused for any `UIViewController`s. 

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

https://github.com/flutter/engine/pull/43972#discussion_r1282214557

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

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-08-03 17:19:16 +00:00
John McCutchan
756815c4e6 Re-Re-Land Support for rendering Android Platform Views into a HardwareBuffer backed texture (flutter/engine#44326)
Introduce TextureRegistry.ImageTexture and related machinery.
Introduce ImageReaderPlatformViewRenderTarget.
Introduce HardwareBufferExternalTextureGL and related machinery.
NOTE: ImageReaderPlatformViewRenderTarget requires Android 26.

NOTE: This CL does not enable using ImageReaderPlatformViewRenderTarget
yet.

Related https://github.com/flutter/flutter/issues/130892

---------

Co-authored-by: Jason Simmons <jsimmons@google.com>
2023-08-03 09:49:55 -07:00
Jackson Gardner
5e511a585c Revert Android Hardware Texture PRs (flutter/engine#44310)
This reverts the following PRs:

https://github.com/flutter/engine/pull/44278
https://github.com/flutter/engine/pull/44293
https://github.com/flutter/engine/pull/44304

We haven't been able to get the engine -> framework roller unblocked
with a forward fix, so let's try to revert and we can try to reland
these once we've investigated further.
2023-08-02 21:51:09 -07:00
Jason Simmons
d98f151c47 Check whether the lookup of android.hardware.HardwareBuffer found a class (flutter/engine#44304) 2023-08-03 00:24:11 +00:00
Chris Bracken
c9ed6a5dc1 [iOS] Fix use-after-free in setBinaryMessenger (flutter/engine#44294)
Previously, when setting the binary messenger to the current binary messenger, we were freeing the current binary messenger before setting the new (current) binary messenger, triggering a use after free.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-08-02 21:24:53 +00:00
LouiseHsu
7ee4615b80 Add Search Web to selection controls on iOS (flutter/engine#43324)
In native iOS, users are able to select text and initiate a web search on the selected text. Specifically, this will launch a search using the users selected default search engine. Apple provides a custom url scheme in the form of "x-web-search://?[term]" which will automatically launch a search using the user's preferred browser in Safari. Additionally, this also correctly handles the country code top level domain eg. a user with a selected region in the UK with a preferred Google search engine will automatically have the .co.uk domain appended to the end of the search.

This PR is the engine portion of the changes that will allow Search Web to be implemented
This PR addresses https://github.com/flutter/flutter/issues/82907
More details are available in this [design doc](https://github.com/flutter/engine/pull/flutter.dev/go/add-missing-features-to-selection-controls)
2023-08-02 20:43:39 +00:00
John McCutchan
32135ec2e0 Be sure to clear exceptions after a failed JNI lookup (flutter/engine#44293)
In the case that methods don't exist because we are running on an old
Android SDK, clear the exception that the failed JNI lookup threw.
2023-08-02 13:10:20 -07:00
Derek Xu
dedec555f2 Handle deprecation of Dart_TimelineEvent Embedder API (flutter/engine#42497)
This PR changes usages of `Dart_TimelineEvent` to
`Dart_RecordTimelineEvent` as `Dart_TimelineEvent` was deprecated in
https://dart-review.googlesource.com/c/sdk/+/308721.
2023-08-02 16:09:31 -04:00
hellohuanlin
da9b932e28 [ios][autocorrection]disable auto-correction highlight in iOS 17 (flutter/engine#44176)
This PR disables the "auto-correction highlight" feature in iOS 17. 

This feature was introduced in https://github.com/flutter/flutter/pull/45354 and https://github.com/flutter/engine/pull/13959/ (CC: @LongCatIsLooong who was the original author)

I have created [a new issue](https://github.com/flutter/flutter/issues/131622) to find other approaches to re-enable this feature. 

**Note that "auto-correction" itself still works, it's only the "highlight" part is disabled:**

- iOS 16 with highlight:
https://github.com/flutter/engine/assets/41930132/2fe7bbf6-f2db-4212-a020-e420ad8dd5e6

- iOS 17 without highlight:
https://github.com/flutter/engine/assets/41930132/34f34743-6bef-4e93-80d2-d04c92ba59bf

## Why disable this feature?

The original PR uses `UITextInput::firstRectForRange` API for auto-correction, since Apple does not provide any other API when auto-correction should show up, so the original PR used this API as a workaround. 

In iOS 17, Apple changed a few `UITextInput` behaviors:  
- UIKit does not query `UITextInput::firstRectForRange` for text range of the auto-corrected word any more. 
- But instead, it repeatedly queries every single character of the current word (after entering or deleting a character), regardless whether the word should be auto-corrected or not. 

I have tried all other `UITextInput` APIs that takes a text range, and none are suitable for auto-correction feature. As a result, I have to disable this feature for iOS 17 for now. 

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

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

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

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-08-02 18:20:17 +00:00
John McCutchan
d4d816b177 Reland Introduce TextureRegistry.ImageTexture and HardwareBufferExternalTextureGL (flutter/engine#44278)
Introduce TextureRegistry.ImageTexture and
HardwareBufferExternalTextureGL

- Introduce TextureRegistry.ImageTexture and related machinery.
- Introduce HardwareBufferExternalTextureGL and related machinery.
- Introduce ImageReaderPlatformViewRenderTarget.

NOTE: ImageReaderPlatformViewRenderTarget requires Android 26.

NOTE: This CL does not enable using ImageReaderPlatformViewRenderTarget
yet.

Additional fixes:

- Relax JNI lookup for classes and methods that aren't available in API
22
- Add @Keep annotations on code that is only referenced by JNI
2023-08-02 10:52:06 -07:00
Loïc Sharma
ad7865d372 Revert "Listen to window notifications to update application lifecycle" (flutter/engine#44275)
Reverts flutter/engine#43558

Customer reported a crash on shutdown:

```
flutter::Window::HandleMessage(unsigned int,unsigned __int64,__int64)
...
?NtUserDestroyWindow
flutter::Window::Destroy()
flutter::Window::~Window()
flutter::FlutterWindow::`vector deleting destructor'`adjustor{312}' (unsigned int)
flutter::FlutterWindowsView::~FlutterWindowsView()
flutter::FlutterWindowsView::~FlutterWindowsView
FlutterDesktopViewControllerDestroy
flutter::FlutterViewController::~FlutterViewController
FlutterWindow::~FlutterWindow()
wWinMain
```

The message causing the crash is `WM_KILLFOCUS`.
2023-08-02 17:18:21 +00:00
Chris Yang
e3a395f1ab [iOS][A11Y] fix hittest with non-SemanticsObject (flutter/engine#44014)
PlatformViewSemanticsContainer did not implement the nativeAccessibility method, leads to a nil object being returned. 

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

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-08-02 16:15:16 +00:00
Zachary Anderson
f417dbc920 Revert "[Impeller] Support for rendering Android Platform Views into a HardwareBuffer backed texture." (flutter/engine#44262)
Reverts flutter/engine#44087

Reverting for https://github.com/flutter/flutter/issues/131772
2023-08-02 08:04:44 -07:00
John McCutchan
75cc4c162b [Impeller] Support for rendering Android Platform Views into a HardwareBuffer backed texture. (flutter/engine#44087)
- Introduce TextureRegistry.ImageTexture and related machinery.
- Introduce ImageReaderPlatformViewRenderTarget.
- Introduce HardwareBufferExternalTextureGL and related machinery.

NOTE: ImageReaderPlatformViewRenderTarget requires Android 26.

NOTE: This CL does not enable using ImageReaderPlatformViewRenderTarget
yet.

Related https://github.com/flutter/flutter/issues/130892
2023-08-01 15:39:32 -07:00