[CB-4268] Rework util functions to support getting list of connected devices / emulators

This will be used by the run script to determine if a connected device or emulator is available.
[CB-4268] Add support for --device and --emulator to run script