use of com.android.ddmlib.AndroidDebugBridge in project android by JetBrains.
the class DeviceSelectionUtils method getAllCompatibleDevices.
@NotNull
public static List<IDevice> getAllCompatibleDevices(Predicate<IDevice> deviceFilter) {
final List<IDevice> compatibleDevices = new ArrayList<IDevice>();
final AndroidDebugBridge bridge = AndroidDebugBridge.getBridge();
if (bridge != null) {
IDevice[] devices = bridge.getDevices();
for (IDevice device : devices) {
if (deviceFilter.apply(device)) {
compatibleDevices.add(device);
}
}
}
return compatibleDevices;
}
use of com.android.ddmlib.AndroidDebugBridge in project android by JetBrains.
the class DeviceChooser method getFilteredDevices.
@NotNull
private IDevice[] getFilteredDevices() {
AndroidDebugBridge bridge = AndroidDebugBridge.getBridge();
if (bridge == null || !bridge.isConnected()) {
return EMPTY_DEVICE_ARRAY;
}
final List<IDevice> filteredDevices = new ArrayList<IDevice>();
for (IDevice device : bridge.getDevices()) {
if (myFilter == null || myFilter.apply(device)) {
filteredDevices.add(device);
}
}
return filteredDevices.toArray(new IDevice[filteredDevices.size()]);
}
use of com.android.ddmlib.AndroidDebugBridge in project android by JetBrains.
the class AndroidUploadDatabaseAction method actionPerformed.
@Override
public void actionPerformed(AnActionEvent e) {
final Project project = e.getProject();
assert project != null;
final List<AndroidDataSource> dataSources = getSelectedAndroidDataSources(e);
final AndroidDebugBridge debugBridge = AndroidSdkUtils.getDebugBridge(project);
if (debugBridge == null) {
Messages.showErrorDialog(project, AndroidBundle.message("cannot.connect.to.adb.error"), CommonBundle.getErrorTitle());
return;
}
ProgressManager.getInstance().run(new Task.Backgroundable(project, AndroidBundle.message("android.db.uploading.progress.title"), true) {
@Override
public void run(@NotNull ProgressIndicator indicator) {
for (final AndroidDataSource dataSource : dataSources) {
indicator.setText("Uploading " + dataSource.getName());
synchronized (AndroidDbUtil.DB_SYNC_LOCK) {
uploadDatabase(project, dataSource, indicator, debugBridge);
}
indicator.checkCanceled();
}
}
});
}
Aggregations