Skip to content

Improve selection of device/emulator for debugging #2966

@rosen-vladimirov

Description

@rosen-vladimirov

Tell us about the problem

Currently CLI automatically selects which device/emulator to be used for debugging in case there's more than one device/emulator running. Instead of automatic selection, we should ask the user what they want to do.

Here's the idea:
In case the terminal is interactive and there are more than one devices/emulators running, prompt the user to select device for debugging.
In case the terminal is interactive and --emulator is passed, the prompter should contain only currently running emulators. In case there's no running emulators, CLI will start one and it will be used for debugging.
In case terminal is interactive and --for-device is passed, the prompter should contain only currently attached devices (no emulators/simulators). In case there's no attached devices, CLI will fail.

In case the terminal is not interactive and there are more than one devices/emulators, CLI will use the emulator with highest API version, i.e. in case you have three Android emulators with version 5.1, 6.0 and 7.0, the one with 7.0 will be used for debugging. In case there are no emulators running, but multiple devices are attached, CLI will use the device with highest API Level.

In case the terminal is not interactive and there are more than one emulators and --emulator flag is passed, CLI will use the emulator with highest API Level. In case there's no running emulator, CLI will start one and use it for debugging.
In case the terminal is not interactive and there are more than one devices attached and --for-device flag is passed, CLI will use the device with highest API Level. In case there's no device attached for specified platform, CLI will fail.

NOTE: In all scenarios only Trusted devices for specified platform are counted, i.e. in case you have Android device attached, that is not trusted and another Android device, that's ready for debugging, only the second one will be considered. The first one is not taken into action.

Which platform(s) does your issue occur on?

Both

Please provide the following version numbers that your issue occurs with:

  • CLI: 3.x.x

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions