Repository navigation
[beta] [flutter_tools] Fix ADB device listing output parsing regression - #189446
auto-submit[bot] merged 1 commit into
Conversation
…tter#189369) 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)`). --------- Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
|
This pull request was opened from and to a release candidate branch. This should only be done as part of the official Flutter release process. If you are attempting to make a regular contribution to the Flutter project, please close this PR and follow the instructions at Tree Hygiene for detailed instructions on contributing to Flutter. Reviewers: Use caution before merging pull requests to release branches. Ensure the proper procedure has been followed. |
There was a problem hiding this comment.
Code Review
This pull request updates the ADB device parsing regular expression in android_device_discovery.dart to explicitly match known device states and require a stronger column separator, and adds unit tests to verify parsing with extra attributes and spaces in serials. The review feedback notes that the new regex fails to match devices in the no permissions state when followed by a semicolon suffix (common on Linux without udev rules), and suggests adjusting the regex to support semicolon separators and adding a test case for this scenario.
c7edcb6
into
flutter:flutter-3.47-candidate.0
This pull request is created by automatic cherry pick workflow
Issue Link:
#189274
Impact Description:
Fixes a regression in
flutter_toolswhereadb devices -loutput containing non-key-value attributes (e.g.ABCDEFG device 20-30 product:mokey ...) causes regex backtracking, incorrectly capturingABCDEFG deviceinto the device ID. This breaks device discovery and prevents running apps on affected Android devices/bots in devicelab.Changelog Description:
[flutter_tools] When parsing ADB device output containing non-key-value attributes on Android, flutter tool misparses the device ID.
Workaround:
None.
Risk:
Test Coverage:
Validation Steps:
Run
flutter test test/general.shard/android/android_device_discovery_test.dartto verify device regex output parsing.