MCPcopy Index your code
hub / github.com/callstack/agent-device / listStoppedAndroidAvdDevices

Function listStoppedAndroidAvdDevices

src/platforms/android/devices.ts:324–341  ·  view source on GitHub ↗
(runningDevices: DeviceInfo[])

Source from the content-addressed store, hash-verified

322}
323
324async 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
343function inferAndroidAvdTarget(avdName: string): 'mobile' | 'tv' {
344 return /\b(tv|television)\b/i.test(normalizeAndroidName(avdName)) ? 'tv' : 'mobile';

Callers 1

listAndroidDevicesFunction · 0.85

Calls 3

listAndroidAvdNamesFunction · 0.85
normalizeAndroidNameFunction · 0.85
inferAndroidAvdTargetFunction · 0.85

Tested by

no test coverage detected