Search in sources :

Example 21 with AndroidDebugBridge

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;
}
Also used : ArrayList(java.util.ArrayList) IDevice(com.android.ddmlib.IDevice) AndroidDebugBridge(com.android.ddmlib.AndroidDebugBridge) NotNull(org.jetbrains.annotations.NotNull)

Example 22 with AndroidDebugBridge

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()]);
}
Also used : TIntArrayList(gnu.trove.TIntArrayList) IDevice(com.android.ddmlib.IDevice) AndroidDebugBridge(com.android.ddmlib.AndroidDebugBridge) NotNull(org.jetbrains.annotations.NotNull)

Example 23 with AndroidDebugBridge

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();
            }
        }
    });
}
Also used : Project(com.intellij.openapi.project.Project) Task(com.intellij.openapi.progress.Task) ProgressIndicator(com.intellij.openapi.progress.ProgressIndicator) AndroidDebugBridge(com.android.ddmlib.AndroidDebugBridge)

Aggregations

AndroidDebugBridge (com.android.ddmlib.AndroidDebugBridge)23 IDevice (com.android.ddmlib.IDevice)11 NotNull (org.jetbrains.annotations.NotNull)4 File (java.io.File)3 Client (com.android.ddmlib.Client)2 Project (com.intellij.openapi.project.Project)2 JBLoadingPanel (com.intellij.ui.components.JBLoadingPanel)2 TIntArrayList (gnu.trove.TIntArrayList)2 ArrayList (java.util.ArrayList)2 Nullable (org.jetbrains.annotations.Nullable)2 AvdInfo (com.android.sdklib.internal.avd.AvdInfo)1 IdDisplay (com.android.sdklib.repository.IdDisplay)1 DeviceContext (com.android.tools.idea.ddms.DeviceContext)1 DevicePanel (com.android.tools.idea.ddms.DevicePanel)1 OpenVmTraceHandler (com.android.tools.idea.ddms.OpenVmTraceHandler)1 AndroidLogcatView (com.android.tools.idea.logcat.AndroidLogcatView)1 SuppressForbidden (com.facebook.buck.annotations.SuppressForbidden)1 OSProcessHandler (com.intellij.execution.process.OSProcessHandler)1 ConsoleView (com.intellij.execution.ui.ConsoleView)1 RunnerLayoutUi (com.intellij.execution.ui.RunnerLayoutUi)1