[CB-4268] Rework util functions to support getting list of connected targets

This will be used by the run script to determine if a connected device or emulator is available.

CC @jeffheifetz @lorinbeer