[flutter_tools] Fix ADB device listing output parsing regression#189369
Merged
Conversation
Fixes a regression introduced in 629df07 where `adb devices -l` output containing non-key-value attributes (e.g. `ABCDEFG device 20-30 product:mokey model:mokey device:mokey transport_id:1`) caused regex lazy-matching to backtrack, incorrectly capturing `ABCDEFG device` into Group 1 (the device ID). This change: * Updates `_kDeviceRegex` in `android_device_discovery.dart` to explicitly match known ADB device states (`device`, `offline`, `unauthorized`, `no permissions`, etc.) and require a column delimiter of at least two spaces or a tab (`(?:\s{2,}|\t+)`). * Adds regression unit test coverage in `android_device_discovery_test.dart`. Related to flutter#189274 ## Tests * Added regression unit test in `android_device_discovery_test.dart` for ADB output containing non-key-value attributes. * Added unit test for wireless serial names containing spaces and state keywords (`my device (2)`).
Contributor
There was a problem hiding this comment.
Code Review
This pull request updates the regular expression used to parse adb devices output in AndroidDevices to prevent false positives by requiring a wider column separator and explicitly listing known ADB device states. It also adds corresponding unit tests to verify parsing behavior with extra attributes and serials containing spaces. The review feedback suggests adding the rescue state to the list of explicit ADB device states to support modern Android/ADB versions.
…y.dart Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
jtmcdole
approved these changes
Jul 13, 2026
5 tasks
auto-submit Bot
pushed a commit
to flutter/packages
that referenced
this pull request
Jul 14, 2026
flutter/flutter@cf9e8af...846664b 2026-07-14 [email protected] Roll Skia from dfcff99566c3 to 88954ef8f36d (1 revision) (flutter/flutter#189440) 2026-07-14 [email protected] refactor: remove material import from scrollable_semantics_test and selectable_region_context_menu_test (flutter/flutter#186611) 2026-07-14 [email protected] Roll Skia from 3d1fc554f1a2 to dfcff99566c3 (17 revisions) (flutter/flutter#189428) 2026-07-14 [email protected] Roll Dart SDK from 2c587df8f05a to 05bf153370c4 (5 revisions) (flutter/flutter#189426) 2026-07-14 [email protected] [flutter_tools] Remove web hot reload flag (flutter/flutter#185994) 2026-07-14 [email protected] [iOS] Fix flaky keyboard animation test (flutter/flutter#189353) 2026-07-14 [email protected] [Impeller] Playground expanded role (flutter/flutter#188889) 2026-07-14 [email protected] Roll pub packages (flutter/flutter#189409) 2026-07-13 [email protected] Update lock-threads dependency to 6.0.2 (flutter/flutter#189053) 2026-07-13 49699333+dependabot[bot]@users.noreply.github.com Bump actions/labeler from 6.1.0 to 6.2.0 in the all-github-actions group (flutter/flutter#189396) 2026-07-13 [email protected] Remove outdated todo about `analysis bug on Windows` and update condition to also perform `analysis on windows` (flutter/flutter#189283) 2026-07-13 [email protected] Add more 0x0 size tests part 4 (flutter/flutter#185187) 2026-07-13 [email protected] Roll Packages from 20928d5 to ad2eab1 (18 revisions) (flutter/flutter#189387) 2026-07-13 [email protected] [flutter_tools] Fix ADB device listing output parsing regression (flutter/flutter#189369) 2026-07-13 [email protected] Stop running most Mac x64 builders that have Mac ARM equivalents on master (flutter/flutter#189301) 2026-07-13 [email protected] Move a few benchmarks from x64 Intel Macs to ARM (flutter/flutter#189377) 2026-07-13 [email protected] Add note that `hcpp` needs impeller (flutter/flutter#189382) 2026-07-13 [email protected] Roll Fuchsia Linux SDK from vhIlDkWIy21IrlB9E... to oOETA0ISPouDt2xBo... (flutter/flutter#189349) 2026-07-13 [email protected] [flutter_tools] Respect mustMatchAppBuild on Windows native assets (flutter/flutter#186788) 2026-07-13 [email protected] Roll Skia from 8bf65996caba to 3d1fc554f1a2 (2 revisions) (flutter/flutter#189350) 2026-07-13 [email protected] Roll Dart SDK from 0fc1668c4af4 to 2c587df8f05a (9 revisions) (flutter/flutter#189351) 2026-07-13 [email protected] [web] Fall back to full CJK fonts for characters not covered by split slices (flutter/flutter#188890) 2026-07-13 [email protected] Take Mac tool_integration_tests_* out of bringup (flutter/flutter#189368) 2026-07-13 [email protected] [hooks] Roll record_use to 1.0 and unpin (flutter/flutter#189366) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC [email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
This was referenced Jul 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes a regression introduced in 629df07 where
adb devices -loutput containing non-key-value attributes (e.g.ABCDEFG device 20-30 product:mokey model:mokey device:mokey transport_id:1) caused regex lazy-matching to backtrack, incorrectly capturingABCDEFG deviceinto Group 1 (the device ID).This change:
_kDeviceRegexinandroid_device_discovery.dartto explicitly match known ADB device states (device,offline,unauthorized,no permissions, etc.) and require a column delimiter of at least two spaces or a tab ((?:\s{2,}|\t+)).android_device_discovery_test.dart.Related to #189274
Tests
android_device_discovery_test.dartfor ADB output containing non-key-value attributes.my device (2)).