(runningDevices: DeviceInfo[])
| 322 | } |
| 323 | |
| 324 | async function listStoppedAndroidAvdDevices(runningDevices: DeviceInfo[]): Promise<DeviceInfo[]> { |
| 325 | const avdNames = await listAndroidAvdNames().catch(() => []); |
| 326 | const runningEmulatorNames = new Set( |
| 327 | runningDevices |
| 328 | .filter((device) => device.kind === 'emulator') |
| 329 | .map((device) => normalizeAndroidName(device.name)), |
| 330 | ); |
| 331 | return avdNames |
| 332 | .filter((avdName) => !runningEmulatorNames.has(normalizeAndroidName(avdName))) |
| 333 | .map((avdName) => ({ |
| 334 | platform: 'android', |
| 335 | id: avdName, |
| 336 | name: avdName, |
| 337 | kind: 'emulator', |
| 338 | target: inferAndroidAvdTarget(avdName), |
| 339 | booted: false, |
| 340 | })); |
| 341 | } |
| 342 | |
| 343 | function inferAndroidAvdTarget(avdName: string): 'mobile' | 'tv' { |
| 344 | return /\b(tv|television)\b/i.test(normalizeAndroidName(avdName)) ? 'tv' : 'mobile'; |
no test coverage detected