Add AvdManagerRunner.ListDeviceProfilesAsync() for device profile enumeration#325
Open
Add AvdManagerRunner.ListDeviceProfilesAsync() for device profile enumeration#325
Conversation
…meration Add ListDeviceProfilesAsync() and ParseDeviceListOutput() to AvdManagerRunner. Runs 'avdmanager list device' and parses the output into AvdDeviceProfile records (Id, Name, Oem, Tag). Includes AvdDeviceProfile record model, 6 unit tests, and PublicAPI entries for both net10.0 and netstandard2.0. Closes #321 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds first-class support in Xamarin.Android.Tools.AndroidSdk for enumerating AVD device profiles (hardware definitions) by running avdmanager list device, returning strongly-typed results for consumers (IDE extensions, GUI tools, CLIs).
Changes:
- Introduced
AvdDeviceProfilerecord model (Id,Name,Oem,Tag). - Added
AvdManagerRunner.ListDeviceProfilesAsync()plusParseDeviceListOutput()to parseavdmanager list deviceoutput. - Added unit tests for parsing behavior across multiple profiles, empty/header-only output, missing name fallback, and Windows newlines; updated PublicAPI unshipped entries for both TFMs.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/Xamarin.Android.Tools.AndroidSdk-Tests/AvdManagerRunnerTests.cs | Adds parsing-focused unit tests for device profile enumeration. |
| src/Xamarin.Android.Tools.AndroidSdk/Runners/AvdManagerRunner.cs | Implements the new API to run avdmanager list device and parse results. |
| src/Xamarin.Android.Tools.AndroidSdk/PublicAPI/netstandard2.0/PublicAPI.Unshipped.txt | Declares the new public API surface for netstandard2.0. |
| src/Xamarin.Android.Tools.AndroidSdk/PublicAPI/net10.0/PublicAPI.Unshipped.txt | Declares the new public API surface for net10.0. |
| src/Xamarin.Android.Tools.AndroidSdk/Models/AvdDeviceProfile.cs | Adds the new public model type representing a device profile. |
jonathanpeppers
requested changes
Apr 13, 2026
| { | ||
| using var stdout = new StringWriter (); | ||
| using var stderr = new StringWriter (); | ||
| var psi = ProcessUtils.CreateProcessStartInfo (avdManagerPath, "list", "device"); |
Member
There was a problem hiding this comment.
The output from this command is horrendous:
> & 'C:\Program Files (x86)\Android\android-sdk\cmdline-tools\latest\bin\avdmanager.bat' list device
Available devices definitions:
id: 0 or "automotive_1024p_landscape"
Name: Automotive (1024p landscape)
OEM : Google
Tag : android-automotive-playstore
---------
id: 1 or "automotive_1080p_landscape"
Name: Automotive (1080p landscape)
OEM : Google
Tag : android-automotive
---------
If you read the --help output, they have a --compact option "suitable for scripts":
> & 'C:\Program Files (x86)\Android\android-sdk\cmdline-tools\latest\bin\avdmanager.bat' list device --help
Error: Flag '--help' is not valid for 'list device'.
Usage:
avdmanager [global options] list device [action options]
Global options:
-s --silent : Silent mode, shows errors only.
-v --verbose : Verbose mode, shows errors, warnings and all messages.
--clear-cache: Clear the SDK Manager repository manifest cache.
-h --help : Help on a specific command.
Action "list device":
Lists existing devices.
Options:
-0 --null : Terminates lines with \0 instead of \n (e.g. for xargs -0)
Only used by --compact.
-c --compact : Compact output (suitable for scripts)
So, we should parse this output instead:
> & 'C:\Program Files (x86)\Android\android-sdk\cmdline-tools\latest\bin\avdmanager.bat' list device --compact
automotive_1024p_landscape
automotive_1080p_landscape
automotive_1408p_landscape_with_google_apis
automotive_1408p_landscape_with_play
automotive_distant_display
automotive_distant_display_with_play
automotive_large_portrait
automotive_portrait
automotive_ultrawide
Galaxy Nexus
desktop_large
desktop_medium
medium_phone
medium_tablet
Nexus 10
Nexus 4
Nexus 5
Nexus 5X
Nexus 6
Nexus 6P
Nexus 7 2013
Nexus 7
Nexus 9
Nexus One
Nexus S
pixel
pixel_2
pixel_2_xl
pixel_3
pixel_3_xl
pixel_3a
pixel_3a_xl
pixel_4
pixel_4_xl
pixel_4a
pixel_5
pixel_6
pixel_6_pro
pixel_6a
pixel_7
pixel_7_pro
pixel_7a
pixel_8
pixel_8_pro
pixel_8a
pixel_9
pixel_9_pro
pixel_9_pro_fold
pixel_9_pro_xl
pixel_c
pixel_fold
pixel_tablet
pixel_xl
resizable
desktop_small
small_phone
tv_1080p
tv_4k
tv_720p
wearos_large_round
wearos_rect
wearos_small_round
wearos_square
2.7in QVGA
2.7in QVGA slider
3.2in HVGA slider (ADP1)
3.2in QVGA (ADP2)
3.3in WQVGA
3.4in WQVGA
3.7 FWVGA slider
3.7in WVGA (Nexus One)
4in WVGA (Nexus S)
4.65in 720p (Galaxy Nexus)
4.7in WXGA
5.1in WVGA
5.4in FWVGA
6.7in Foldable
7in WSVGA (Tablet)
7.4in Rollable
7.6in Foldable
8in Foldable
10.1in WXGA (Tablet)
13.5in Freeform
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.
Summary
Add a method to enumerate available AVD device profiles (hardware definitions) from \�vdmanager list device.
Changes
et10.0\ and
etstandard2.0\
Closes #321