|
| 1 | +// Licensed to the .NET Foundation under one or more agreements. |
| 2 | +// The .NET Foundation licenses this file to you under the MIT license. |
| 3 | + |
| 4 | +namespace Xamarin.Android.Tools; |
| 5 | + |
| 6 | +/// <summary> |
| 7 | +/// Represents an Android device or emulator from 'adb devices -l' output. |
| 8 | +/// Mirrors the metadata produced by dotnet/android's GetAvailableAndroidDevices task. |
| 9 | +/// </summary> |
| 10 | +public class AdbDeviceInfo |
| 11 | +{ |
| 12 | + /// <summary> |
| 13 | + /// Serial number of the device (e.g., "emulator-5554", "0A041FDD400327"). |
| 14 | + /// For non-running emulators, this is the AVD name. |
| 15 | + /// </summary> |
| 16 | + public string Serial { get; set; } = string.Empty; |
| 17 | + |
| 18 | + /// <summary> |
| 19 | + /// Human-friendly description of the device (e.g., "Pixel 7 API 35", "Pixel 6 Pro"). |
| 20 | + /// </summary> |
| 21 | + public string Description { get; set; } = string.Empty; |
| 22 | + |
| 23 | + /// <summary> |
| 24 | + /// Device type: Device or Emulator. |
| 25 | + /// </summary> |
| 26 | + public AdbDeviceType Type { get; set; } |
| 27 | + |
| 28 | + /// <summary> |
| 29 | + /// Device status: Online, Offline, Unauthorized, NoPermissions, NotRunning, Unknown. |
| 30 | + /// </summary> |
| 31 | + public AdbDeviceStatus Status { get; set; } |
| 32 | + |
| 33 | + /// <summary> |
| 34 | + /// AVD name for emulators (e.g., "pixel_7_api_35"). Null for physical devices. |
| 35 | + /// </summary> |
| 36 | + public string? AvdName { get; set; } |
| 37 | + |
| 38 | + /// <summary> |
| 39 | + /// Device model from adb properties (e.g., "Pixel_6_Pro"). |
| 40 | + /// </summary> |
| 41 | + public string? Model { get; set; } |
| 42 | + |
| 43 | + /// <summary> |
| 44 | + /// Product name from adb properties (e.g., "raven"). |
| 45 | + /// </summary> |
| 46 | + public string? Product { get; set; } |
| 47 | + |
| 48 | + /// <summary> |
| 49 | + /// Device code name from adb properties (e.g., "raven"). |
| 50 | + /// </summary> |
| 51 | + public string? Device { get; set; } |
| 52 | + |
| 53 | + /// <summary> |
| 54 | + /// Transport ID from adb properties. |
| 55 | + /// </summary> |
| 56 | + public string? TransportId { get; set; } |
| 57 | + |
| 58 | + /// <summary> |
| 59 | + /// Whether this device is an emulator. |
| 60 | + /// </summary> |
| 61 | + public bool IsEmulator => Type == AdbDeviceType.Emulator; |
| 62 | +} |
0 commit comments