File tree Expand file tree Collapse file tree
Framework/install_handler/android Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -691,9 +691,28 @@ async def get_available_devices() -> list[dict]:
691691 # Parse device details from output
692692 devices = _parse_device_list (result .stdout )
693693
694+ # Filter out devices that already have AVDs created
695+ existing_avds = await get_available_avds ()
696+ existing_avd_names = {avd ["name" ] for avd in existing_avds }
697+
698+ filtered_devices = []
699+ for device in devices :
700+ device_name = device .get ("version" , "" ) # version field contains device name
701+ if device_name :
702+ # Sanitize device name to match how AVD names are created
703+ sanitized_name = _sanitize_avd_name (device_name )
704+ # Check if an AVD with this name already exists
705+ if sanitized_name not in existing_avd_names :
706+ filtered_devices .append (device )
707+ elif debug :
708+ print (f"[installer][emulator] Filtering out device '{ device_name } ' (AVD '{ sanitized_name } ' already exists)" )
709+ else :
710+ # If no device name, include it (shouldn't happen, but safe fallback)
711+ filtered_devices .append (device )
712+
694713 if debug :
695- print (f"[installer][emulator] Found { len (devices )} available devices" )
696- return devices
714+ print (f"[installer][emulator] Found { len (devices )} available devices, { len ( filtered_devices ) } not yet installed " )
715+ return filtered_devices
697716
698717 except subprocess .TimeoutExpired :
699718 if debug :
You can’t perform that action at this time.
0 commit comments