5551 Commits

Author SHA1 Message Date
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
Matan Lurey
f9adfbc62c Make runtime/... and shell/common/... compatible with .clang-tidy. (flutter/engine#48158) 2023-11-20 14:31:49 -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
Matan Lurey
933bd94016 Make flow/... compatible with .clang_tidy. (flutter/engine#47995)
Work towards https://github.com/flutter/flutter/issues/134969.

All changes were made automatically (i.e. with `--fix`).
2023-11-16 08:41:10 -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
hellohuanlin
058ffbe73f [ios]fix ios 16 auto correction highlight showing on top left corner (flutter/engine#47279)
This PR hides the system highlights in iOS 16 (except when scribble is enabled). 

Note that auto correction highlight is still drawn by flutter, so it still works. 

I don't think we need to CP this, since it's iOS 16 only, and iOS 17 is already out. 

## Why not use system highlight? 

Unlike iOS 17, the iOS 16 system highlight only respect the width provided by `firstRectForRange`, but not the height. I have audited all sizing related APIs in UITextInput (doc [here](https://developer.apple.com/documentation/uikit/uitextinput#1653155)), specifically, `firstRect(for:)`, `caretRect(for:)` and `selectionRects(for:)`, and they all return the correct height. 

## About scribble
The initial implementation of `firstRectForRange` (that returns the first selection rect) was introduced for the scribble feature on iPad (code [here](1d3165a31c (diff-4c7b102c0690b8ec5e2212b079f5d69fe3f816c84e47ce94bc7bc89312f39e40R1487-R1505))). 

It turns out that a non-zero rect is required for scribble's advanced feature to work (e.g. inserting a space with a vertical bar). So we can't apply this fix for scribble. 

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

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

*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-15 19:37:22 +00:00
Greg Spencer
28d807f326 Update keycode output (flutter/engine#47988)
## Description

This updates the keycode definitions to match what the keycode generator produces, to keep them in sync.
2023-11-15 17:29:34 +00:00
Chris Bracken
ce85176a4e [macOS] Clean up allocations in key responder tests (flutter/engine#48048)
Runs all FlutterChannelKeyResponderTest tests in an AutoReleasepoolTest, which ensures all allocations are cleaned up.

Also replaces the use of OCMock in FlutterChannelKeyResponderTest with a fake FlutterBasicMessageChannel subclass. 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-15 02:19:12 +00:00
Chris Bracken
50979ef389 [macOS] Eliminate unused OCMock includes (flutter/engine#48031)
As part of the broader quest to reduce our dependence on OCMock in macOS
embedder tests, this removes #includes of OCMock into files where OCMock
is not actually used.

## Pre-launch Checklist

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

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

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#overview
[Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene
[test-exempt]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo
[C++, Objective-C, Java style guides]:
https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
[testing the engine]:
https://github.com/flutter/flutter/wiki/Testing-the-engine
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes
[Discord]: https://github.com/flutter/flutter/wiki/Chat
2023-11-14 12:12:53 -08:00
hellohuanlin
28fc24fd05 [ios17][text_input]fix ios 17.0 keyboard freeze when switching languages (without relying on text affinity) (flutter/engine#47566)
After close examination of the UIKit's default string tokenizer, when querying the line enclosing the end of doc position **in forward direction**, we should return nil (regardless whether the position is forward or backward affinity). 

This aligns with the [API doc](https://developer.apple.com/documentation/uikit/uitextinputtokenizer/1614464-rangeenclosingposition?language=objc): 

> If the text position is at a text-unit boundary, it is considered enclosed only if the next position in the given direction is entirely enclosed.

Will cherry pick this soon. Otherwise it will be less and less important as users upgrade to iOS 17.1. 

### Why my previous workaround also works? 

It turns out my previous workaround PR https://github.com/flutter/engine/pull/46591 works only because our misuse of text affinity in our text input. Specifically, when adding text affinity support, we only added it to `FlutterTextPosition`, but not `FlutterTextRange`. So when getting the beginning/end position from the range, we assign arbitrary affinities. 

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

https://github.com/flutter/engine/pull/46591

*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-14 19:58:06 +00:00
John McCutchan
4a2f6eacfa Revert "Add an AndroidManifest.xml flag to disable ImageReader backend Platform Views (#46430)" (flutter/engine#48024)
This reverts commit af107ceba5d188019df780e0be192dd7092ea35a. It is no
longer needed as we have resolved the flickering issue in the
ImageReader backend.
2023-11-14 10:26:39 -08:00
Zachary Anderson
ef11fee4ed Move Skia to //flutter/third_party/skia (flutter/engine#47913)
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.

To land this PR, we'll need to:
1. Stop the Skia -> Engine autoroller
1. Update the license goldens in this PR.
1. Update
https://skia.googlesource.com/skia-autoroll-internal-config/+/refs/heads/main/skia-infra-public/skia-flutter.cfg#55
1. Land this PR.
1. Re-start the Skia -> Engine autoroller
2023-11-13 20:04:35 -08:00
auto-submit[bot]
e5da8d9a87 Reverts "Bump minSdk to 19 for Android tests" (flutter/engine#47935)
Reverts flutter/engine#47686
Initiated by: zanderso
This change reverts the following previous change:
Original Description:
The latest Robolectric version, 4.11.x, removed the support for SDKs < 19 by following AndroidX strategy. Also following https://github.com/flutter/buildroot/pull/750, and removing obsolete SDK checking in code to pass android_lint checking after bumping minSdk to 19 for testing target.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-11-10 23:06:18 +00:00
utzcoz
1e558fcece Bump minSdk to 19 for Android tests (flutter/engine#47686)
The latest Robolectric version, 4.11.x, removed the support for SDKs < 19 by following AndroidX strategy. Also following https://github.com/flutter/buildroot/pull/750, and removing obsolete SDK checking in code to pass android_lint checking after bumping minSdk to 19 for testing target.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-11-10 21:35:57 +00:00
Camille Simon
809cc6c652 [Android] Bump robolectric version to support unit testing on Android 34 (flutter/engine#47768)
Bumps robolectric version from 4.10.3 --> 4.11 to support unit testing on Android 34!

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-11-10 16:54:16 +00:00
gaaclarke
002ab77448 Expanded the performance lints (flutter/engine#47868)
fixes https://github.com/flutter/flutter/issues/137372

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-11-09 23:54:01 +00:00
Michael Goderbauer
ba990078f8 Reland "Remove physical geometry" (flutter/engine#47872)
Relands #47825 with a doc fix (see second commit).
2023-11-09 19:39:20 +00:00
Gray Mackall
1dc6423dac [Re-land] Upgrade Android SDK to 34 "UpsideDownCake" (flutter/engine#47839)
The difference between this PR and the original is the change to the `AndroidManifest.xml`. For context, right before the original PR landed, [a change to upgrade the target sdk](https://github.com/flutter/engine/pull/47683) in the manifest from 31 to 33 landed. It also removed the lint complaining about using an old target sdk version from the baseline lint file. So this change upgrading the sdk, but not the target sdk in the manifest, triggered the lint again.

For the rest of the PR, [see the description of the original PR](https://github.com/flutter/engine/pull/47609).

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-11-09 18:02:18 +00:00
auto-submit[bot]
aa4fb605c3 Reverts "Remove physical geometry" (flutter/engine#47862)
Reverts flutter/engine#47825
Initiated by: zanderso
This change reverts the following previous change:
Original Description:
Looks like this was proactively added in https://github.com/flutter/engine/pull/20496, but never wired up to anything on any platform. It is also unused in framework and customer code; we never exposed this on e.g. MediaQuery.

Related framework PR: https://github.com/flutter/flutter/pull/138103 (Checks will fail until that PR is submitted).
2023-11-09 16:06:19 +00:00
Michael Goderbauer
c273bd8d71 Remove physical geometry (flutter/engine#47825)
Looks like this was proactively added in https://github.com/flutter/engine/pull/20496, but never wired up to anything on any platform. It is also unused in framework and customer code; we never exposed this on e.g. MediaQuery.

Related framework PR: https://github.com/flutter/flutter/pull/138103 (Checks will fail until that PR is submitted).
2023-11-09 02:18:24 +00:00
Loïc Sharma
9aee1bdaff [Windows] Remove global state in keyboard tests (flutter/engine#47829)
Currently the keyboard tests use global state to track key calls. As a result, a good test can fail if a bad test leaves key calls in the global state. This removes the global state and ensures each test is isolated.

Preparation for 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-09 00:10:05 +00:00
Greg Spencer
68166947cc Move window state update to window realize callback (flutter/engine#47713)
## Description

This moves the state update to only happen on realizing the window instead of at initialization time, based on [the comment from](https://github.com/flutter/flutter/issues/137262#issuecomment-1792020246) @robert-ancell .

## Related Issues
 - https://github.com/flutter/flutter/issues/137262

## Tests
 - I tried to add tests, but it doesn't seem possible to create a view without an actual display connected (and making a mock of it defeats the purpose of the test). I'm happy to be proven wrong, though.
2023-11-08 23:56:01 +00:00
auto-submit[bot]
f5605fa8aa Reverts "Upgrade Android SDK to 34 "UpsideDownCake"" (flutter/engine#47834)
Reverts flutter/engine#47609
Initiated by: zanderso
This change reverts the following previous change:
Original Description:
~**This should not land until https://github.com/flutter/buildroot/pull/790 (re)lands, and I swap the buildroot url back to the latest commit.**~ ~Reland of PR to update buildroot at https://github.com/flutter/buildroot/pull/792. ~ <- landed, and changed the buildroot commit to the latest in DEPS

Upgrades to android api 34

Also:
1. Upgrades to java 17 in DEPS/ci, because the linter now requires it.
2. Stops running some roboelectric tests on android apis 16-18, because Roboelectric indicated those versions were unsupported and we don't support them either.
3. Applies the four trivial new suggestions from the newer linter.
4. Updates the baseline lint to include the new non-trivial lint ([fixed in a different PR](https://github.com/flutter/engine/pull/47817/files)).
5. Changes some instances where we were hardcoding android apis as numbers (e.g. `sdk = 16') to use version codes (see the [comment below](https://github.com/flutter/engine/pull/47609#issuecomment-1800308658)).

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-11-08 22:57:25 +00:00
Gray Mackall
542d29dedd Upgrade Android SDK to 34 "UpsideDownCake" (flutter/engine#47609)
~**This should not land until https://github.com/flutter/buildroot/pull/790 (re)lands, and I swap the buildroot url back to the latest commit.**~ ~Reland of PR to update buildroot at https://github.com/flutter/buildroot/pull/792. ~ <- landed, and changed the buildroot commit to the latest in DEPS

Upgrades to android api 34

Also:
1. Upgrades to java 17 in DEPS/ci, because the linter now requires it.
2. Stops running some roboelectric tests on android apis 16-18, because Roboelectric indicated those versions were unsupported and we don't support them either.
3. Applies the four trivial new suggestions from the newer linter.
4. Updates the baseline lint to include the new non-trivial lint ([fixed in a different PR](https://github.com/flutter/engine/pull/47817/files)).
5. Changes some instances where we were hardcoding android apis as numbers (e.g. `sdk = 16') to use version codes (see the [comment below](https://github.com/flutter/engine/pull/47609#issuecomment-1800308658)).

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-11-08 22:15:17 +00:00
Chris Bracken
c5b1d11b65 [macOS] Allocate textures as unique_ptr earlier (flutter/engine#47786)
This cleans up several places where instead of allocating a
std::unique_ptr immediately, we were making allocations with the new
operator, then later wrapping in a unique_ptr. The previous code was
correct but there was no reason not to allocate a unique_ptr
immediately.

This code makes no semantic changes; just applies a stylistic
improvement that makes the code very slightly safer.


## Pre-launch Checklist

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

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

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#overview
[Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene
[test-exempt]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo
[C++, Objective-C, Java style guides]:
https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
[testing the engine]:
https://github.com/flutter/flutter/wiki/Testing-the-engine
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes
[Discord]: https://github.com/flutter/flutter/wiki/Chat
2023-11-08 13:50:42 -08:00
utzcoz
3382ab50ac Use targetSdkVersion 33 for Android platform AndroidManifest.xml (flutter/engine#47683)
buildroot has switched to use 33 as default target sdk version.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-11-08 17:15:16 +00:00
Jonah Williams
5dd5cd253a [Impeller] null check drawable. (flutter/engine#47488)
Speculative fix for the first crash noted in https://github.com/flutter/flutter/issues/136628#issue-1944779964

nextDrawble can return null if the method times out.

Fixes https://github.com/flutter/flutter/issues/136525
2023-11-08 16:35:03 +00:00
Chris Bracken
c947cfce7e [macOS] Clean up resources in ViewController tests (flutter/engine#47792)
Wraps all FlutterViewController tests in an autorelease pool to ensure
resources are cleaned up.

Adds a MockFlutterEngineTest subclass of AutoreleasePoolTest that
creates an OCPartialMock FlutterEngine and shuts it down at the end of
the test. Previously we were not shutting down any FlutterEngine
instances we allocated, resulting in potentially thousands of threads
and graphics contexts being allocated.

Prior to this change, running these tests via:

    ../out/host_debug_unopt_arm64/flutter_desktop_darwin_unittests \
        --gtest_filter='FlutterViewController.*' --gtest_repeat=1000

resulted in test failures and sometimes segfaults. This ensures
resources are cleaned up

Eventually all unit tests should configure their FlutterEngine via
either FlutterEngineTest (which should be an AutoreleasePoolTest) or
MockFlutterEngineTest, and the CreateMockFlutterEngine function moved to
a static used in the implementation of these.

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

## 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-07 23:50:31 -08:00
Jia Hao
2156a17b9a Fix narrowing conversion lint (flutter/engine#47740)
Internally we have a lint that surfaces this as a warning. Googlers, please refer to go/al-rule/NarrowingConversion.

Related: b/309552840

When we do:
```
coords.toolMajor = (float) (double) coordsList.get(3) * density;
```

`coordsList.get(3)` is casted to a `double`, then a `float`, before the multiplication happens. 

I don't think this is intentional. The intention of the code here seems to be:

- Cast to a `double`: `coordsList` is a `List<Object>` so the cast narrows the value
- Cast to a `float`: To fit the resulting value into [`coords.toolMajor`](https://developer.android.com/reference/android/view/MotionEvent.PointerCoords#toolMajor), which is a `float`.

As such, add parenthesis to address this.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-11-08 01:41:25 +00:00
Chris Bracken
7a923cd1d9 [macOS] Bail out of tests if engine not running (flutter/engine#47771)
In engine tests where we require a running engine to proceed with the
test, immediately fail if the engine isn't running rather than carrying
on with the test. In most cases, the fixture test proceeds to block the
main thread on a latch until it's released from the UI thread, so this
results in quicker test failures.

## Pre-launch Checklist

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

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

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#overview
[Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene
[test-exempt]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo
[C++, Objective-C, Java style guides]:
https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
[testing the engine]:
https://github.com/flutter/flutter/wiki/Testing-the-engine
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes
[Discord]: https://github.com/flutter/flutter/wiki/Chat
2023-11-07 17:27:14 -08:00
Chris Bracken
229331bcff [testing] Extract StreamCapture test utility (flutter/engine#47774)
Factors out an RAII-based class that can be used to capture std::cout, std::cerr, or technically any other std::ostream, though that's unlikely to be useful.

This makes the logic reusable but more importantly, ensures the capture is cleaned up at the end of the test.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-11-08 01:18:16 +00:00
Loïc Sharma
9b3d3b0231 [Windows] Reduce warnings produced by unit tests (flutter/engine#47724)
This PR contains no functional changes but improves existing unit tests to reduce the number of warnings output when the tests are ran:

1. Replaced `ON_CALL` with `EXPECT_CALL` for expected method calls
2. Added some missing mocks

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-11-07 21:13:33 +00:00
Chris Yang
5c12a78db9 [ios] making objective-C smart pointers support ARC (flutter/engine#47612)
Moving the implementation from https://codereview.chromium.org/1855483004 into the code base, including:

- scoped_nsobject, scoped_nsprotocol, scoped_block will support both mrc and arc
- Added parent class scoped_typeref for shared code between scoped_block and scoped_nsobject
- moving OwnershipPolicy to its own file

The implementation of the smart pointers are almost identical to https://codereview.chromium.org/1855483004 besides some syntax preference differences between chromium and flutter.

This PR also migrated [VsyncWaiterIosTest.mm](https://github.com/flutter/engine/pull/47612/files#diff-c98ce1a2aca65c29bbc444523b66921a53ecce5ff39a420b4eda7dbfe8ca1cc7) to ARC with scoped_nsobject

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

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2023-11-07 19:25:45 +00:00
Zachary Anderson
e24e3b5746 Don't use Skia BUILD.gn files (flutter/engine#47677)
The new `BUILD.gn` files in the Engine tree can't go under
`build/secondary` because Skia still has its own, and they'd be selected
first. So, this PR puts the new `BUILD.gn` files under `flutter/skia`.
2023-11-07 11:12:29 -08:00