Search in sources :

Example 1 with DeviceManager

use of com.android.sdklib.devices.DeviceManager in project android by JetBrains.

the class ConfigurationManager method getDevices.

/** Returns the list of available devices for the current platform, if any */
@NotNull
public List<Device> getDevices() {
    if (myDevices == null || myDevices.isEmpty()) {
        List<Device> devices = null;
        AndroidPlatform platform = AndroidPlatform.getInstance(myModule);
        if (platform != null) {
            final AndroidSdkData sdkData = platform.getSdkData();
            devices = new ArrayList<Device>();
            DeviceManager deviceManager = sdkData.getDeviceManager();
            devices.addAll(deviceManager.getDevices(EnumSet.of(DeviceManager.DeviceFilter.DEFAULT, DeviceManager.DeviceFilter.VENDOR)));
            devices.addAll(myUserDeviceManager.parseUserDevices(new MessageBuildingSdkLog()));
        }
        if (devices == null) {
            myDevices = Collections.emptyList();
        } else {
            myDevices = devices;
        }
    }
    return myDevices;
}
Also used : Device(com.android.sdklib.devices.Device) UserDeviceManager(org.jetbrains.android.uipreview.UserDeviceManager) DeviceManager(com.android.sdklib.devices.DeviceManager) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

Device (com.android.sdklib.devices.Device)1 DeviceManager (com.android.sdklib.devices.DeviceManager)1 UserDeviceManager (org.jetbrains.android.uipreview.UserDeviceManager)1 NotNull (org.jetbrains.annotations.NotNull)1