-
Notifications
You must be signed in to change notification settings - Fork 31
Add AdbRunner for adb CLI operations #283
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
rmarinho
wants to merge
9
commits into
main
Choose a base branch
from
feature/adb-runner
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,335
−12
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
9f316f4
Add AdbRunner for adb CLI operations
rmarinho 71fff34
Address review: exit code check, internal visibility, doc fix
rmarinho 01ed6b9
Add IEnumerable<string> overload for ParseAdbDevicesOutput
rmarinho 9d4b4f5
Add optional logger callback to BuildDeviceDescription and MergeDevic…
rmarinho f8fbca3
Fix nullable reference type warnings for dotnet/android compatibility
rmarinho dbf54f9
Fix regex to use explicit adb states and support tab separators
rmarinho 9368682
Log exception in GetEmulatorAvdNameAsync bare catch block
rmarinho 82de0a1
Add emulator console fallback for AVD name resolution
rmarinho 8e4be7a
Simplify AdbRunner constructor: require full adb path
rmarinho File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
62 changes: 62 additions & 0 deletions
62
src/Xamarin.Android.Tools.AndroidSdk/Models/AdbDeviceInfo.cs
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
|
|
||
| namespace Xamarin.Android.Tools; | ||
|
|
||
| /// <summary> | ||
| /// Represents an Android device or emulator from 'adb devices -l' output. | ||
| /// Mirrors the metadata produced by dotnet/android's GetAvailableAndroidDevices task. | ||
| /// </summary> | ||
| public class AdbDeviceInfo | ||
| { | ||
| /// <summary> | ||
| /// Serial number of the device (e.g., "emulator-5554", "0A041FDD400327"). | ||
| /// For non-running emulators, this is the AVD name. | ||
| /// </summary> | ||
| public string Serial { get; set; } = string.Empty; | ||
|
|
||
| /// <summary> | ||
| /// Human-friendly description of the device (e.g., "Pixel 7 API 35", "Pixel 6 Pro"). | ||
| /// </summary> | ||
| public string Description { get; set; } = string.Empty; | ||
|
|
||
| /// <summary> | ||
| /// Device type: Device or Emulator. | ||
| /// </summary> | ||
| public AdbDeviceType Type { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Device status: Online, Offline, Unauthorized, NoPermissions, NotRunning, Unknown. | ||
| /// </summary> | ||
| public AdbDeviceStatus Status { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// AVD name for emulators (e.g., "pixel_7_api_35"). Null for physical devices. | ||
| /// </summary> | ||
| public string? AvdName { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Device model from adb properties (e.g., "Pixel_6_Pro"). | ||
| /// </summary> | ||
| public string? Model { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Product name from adb properties (e.g., "raven"). | ||
| /// </summary> | ||
| public string? Product { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Device code name from adb properties (e.g., "raven"). | ||
| /// </summary> | ||
| public string? Device { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Transport ID from adb properties. | ||
| /// </summary> | ||
| public string? TransportId { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Whether this device is an emulator. | ||
| /// </summary> | ||
| public bool IsEmulator => Type == AdbDeviceType.Emulator; | ||
| } |
17 changes: 17 additions & 0 deletions
17
src/Xamarin.Android.Tools.AndroidSdk/Models/AdbDeviceStatus.cs
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
|
|
||
| namespace Xamarin.Android.Tools; | ||
|
|
||
| /// <summary> | ||
| /// Represents the status of an Android device. | ||
| /// </summary> | ||
| public enum AdbDeviceStatus | ||
| { | ||
| Online, | ||
| Offline, | ||
| Unauthorized, | ||
| NoPermissions, | ||
| NotRunning, | ||
| Unknown | ||
| } |
13 changes: 13 additions & 0 deletions
13
src/Xamarin.Android.Tools.AndroidSdk/Models/AdbDeviceType.cs
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
|
|
||
| namespace Xamarin.Android.Tools; | ||
|
|
||
| /// <summary> | ||
| /// Represents the type of an Android device. | ||
| /// </summary> | ||
| public enum AdbDeviceType | ||
| { | ||
| Device, | ||
| Emulator | ||
| } |
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.