6167 Commits

Author SHA1 Message Date
Chris Bracken
faa6496380 iOS: Migrate FlutterAppDelegate to ARC (flutter/engine#55472)
Migrates the FlutterAppDelegate.mm translation unit to be compiled with the `-fobjc-arc` compiler flag.

No test changes since no this change includes no semantic changes, and thus covered by existing tests such as [`testReleasesWindowOnDealloc`](f6e580d09a/shell/platform/darwin/ios/framework/Source/FlutterAppDelegateTest.mm (L139-L153)).

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

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-09-27 22:44:53 +00:00
auto-submit[bot]
fdbad460a5 Reverts "[Impeller] hash even less stuff per frame. (#55092)" (flutter/engine#55491)
Reverts: flutter/engine#55092
Initiated by: jonahwilliams
Reason for reverting: framework golden failures.
Original PR Author: jonahwilliams

Reviewed By: {chinmaygarde, jtmcdole}

This change reverts the following previous change:
Follow up to https://github.com/flutter/engine/pull/55060

Currently we have multiple stages of hashing while font rendering, which is relatively expensive for the actualy required workload. First, we hash the contents of all text frames to compute the unique set of glyphs per frame. Then we diff this hash set against the hashmap of glyphs within the atlas. Finally we hash and lookup the final rendered bounds for each glyph.

We can simplify this to 2. hash lookups for glyphs not yet in the atlas and 1. hash lookup for glyphs that are in the atlas. This is done by combing the step where we uniquely compute glyphs per frame with the diff against the current atlas. When this lookup is performed, we also store the glyph position (if found) in the text_frame itself - which allows text contents to skip the last hash, as long as the glyph has already been rendered.

### Before

![flutter_03](https://github.com/user-attachments/assets/be9c4459-f0c8-426c-b152-38861acb207f)

### After

![flutter_04](https://github.com/user-attachments/assets/1aa7cbd1-6af7-4020-8966-7e3baaef102b)

Using this handy dandy test app:

```dart
import 'package:flutter/material.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {

  Widget build(context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: Text('Platform View'),
        ),
        body: SafeArea(child: Stack(children: [
          SizedBox(
            width: 380,
            height: 380,
            child: LinearProgressIndicator(),
          ),
          Stack(
            children: List<Widget>.generate(1000, (index) {
              // The problem already happens with a small amount of widgets.
              // Using an excessive amount of widgets is just to make the problem more evident.
              return Text("Lots of Texts represent a Widget with complex components.");
            }),
          ),

          Align(
            alignment: Alignment.bottomCenter,
            child:
            TextButton(
              child: Text("Button"),
              onPressed: () {
                print("Tap ${DateTime.now()}");
              },
            ),
          ),
        ],
        ),
        ),
      ),
    );
  }
}
```
2024-09-27 17:09:28 +00:00
Jonah Williams
e9a089f2fe [Impeller] hash even less stuff per frame. (flutter/engine#55092)
Follow up to https://github.com/flutter/engine/pull/55060

Currently we have multiple stages of hashing while font rendering, which is relatively expensive for the actualy required workload. First, we hash the contents of all text frames to compute the unique set of glyphs per frame. Then we diff this hash set against the hashmap of glyphs within the atlas. Finally we hash and lookup the final rendered bounds for each glyph.

We can simplify this to 2. hash lookups for glyphs not yet in the atlas and 1. hash lookup for glyphs that are in the atlas. This is done by combing the step where we uniquely compute glyphs per frame with the diff against the current atlas. When this lookup is performed, we also store the glyph position (if found) in the text_frame itself - which allows text contents to skip the last hash, as long as the glyph has already been rendered.

### Before

![flutter_03](https://github.com/user-attachments/assets/be9c4459-f0c8-426c-b152-38861acb207f)

### After

![flutter_04](https://github.com/user-attachments/assets/1aa7cbd1-6af7-4020-8966-7e3baaef102b)

Using this handy dandy test app:

```dart
import 'package:flutter/material.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {

  Widget build(context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: Text('Platform View'),
        ),
        body: SafeArea(child: Stack(children: [
          SizedBox(
            width: 380,
            height: 380,
            child: LinearProgressIndicator(),
          ),
          Stack(
            children: List<Widget>.generate(1000, (index) {
              // The problem already happens with a small amount of widgets.
              // Using an excessive amount of widgets is just to make the problem more evident.
              return Text("Lots of Texts represent a Widget with complex components.");
            }),
          ),

          Align(
            alignment: Alignment.bottomCenter,
            child:
            TextButton(
              child: Text("Button"),
              onPressed: () {
                print("Tap ${DateTime.now()}");
              },
            ),
          ),
        ],
        ),
        ),
      ),
    );
  }
}
```
2024-09-27 15:34:07 +00:00
Valentin Hăloiu
18b9cd0233 Add format field to EGL surface backing store (flutter/engine#54499)
Trying to use the `GL_BGRA8_EXT` format for the EGL surface backing store on *desktop* OpenGL platforms would fail at: 82d8bc5844/shell/platform/embedder/embedder.cc (L869)

This seems to be a known issue and both the Linux and Windows embedders have some logic to pick a different format depending on the OpenGL context information:

bc8c82d157/shell/platform/windows/compositor_opengl.cc (L23-L34)

bc8c82d157/shell/platform/linux/fl_framebuffer.cc (L81-L104)

This pull-request gets rid of the hard-coded `GL_BGRA8_EXT` format and makes it configurable by adding a `format` field to the `FlutterOpenGLSurface` struct.

_Disclaimer_: This has only been tested on desktop Linux (Wayland) using the `GR_GL_RGBA8` format which seemed to work as expected.

This change is related to the recently introduced EGL surface backing store: https://github.com/flutter/flutter/issues/58363

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-09-27 00:23:13 +00:00
Jonah Williams
b9d92a4d0c [Impeller] remove entity pass and re-combine canvas implementations. (flutter/engine#55019)
Shouldn't land until experimental canvas bakes a while

Major milestone along the route to making display list the impeller API. Removes the secondary compositor in entity pass. After this point, we can begin ripping out the DL->Aiks conversions and making entities more efficient.

Fixes https://github.com/flutter/flutter/issues/132417
Fixes https://github.com/flutter/flutter/issues/126386
Fixes https://github.com/flutter/flutter/issues/155114

Part of https://github.com/flutter/flutter/issues/142054
2024-09-26 21:20:23 +00:00
auto-submit[bot]
248b86a64b Reverts "Reverts "Add SurfaceProducer#onSurfaceAvailable, deprecate onSurfaceCreated. (#55418)" (#55450)" (flutter/engine#55463)
Reverts: flutter/engine#55450
Initiated by: matanlurey
Reason for reverting: Fixed forward in https://github.com/flutter/packages/pull/7712.
Original PR Author: auto-submit[bot]

Reviewed By: {fluttergithubbot}

This change reverts the following previous change:
Reverts: flutter/engine#55418
Initiated by: bdero
Reason for reverting: [Engine->Framework roll breakage](https://github.com/flutter/flutter/issues/155727#issuecomment-2375489803)
Original PR Author: matanlurey

Reviewed By: {jonahwilliams}

This change reverts the following previous change:
Closes https://github.com/flutter/flutter/issues/155131.

Not only did I rename the method, but I also changed the contract slightly - now `onSurfaceAvailable` is _only_ invoked _after_ `onSurfaceDestroyed` has been called. The cost is a single `boolean`, and it honestly makes the API make a lot more sense than someone having to track this themselves.

/cc @johnmccutchan (OOO), and @flutter/android-reviewers.
2024-09-26 17:34:17 +00:00
Jonah Williams
33f2dcb7eb [iOS] remove clear color hack. (flutter/engine#54451)
Fixes https://github.com/flutter/flutter/issues/125640

This doesn't actually do anything, instead it forces opaque to false. If developers want opaque to be false, they can just set it directly.
2024-09-26 04:54:11 +00:00
auto-submit[bot]
80ce9f8631 Reverts "Add SurfaceProducer#onSurfaceAvailable, deprecate onSurfaceCreated. (#55418)" (flutter/engine#55450)
Reverts: flutter/engine#55418
Initiated by: bdero
Reason for reverting: [Engine->Framework roll breakage](https://github.com/flutter/flutter/issues/155727#issuecomment-2375489803)
Original PR Author: matanlurey

Reviewed By: {jonahwilliams}

This change reverts the following previous change:
Closes https://github.com/flutter/flutter/issues/155131.

Not only did I rename the method, but I also changed the contract slightly - now `onSurfaceAvailable` is _only_ invoked _after_ `onSurfaceDestroyed` has been called. The cost is a single `boolean`, and it honestly makes the API make a lot more sense than someone having to track this themselves.

/cc @johnmccutchan (OOO), and @flutter/android-reviewers.
2024-09-26 00:45:46 +00:00
Matan Lurey
e89480f02d Move lint suppression from baseline.xml to @SuppressLint. (flutter/engine#55447)
I think you just had the lint identifier wrong?

Closes https://github.com/flutter/flutter/issues/155712.
2024-09-25 22:41:11 +00:00
Jonah Williams
152dfb2fcf [engine] set platform thread name to ui. (flutter/engine#55362)
When running with merged platform and ui threads, set the dart thread name of the main thread to io.futter.ui. Also change the thread mask settings to avoid creating an unused UI thread.
2024-09-25 22:06:37 +00:00
jesswrd
21ddf3e6e3 Remove usages of WindowManager's getDefaultDisplay (flutter/engine#55002)
Removed deprecated usages of WindowManager's `getDefaultDisplay()` and
replaced them with DisplayManager's `getDisplay()`.

Note: Decided to keep a usage of `getDefaultDisplay()`, which can be
found in FlutterView.java because it is expected to be deleted as a part
of V1 embedding removal. No changes were made to that file.

path to FlutterView.java:
shell/platform/android/io/flutter/embedding/android/FlutterView.java

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

## Pre-launch Checklist

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

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

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#overview
[Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene
[test-exempt]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo
[C++, Objective-C, Java style guides]:
https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
[testing the engine]:
https://github.com/flutter/flutter/wiki/Testing-the-engine
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes
[Discord]: https://github.com/flutter/flutter/wiki/Chat
2024-09-25 17:04:00 -04:00
Matan Lurey
f425edfbf7 Add a boolean that exposes rotation/crop metadata capability. (flutter/engine#55434)
Closes https://github.com/flutter/flutter/issues/144407.
Closes https://github.com/flutter/flutter/issues/155633.
2024-09-25 19:27:08 +00:00
Matan Lurey
2291e92e59 Add SurfaceProducer#onSurfaceAvailable, deprecate onSurfaceCreated. (flutter/engine#55418)
Closes https://github.com/flutter/flutter/issues/155131.

Not only did I rename the method, but I also changed the contract slightly - now `onSurfaceAvailable` is _only_ invoked _after_ `onSurfaceDestroyed` has been called. The cost is a single `boolean`, and it honestly makes the API make a lot more sense than someone having to track this themselves.

/cc @johnmccutchan (OOO), and @flutter/android-reviewers.
2024-09-25 16:24:06 +00:00
Camille Simon
9be07d79a8 Update setSystemChromeEnabledSystemUIMode docs to note targeting Android 15+ change (flutter/engine#54560)
Updates `setSystemChromeEnabledSystemUIMode` documentation to reflect that edge-to-edge mode is used by default if the Flutter app targets Android 15.

Part of https://github.com/flutter/flutter/issues/150367 and engine counterpart to https://github.com/flutter/flutter/pull/153466.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-09-25 11:30:21 +00:00
Jonah Williams
79e371517d [Impeller] fix Impeller on windows. (flutter/engine#55323)
Fixes https://github.com/flutter/flutter/issues/141482

Since the introduction of the flutter compositor, the windows embedder will create an offscreen framebuffer and then blit this to the onscreen framebuffer. Therefore, the onscreen framebuffer should not be constructed as a multisample framebuffer - and the EGL config can match skia.

Also cleans up selection of the impeller PixelFormat, which might not have matched the selected compositor format because it was hardcoded to RGBA_8888
2024-09-24 23:38:52 +00:00
Jonah Williams
dd7948b2fe [Impeller] add basic culling checks during text frame dispatcher. (flutter/engine#55168)
Fixes https://github.com/flutter/flutter/issues/155133

Dl dispatching still relies on cull rects computed during that dispatch process. Make sure that the text frame dispatcher doesn't populate text frames that are way offscreen.

This culling is more conservative than the rendering dispatcher. We'd need to do some refactoring so the logic isn't repeated multiple times.
2024-09-24 23:37:06 +00:00
John McDole
14caa2fe19 Disallow time traveling frame times (flutter/engine#55310)
Address bad developer experience in
https://github.com/flutter/flutter/issues/106277

Leave as an error log and hope for more repro reports


```mermaid
sequenceDiagram
  Animator ->> Animator: AwaitVSync
  Animator ->> VsyncWaiter: AsyncWaitForVsync(callback)
  VsyncWaiter -> VsyncWaiterAndroid: AwaitVSync
  note over VsyncWaiterAndroid: GetUITaskRunner
  VsyncWaiterAndroid -> Choreographer: PostFrameCallback
  Choreographer -> NDK: AChoreographer_postFrameCallback64
  note over Choreographer,NDK: The time that the frame is being<br/>rendered as nanoseconds in the <br/>CLOCK_MONOTONIC time base
  NDK --> Choreographer: callback(nanos)
  Choreographer -> VsyncWaiterAndroid: callback
  note over VsyncWaiterAndroid: // Rollback suspicion<br/>if (frame_time > now) frame_time = now;
  VsyncWaiterAndroid -> VsyncWaiterAndroid: OnVsyncFromNDK(frame_nanos)
  VsyncWaiterAndroid -> VsyncWaiter: FireCallback(\n  frame_start_time,\n  target_time)
  VsyncWaiter -> Animator: callback(frame_timings_recorder)

  Animator -> Animator: BeginFrame(frame_timings_recorder)
  Animator -> Shell: OnAnimatorBeginFrame
  Shell -> Engine: BeginFrame(frame_time, frame_number)
  Engine -> RuntimeController: BeginFrame(frame_time, frame_number)
  RuntimeController -> PlatformConfiguration: BeginFrame(frame_time, frame_number)
  PlatformConfiguration -> hooks.dart: begin_frame_
```
2024-09-24 15:33:45 -07:00
Mahmut Taşkıran
92cc1aac8a Add a check for the surface if it is valid (flutter/engine#55277)
Fixes an issue where the Surface is not valid and the `draw` method is crashing.

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

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-09-24 18:43:06 +00:00
Jonah Williams
428565f27a [Impeller] finish wiring up external textures for macOS embedder. (flutter/engine#55347)
Fixes https://github.com/flutter/flutter/issues/135898

Note that the macOS embedder is still using the apple texture cache object from the SkiaMetalContext. it can't initialize an equivalent ImpellerMetalContext without creating a second copy of the content context and all that jazz, so I'm leaving that as is for now.
2024-09-24 18:26:51 +00:00
zijiehe@
cbaf3f8fbc [Fuchsia] Remove deprecated and unnecessary parameters from fuchsia*archive (flutter/engine#55324)
This is a precondition to use more high-level templates in fuchsia-gn-sdk to replace build rules in flutter.
Meanwhile fuchsia-gn-sdk does not use pm anymore and this change is also helpful to get rid of the use of pm.

Briefly, it removes all cmx_file parameters and avoids specifying duplicated parameters (binary / target_name / default cml file).

Bug: http://b/353729557, http://b/40935282

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-09-24 15:44:56 +00:00
Robert Ancell
53b8ece3c8 Use GTask integer return APIs and fix documentation on return value on error. (flutter/engine#55353) 2024-09-24 13:25:15 +12:00
Jonah Williams
7e62bd4a14 [iOS] sprinkle some null checks on BringLayersIntoView. (flutter/engine#55334)
A user reported hitting a null check error in this code. Add some null checks.
2024-09-23 18:19:12 +00:00
Callum Moffat
f20fea338e [ios] Update gesture position on every event (flutter/engine#55285)
Previously, gesture origin position relied on hover events. But iOS 18 screen mirroring feature sends only pan/scale gestures, but doesn't hover. So we need to check the gesture location every time.

Fixes https://github.com/flutter/flutter/issues/153897
2024-09-18 23:47:18 +00:00
Reid Baker
0f03db48fe FlutterViewTest add back part 4 and 5 (flutter/engine#55243)
- **Add light and dark test back to FlutterView.java**
- **Migrate some but not all usages of Robolectric.setupActivity in FlutterViewTest.java**
- **Remove suppress warnings on tests that no longer need it, update documentation for ones that still need the suppression**
Fixes https://github.com/flutter/flutter/issues/154746 
Partial work on https://github.com/flutter/flutter/issues/133151
2024-09-17 15:58:59 +00:00
Robert Ancell
3443af6a5c Delay the window until the first frame is received from the Flutter engine (flutter/engine#54703)
Fixes https://github.com/flutter/flutter/issues/151098
2024-09-17 10:48:43 +12:00
Chinmay Garde
f64f4e4188 [Embedder] Warn when embedders try to enable an unsupported renderer. (flutter/engine#55240)
Today, only a generic "internal inconsistency" error returned. But custom builds that selectively disable rendering backends may find this error to be too vague.
2024-09-16 22:29:24 +00:00
Reid Baker
1030f3b153 flutter view add test 2 (flutter/engine#55188)
- **add test back with no other changes**
- **Add legacy test and setup shadow**
2 and 3 of 5 flutter/flutter/issues/154746

Improved legacy testing by validating a fullscreen and non fullscreen codepaths. 

Added `.git-blame-ignore-revs` because git was failing to give blame values with that file missing. I dont think I added a global config anywhere but adding an empty file should not cause a problem.
2024-09-16 20:40:19 +00:00
Robert Ancell
e3f49a5875 Match Windows logic for picking RGB/BGR textures. (flutter/engine#55121)
The existing code had a lot of additional checks that didn't seem to
need to be there.

BGR could be passed back to Flutter, but this was never used in creating
the texture.

There has been a report of a Flutter app on Linux with swapped red and
blue color channels, so this seems like it is likely not working on some
drivers.

The original logic was introduced in
87509d8518cea0e90912cc30b08192b1dd4da760
2024-09-16 12:17:57 +12:00
Brandon DeRosier
07fce2f8f4 [Impeller] desktop: Add missing dispatch for TextFrameDispatcher in embedder view. (flutter/engine#55197) 2024-09-13 22:34:55 -07:00
Jenn Magder
8706638baf Add xcprivacy privacy manifest to macOS framework (flutter/engine#55078)
Create a `PrivacyInfo.xcprivacy` (this name is required) plist and move it to the top-level of the macOS framework bundle.  `NSPrivacyTracking*` and `NSPrivacyCollectedDataTypes` keys are required, but the values are blank.  macOS explicitly does not need the `NSPrivacyAccessedAPITypes` (see more info in https://github.com/flutter/flutter/issues/143381)

You can see on this PR it's copied to the correct path in the framework https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8737163270670636097/+/u/Global_generators/Release-FlutterMacOS.framework/stdout:

```
  adding: FlutterMacOS.xcframework/macos-arm64_x86_64/FlutterMacOS.framework/PrivacyInfo.xcprivacy (deflated 35%)
```

There's no way to test this except to submit a macOS app with this framework to TestFlight.

I can't find a good spot in the engine to validate the structure of the framework output.  I hereby pledge to add a macOS test to the framework post-roll https://github.com/flutter/flutter/pull/155189 ✋ 

iOS framework variant of this PR https://github.com/flutter/engine/pull/48951
Fixes https://github.com/flutter/flutter/issues/131494

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-09-14 02:44:18 +00:00
Gray Mackall
fde6227383 Synthesize remove events on PointerChange.ACTION_UP and PointerChange.ACTION_POINTER_UP (flutter/engine#55157)
... when the input device type is touch.

Fixes (partially) https://github.com/flutter/flutter/issues/154842 for touch events. Does not fix when using a stylus, that case will require a follow up PR.

Without fix:

https://github.com/user-attachments/assets/10a8ac73-7b27-498b-a76e-0f2cfc3050d7

With fix:

https://github.com/user-attachments/assets/18656f3a-d45a-4b08-9227-cc0abe8c73f7

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-09-14 01:02:23 +00:00
Jim Graham
7da9ad1862 Delete VolatilePathTracker in favor of Dispatch tracking (flutter/engine#55125)
ui.Canvas and ui.SceneBuilder now use the DlPath object directly from the ui.Path object. This results in increased sharing of the wrapper objects which then increases the sharing of both the converted Impeller paths and Skia's volatile flag.

The VolatilePathTracker mechanism is deleted and rather than count the number of frames that a path is stable for, instead we count the number of times it is used for rendering. If a path is used 100 times in a single frame, it will become non-volatile and start being cached almost immediately. The cached Impeller paths are now also tracked for all instances of the same path, rather than for each call site that originated from a DisplayList dispatch.
2024-09-13 21:49:09 +00:00
Jonah Williams
9235fbb695 [impeller] add Android flag for disabling surface control for debugging. (flutter/engine#55185)
I've found a few instances where Vulkan worked correctly but surface control did not. lets add a debugging flag we can ask folks to try to narrow down the issue.
2024-09-13 21:39:20 +00:00
Reid Baker
415f89e20a add back test itSendsTextShowPasswordToFrameworkOnAttach with new mock for display metrics (flutter/engine#55110)
Part 1/5 for re adding tests documented in flutter/flutter/issues/154746

## 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.
2024-09-13 13:45:37 -04:00
Reid Baker
f6b728f86f Add copyright notices to java test files (flutter/engine#55155)
Fixes flutter/flutter/issues/155118
2024-09-13 15:31:52 +00:00
Robert Ancell
420b1b5d44 Filter out bad locales returned by g_get_language_names (flutter/engine#55091)
We're seeing issues with and "und" (undefined) locale and exceptions in
applications (see https://github.com/ubuntu/app-center/issues/1659). It
seems the GLib method for getting the language names doesn't clean up
invalid values, so we should do that.
2024-09-13 11:40:52 +12:00
Brandon DeRosier
16acb8258a Remove Impeller Scene 👋 (flutter/engine#55118)
Impeller Scene has been fully rewritten as a Dart library for Flutter: https://pub.dev/packages/flutter_scene
2024-09-12 14:56:08 -07:00
Matan Lurey
ca6c46441e Move zircon_tests from package:litetest to package:async_helper. (flutter/engine#55149)
The engine has historically used `package:litetest`, a home grown invention that is a wrapper around the Dart SDK.

In https://github.com/flutter/flutter/issues/133569, we've moved over to the heavier weight `package:test`, which has been simplified since first evaluated by the Dart SDK vending the dependencies we need. The last user of `package:litetest` is a single test in the Fuchsia SDK, `zircon_tests`.

This PR migrates the test from `litetest` (which will be deleted) to the Dart SK vendored `async_minittest`. For this simple test case, there is only a 1-line behavioral change (`notEquals(foo)` becomes `!= foo, true`), and it allows us to remove dependencies from the tree.
2024-09-12 21:10:52 +00:00
Jonah Williams
82224f9b11 [engine] make UI thread the platform thread for Android. Still allows opt out as g3 escape hatch. (flutter/engine#55111)
Part of  https://github.com/flutter/flutter/issues/150525
2024-09-12 15:21:19 +00:00
bungeman
2289895234 Ensure Vulkan when including Skia Vulkan headers (flutter/engine#55126)
Skia is changing how it handles its internal copy of Vulkan headers to
prevent them from accidentally leaking to users and potentially
overriding the user's Vulkan headers. Users of Skia are responsible for
providing the Vulkan headers when including Skia's public Vk headers.
This change only includes Skia's public Vk headers when Flutter is
providing the Vulkan headers.
2024-09-12 08:55:07 -04:00
Jim Graham
bc69788f05 [DisplayList] DlPath object provides auto-conversion from Skia to Impeller (flutter/engine#55055)
Switch from using the clumsy manual CacheablePath object to a more automatic DlPath object for holding paths in DisplayLists and dispatching them to either Skia or Impeller with auto-conversion.

For now DlPath is just a wrapper around SkPath with an auto-generating Impeller Path object which is very similar in design from what was done with the CacheablePath object except that it manages the caching of the Impeller path internally without extra burden on Impeller or Skia. There is also no need to communicate with the Dispatch method as to which type of path you prefer, they're all "auto-converting" DlPath objects now.

For now, ui.Path still generates an SkPath and so we wrap it when we record it into a DisplayList, just like the former CacheablePath mechanism. It will be a simple conversion to create the DlPath wrapper in ui.Path, though, so as to maintain the cached Impeller paths across frames even if the DisplayList itself is not preserved.

Eventually DlPath will take on more of a role of hiding the construction and internal representation of the paths so that we could be using SkPath, impeller::Path, or some other internal storage. For now, SkPath will likely remain primary storage for a while so that we can deal with PathOps.
2024-09-12 01:20:59 +00:00
Robert Ancell
2a10ec7c44 Fix crash quitting application due to iterating over a changing list. (flutter/engine#55062)
Detected as the FlPlatformHandlerTest.ExitApplicationDispose was
crashing sometimes, valgrind showed invalid memory access.
2024-09-12 09:40:45 +12:00
Robert Ancell
a89c2ae2a4 Use a signal for the pre-engine restart event (flutter/engine#55063)
With multiple FlViews a callback doesn't scale.
2024-09-12 09:25:52 +12:00
Gray Mackall
7a06558bd9 Replace System.loadLibrary with ReLinker.loadLibrary() in FlutterJNI.loadLibrary() (flutter/engine#55095)
Could fix? https://github.com/flutter/flutter/issues/83596

The communication on https://issuetracker.google.com/issues/346717090#comment2 recommends using [ReLinker](https://github.com/KeepSafe/ReLinker) to avoid a bug in how library loading interacts with the [Play delivery feature](https://developer.android.com/guide/playcore/feature-delivery) (used in turn by Flutter's deferred components).

The ReLinker docs also suggest that if you have `minSdk` less than `23`, then you should be using ReLinker regardless, as `System.loadLibrary` is unreliable for other reasons.

I don't have any strong evidence to suggest that either one of these two root causes is the definitive cause of https://github.com/flutter/flutter/issues/83596, but it probably wouldn't hurt 🤷 

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-09-11 21:05:52 +00:00
Reid Baker
930edba64f Add back FlutterViewTest.java (flutter/engine#55048)
Add back FlutterViewTest.java from 8e096b4 (last commit before it was deleted in https://github.com/flutter/engine/pull/44047)

Fixes flutter/flutter/issues/154746
2024-09-11 15:02:56 +00:00
Jonah Williams
849f1d7170 [Impeller] Fix memory leak I introduced by fixing memory leak. (flutter/engine#55087)
If we don't reset host buffer then leak
2024-09-10 22:16:55 +00:00
Jonah Williams
f679a6aa54 [Impeller] fix obvious memory leak. (flutter/engine#55036)
Fixes https://github.com/flutter/flutter/issues/154549

Each overlay surface gets its own content context and each cc gets its own transient buffer. So not reseting the overlay surfaces causes a memory leak. The overlay surfaces would just continue to allocate into the same buffer which would allocate endlessly
2024-09-09 18:18:02 +00:00
Jonah Williams
0a0883219e [engine] dispatch platform channel messages through event loop, except navigation on start. (flutter/engine#55027)
This is a re-land of https://github.com/flutter/engine/pull/55006, except that we special case the navigation channel to immediately dispatch its message if the isolate is not yet running.

This preserves the existing behavior relied upon by several iOS add2app tests, as well as the still used embedder v1 - and potentially undicovered future embedders.
2024-09-08 17:38:18 +00:00
auto-submit[bot]
f84f9c92b5 Reverts "[engine] reland: always post tasks for platform channel responses. (#55006)" (flutter/engine#55022)
Reverts: flutter/engine#55006
Initiated by: jonahwilliams
Reason for reverting: still failling mac module test
Original PR Author: jonahwilliams

Reviewed By: {jason-simmons}

This change reverts the following previous change:
Reland of https://github.com/flutter/engine/pull/54975

Fixes the initial route behavior for iOS. Previously the initial route setting would _always_ be posted as a task, which after merging the threads would fire after isolate creation, thus it would not actually update the initial route setting. Fixed Engine constructor so that it reads the initial route from the settings.
2024-09-07 02:56:46 +00:00
Jonah Williams
8ca7e1cd90 [engine] reland: always post tasks for platform channel responses. (flutter/engine#55006)
Reland of https://github.com/flutter/engine/pull/54975

Fixes the initial route behavior for iOS. Previously the initial route setting would _always_ be posted as a task, which after merging the threads would fire after isolate creation, thus it would not actually update the initial route setting. Fixed Engine constructor so that it reads the initial route from the settings.
2024-09-06 23:48:09 +00:00