<!-- start_original_pr_link -->
Reverts: flutter/flutter#179647
<!-- end_original_pr_link -->
<!-- start_initiating_author -->
Initiated by: gmackall
<!-- end_initiating_author -->
<!-- start_revert_reason -->
Reason for reverting: Mac_mokey run_release_test failing
<!-- end_revert_reason -->
<!-- start_original_pr_author -->
Original PR Author: gmackall
<!-- end_original_pr_author -->
<!-- start_reviewers -->
Reviewed By: {reidbaker, jtmcdole}
<!-- end_reviewers -->
<!-- start_revert_body -->
This change reverts the following previous change:
Changes our cipd hosted android sdk+ndk bundle to no longer modify
directory structure from what Android directly provides, allowing AGP to
find the ndk automatically and preventing downloading.
1. Changes the `create_cipd_packages.sh` script so we don't move the ndk
2. Uses the new script to upload a
[36v4unmodified](https://chrome-infra-packages.appspot.com/p/flutter/android/sdk/all/linux-amd64/+/version:36v4unmodified)
bundle
3. Changes DEPS+ci.yaml to reference the new bundle
4. Changes GN build rules accordingly
5. Removes special config in existing build.gradle files to point at the
location of the ndk - agp should now know where it is without conig
6. For some tests, passes in an environment variable pointing to the ndk
location, to override the environment variable passed by the recipes.
This variable is respected by the tool, so the recipes passing it,
pointing to the wrong place, is problematic. After this change lands we
can stop passing it in the recipes, and then we can remove this special
config in the tests. But adding it temporarily allows us to make this
change without coordinating a recipes change at the same moment, and
probably breaking things out of band.
Logs from a random postsubmit run of `Mac
build_android_host_app_with_module_aar` on the tree currently:
https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8695664517253382913/+/u/run_build_android_host_app_with_module_aar/stdout
We see
> [2025-12-12 10:49:49.223087] [STDOUT] stdout: Checking the license for
package NDK (Side by side) 28.2.13676358 in
/Volumes/Work/s/w/ir/cache/android/sdk/licenses
[2025-12-12 10:49:49.223221] [STDOUT] stdout: License for package NDK
(Side by side) 28.2.13676358 accepted.
[2025-12-12 10:49:49.223268] [STDOUT] stdout: Preparing "Install NDK
(Side by side) 28.2.13676358 v.28.2.13676358".
[2025-12-12 10:50:14.093824] [STDOUT] stdout: "Install NDK (Side by
side) 28.2.13676358 v.28.2.13676358" ready.
[2025-12-12 10:50:14.093909] [STDOUT] stdout: Installing NDK (Side by
side) 28.2.13676358 in
/Volumes/Work/s/w/ir/cache/android/sdk/ndk/28.2.13676358
[2025-12-12 10:50:14.093947] [STDOUT] stdout: "Install NDK (Side by
side) 28.2.13676358 v.28.2.13676358" complete.
[2025-12-12 10:50:14.410724] [STDOUT] stdout: "Install NDK (Side by
side) 28.2.13676358 v.28.2.13676358" finished.
Example of no longer downloading:
Logs from a presubmit run:
https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8695732180931529361/+/u/run_build_android_host_app_with_module_aar/stdout
We don't see these logs. We still see android build tools downloading -
we can probably tackle that in another pr.
## 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], including [Features
we expect every widget to implement].
- [ ] I signed the [CLA].
- [ ] I listed at least one issue that this PR fixes in the description
above.
- [ ] I updated/added relevant documentation (doc comments with `///`).
- [ ] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [ ] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [ ] All existing and new tests are passing.
If you need help, consider asking for advice on the #hackers-new channel
on [Discord].
**Note**: The Flutter team is currently trialing the use of [Gemini Code
Assist for
GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code).
Comments from the `gemini-code-assist` bot should not be taken as
authoritative feedback from the Flutter team. If you find its comments
useful you can update your code accordingly, but if you are unsure or
disagree with the feedback, please feel free to wait for a Flutter team
member's review for guidance on which automated comments should be
addressed.
<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
<!-- end_revert_body -->
Co-authored-by: auto-submit[bot] <flutter-engprod-team@google.com>
Changes our cipd hosted android sdk+ndk bundle to no longer modify
directory structure from what Android directly provides, allowing AGP to
find the ndk automatically and preventing downloading.
1. Changes the `create_cipd_packages.sh` script so we don't move the ndk
2. Uses the new script to upload a
[36v4unmodified](https://chrome-infra-packages.appspot.com/p/flutter/android/sdk/all/linux-amd64/+/version:36v4unmodified)
bundle
3. Changes DEPS+ci.yaml to reference the new bundle
4. Changes GN build rules accordingly
5. Removes special config in existing build.gradle files to point at the
location of the ndk - agp should now know where it is without conig
6. For some tests, passes in an environment variable pointing to the ndk
location, to override the environment variable passed by the recipes.
This variable is respected by the tool, so the recipes passing it,
pointing to the wrong place, is problematic. After this change lands we
can stop passing it in the recipes, and then we can remove this special
config in the tests. But adding it temporarily allows us to make this
change without coordinating a recipes change at the same moment, and
probably breaking things out of band.
Logs from a random postsubmit run of `Mac
build_android_host_app_with_module_aar` on the tree currently:
https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8695664517253382913/+/u/run_build_android_host_app_with_module_aar/stdout
We see
> [2025-12-12 10:49:49.223087] [STDOUT] stdout: Checking the license for
package NDK (Side by side) 28.2.13676358 in
/Volumes/Work/s/w/ir/cache/android/sdk/licenses
[2025-12-12 10:49:49.223221] [STDOUT] stdout: License for package NDK
(Side by side) 28.2.13676358 accepted.
[2025-12-12 10:49:49.223268] [STDOUT] stdout: Preparing "Install NDK
(Side by side) 28.2.13676358 v.28.2.13676358".
[2025-12-12 10:50:14.093824] [STDOUT] stdout: "Install NDK (Side by
side) 28.2.13676358 v.28.2.13676358" ready.
[2025-12-12 10:50:14.093909] [STDOUT] stdout: Installing NDK (Side by
side) 28.2.13676358 in
/Volumes/Work/s/w/ir/cache/android/sdk/ndk/28.2.13676358
[2025-12-12 10:50:14.093947] [STDOUT] stdout: "Install NDK (Side by
side) 28.2.13676358 v.28.2.13676358" complete.
[2025-12-12 10:50:14.410724] [STDOUT] stdout: "Install NDK (Side by
side) 28.2.13676358 v.28.2.13676358" finished.
Example of no longer downloading:
Logs from a presubmit run:
https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8695732180931529361/+/u/run_build_android_host_app_with_module_aar/stdout
We don't see these logs. We still see android build tools downloading -
we can probably tackle that in another pr.
## 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], including [Features
we expect every widget to implement].
- [ ] I signed the [CLA].
- [ ] I listed at least one issue that this PR fixes in the description
above.
- [ ] I updated/added relevant documentation (doc comments with `///`).
- [ ] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [ ] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [ ] All existing and new tests are passing.
If you need help, consider asking for advice on the #hackers-new channel
on [Discord].
**Note**: The Flutter team is currently trialing the use of [Gemini Code
Assist for
GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code).
Comments from the `gemini-code-assist` bot should not be taken as
authoritative feedback from the Flutter team. If you find its comments
useful you can update your code accordingly, but if you are unsure or
disagree with the feedback, please feel free to wait for a Flutter team
member's review for guidance on which automated comments should be
addressed.
<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
---------
Co-authored-by: DoLT <dolt@guide.inc>
Co-authored-by: Gray Mackall <mackall@google.com>
Co-authored-by: John "codefu" McDole <john@mcdole.org>
Also switches to using a regex group to match the device state instead
of splitting the matched string on '='.
Fixes https://github.com/flutter/flutter/issues/174952
---------
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Sometimes there can be multiple wakefulness log entries (e.g.,
'mWakefulness=Awake' and 'mWakefulness=1'), but we only care about the
entry with a string value.
---------
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
It's possible for Chrome to open with two tabs pointing to localhost,
which was causing this test to fail. This change updates the Chrome
connection logic to look for the specific URL Chrome was told to
navigate to at launch, if one was provided.
- **bump template version, update migration code to handle api 21-23 and
expand it to cover multiple min api level definitions**
- **bump add to app project to minimum api level 24**
- **PathUtilsTest converted to using config, removed test code that
branched on versions older than 24**
- **Update additional build.gradle files to have minsdk 24 and
documenation**
Related to #170807
G3 cls
- espresso https://critique.corp.google.com/cl/776592881
- integration tests cl/778034198
- removal of pre api 23 samples tests cl/777652802
## 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], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.
---------
Co-authored-by: Gray Mackall <34871572+gmackall@users.noreply.github.com>
Notable changes:
* Allows macrobenchmarks to run via `flutter run`.
* Splits macrobenchmarking between "orchestration logic" and "app
serving" (served on separate ports on the same machine to keep the
scheme consistent with the `flutter build` path).
* Adds an intercepted entrypoint for web benchmarks. We can't pass flags
to the app since it's not supported, so I've hard-coded the
orchestration server's port.
* Adding logic to connect to an existing Chrome debugger instance (vs
spawning one) for benchmarks.
<!-- start_original_pr_link -->
Reverts: flutter/flutter#165749
<!-- end_original_pr_link -->
<!-- start_initiating_author -->
Initiated by: matanlurey
<!-- end_initiating_author -->
<!-- start_revert_reason -->
Reason for reverting: Still passing command-line arguments from recipes
that have no effect but cause the runner to crash.
<!-- end_revert_reason -->
<!-- start_original_pr_author -->
Original PR Author: matanlurey
<!-- end_original_pr_author -->
<!-- start_reviewers -->
Reviewed By: {jtmcdole}
<!-- end_reviewers -->
<!-- start_revert_body -->
This change reverts the following previous change:
Partial re-land of https://github.com/flutter/flutter/pull/165628:
- Fixes the mistake that the `Cocoon` class did things that well, were
not specific to Cocoon.
- Renamed to `MetricsResultWriter`, as that is all it does now.
---
Closes https://github.com/flutter/flutter/issues/165618.
The `devicelab/bin/test_runner.dart upload-metrics` command use to have
_two_ responsibilities:
- Well, upload test **metrics** (benchmarks) to Skia Perf (it still does
that)
- Upload test **status** to Cocoon (it did until
https://github.com/flutter/flutter/pull/165614)
As https://github.com/flutter/flutter/pull/165614 proved, this API
predated the current LUCI setup, where Cocoon itself receives task
status updates from LUCI, and it turns out this entire time, DeviceLab
was making (at best) NOP calls, and at worst, causing crashes and
corrupt data (https://github.com/flutter/flutter/issues/165610).
<!-- end_revert_body -->
Co-authored-by: auto-submit[bot] <flutter-engprod-team@google.com>
<!-- start_original_pr_link -->
Reverts: flutter/flutter#165628
<!-- end_original_pr_link -->
<!-- start_initiating_author -->
Initiated by: jtmcdole
<!-- end_initiating_author -->
<!-- start_revert_reason -->
Reason for reverting: breaking tree:
https://ci.chromium.org/ui/p/flutter/builders/prod/Linux_mokey%20backdrop_filter_perf__e2e_summary/3833/overview
<!-- end_revert_reason -->
<!-- start_original_pr_author -->
Original PR Author: matanlurey
<!-- end_original_pr_author -->
<!-- start_reviewers -->
Reviewed By: {jtmcdole, yjbanov}
<!-- end_reviewers -->
<!-- start_revert_body -->
This change reverts the following previous change:
🚫 **Do not merge** until
https://flutter-review.googlesource.com/c/recipes/+/64220/1 is merged.
---
Closes https://github.com/flutter/flutter/issues/165618.
The `devicelab/bin/test_runner.dart upload-metrics` command use to have
_two_ responsibilities:
- Well, upload test **metrics** (benchmarks) to Skia Perf (it still does
that)
- Upload test **status** to Cocoon (it did until
https://github.com/flutter/flutter/pull/165614)
As https://github.com/flutter/flutter/pull/165614 proved, this API
predated the current LUCI setup, where Cocoon itself receives task
status updates from LUCI, and it turns out this entire time, DeviceLab
was making (at best) NOP calls, and at worst, causing crashes and
corrupt data (https://github.com/flutter/flutter/issues/165610).
In other words, this is removing entirely dead/unused code (though the
recipes have to be updated first).
/cc @jason-simmons as I need Jason's help reviewing the recipes change
and want to provide context.
<!-- end_revert_body -->
Co-authored-by: auto-submit[bot] <flutter-engprod-team@google.com>
This auto-formats all *.dart files in the repository outside of the
`engine` subdirectory and enforces that these files stay formatted with
a presubmit check.
**Reviewers:** Please carefully review all the commits except for the
one titled "formatted". The "formatted" commit was auto-generated by
running `dev/tools/format.sh -a -f`. The other commits were hand-crafted
to prepare the repo for the formatting change. I recommend reviewing the
commits one-by-one via the "Commits" tab and avoiding Github's "Files
changed" tab as it will likely slow down your browser because of the
size of this PR.
---------
Co-authored-by: Kate Lovett <katelovett@google.com>
Co-authored-by: LongCatIsLooong <31859944+LongCatIsLooong@users.noreply.github.com>
Fix the `--ab` option in the benchmark harness:
- Make `--local-engine-host` optional. The web engine doesn't need it, so it doesn't build it. But the tool crashes by failing to find it.
- Disable icon tree shaking because `--ab` runs against local engine build, whose Dart kernel version is out of sync with the framework, which crashes the const finder.
Reverts: flutter/flutter#154061
Initiated by: QuncCccccc
Reason for reverting: might be the reason that cause Framework tree to red
Original PR Author: bartekpacia
Reviewed By: {gmackall, reidbaker}
This change reverts the following previous change:
This PR resolves#151166
This pull request aims to improve code readability, based on feedback gathered in a recent design doc.
<br>
There are two factors that hugely impact how easy it is to understand a piece of code: **verbosity** and **complexity**.
Reducing **verbosity** is important, because boilerplate makes a project more difficult to navigate. It also has a tendency to make one's eyes gloss over, and subtle typos/bugs become more likely to slip through.
Reducing **complexity** makes the code more accessible to more people. This is especially important for open-source projects like Flutter, where the code is read by those who make contributions, as well as others who read through source code as they debug their own projects.
<hr>
<br>
The following examples show how pattern-matching might affect these two factors:
<details> <summary><h3>Example 1 (GOOD)</h3> [click to expand]</summary>
```dart
if (ancestor case InheritedElement(:final InheritedTheme widget)) {
themes.add(widget);
}
```
Without using patterns, this might expand to
```dart
if (ancestor is InheritedElement) {
final InheritedWidget widget = ancestor.widget;
if (widget is InheritedTheme) {
themes.add(widget);
}
}
```
Had `ancestor` been a non-local variable, it would need to be "converted" as well:
```dart
final Element ancestor = this.ancestor;
if (ancestor is InheritedElement) {
final InheritedWidget inheritedWidget = ancestor.widget;
if (widget is InheritedTheme) {
themes.add(theme);
}
}
```
</details>
<details> <summary><h3>Example 2 (BAD) </h3> [click to expand]</summary>
```dart
if (widget case PreferredSizeWidget(preferredSize: Size(:final double height))) {
return height;
}
```
Assuming `widget` is a non-local variable, this would expand to:
```dart
final Widget widget = this.widget;
if (widget is PreferredSizeWidget) {
return widget.preferredSize.height;
}
```
<br>
</details>
In both of the examples above, an `if-case` statement simultaneously verifies that an object meets the specified criteria and performs a variable assignment accordingly.
But there are some differences: Example 2 uses a more deeply-nested pattern than Example 1 but makes fewer useful checks.
**Example 1:**
- checks that `ancestor` is an `InheritedElement`
- checks that the inherited element's `widget` is an `InheritedTheme`
**Example 2:**
- checks that `widget` is a `PreferredSizeWidget`
(every `PreferredSizeWidget` has a `size` field, and every `Size` has a `height` field)
<br>
<hr>
I feel hesitant to try presenting a set of cut-and-dry rules as to which scenarios should/shouldn't use pattern-matching, since there are an abundance of different types of patterns, and an abundance of different places where they might be used.
But hopefully the conversations we've had recently will help us converge toward a common intuition of how pattern-matching can best be utilized for improved readability.
<br><br>
- resolves https://github.com/flutter/flutter/issues/152313
- Design Doc: [flutter.dev/go/dart-patterns](https://flutter.dev/go/dart-patterns)
Prior to this fix, `_TaskRunner.run` would immediately cleanup the
keep-alive port once the task completed, which would result in the
isolate shutting down as soon as the task result was returned from
`ext.cocoonRunTask` callback in the form of a
`ServiceExtensionResponse`. Since the service extension response is
processed by the service isolate, it was possible for the VM to start
shutting down before the service isolate could send the task result data
back to the task runner.
This change introduces a new service extension,
`ext.cocoonTaskResultReceived`, that the task runner invokes after it
receives the task result from `ext.cocoonRunTask`, notifying the task
process that it can close the keep-alive port and shutdown.
Fixes https://github.com/flutter/flutter/issues/155475
Reverts: flutter/flutter#152487
Initiated by: gmackall
Reason for reverting: I forgot that I need to override the compileSdkVersion in the AGP 8.0 [instance of this test](ef9cd32f5a/dev/devicelab/bin/tasks/android_java17_dependency_smoke_tests.dart (L19))
Original PR Author: gmackall
Reviewed By: {reidbaker}
This change reverts the following previous change:
Updates `compileSdk`, `targetSdk`, and `ndk` versions (former 2 to latest, latter to the version of the ndk we are hosting on CIPD).
Summary of changes:
- Updates mentioned template values
- `compileSdk` 35 requires AGP 8.0+, so updated to 8.1 in many places.
- This also necessitated Gradle upgrades in most places
- This also necessitated moving the `package` xml attribute to the AGP `namespace` field in a couple places (test + template).
- Some tests use the output of `flutter create` but then use intentionally lower AGP versions. [I downgraded the `compileSdk` in these tests.](fee34fd61a)
- [Stopped lockfile generation](82324a2570) script from hitting the `hello_world` example because it uses `.kts` gradle files.
- One test needed [some Gradle options we had already added to templates](6aa187b4b6).
Updates `compileSdk`, `targetSdk`, and `ndk` versions (former 2 to latest, latter to the version of the ndk we are hosting on CIPD).
Summary of changes:
- Updates mentioned template values
- `compileSdk` 35 requires AGP 8.0+, so updated to 8.1 in many places.
- This also necessitated Gradle upgrades in most places
- This also necessitated moving the `package` xml attribute to the AGP `namespace` field in a couple places (test + template).
- Some tests use the output of `flutter create` but then use intentionally lower AGP versions. [I downgraded the `compileSdk` in these tests.](fee34fd61a)
- [Stopped lockfile generation](82324a2570) script from hitting the `hello_world` example because it uses `.kts` gradle files.
- One test needed [some Gradle options we had already added to templates](6aa187b4b6).