Search in sources :

Example 26 with IDevice

use of com.android.ddmlib.IDevice in project android by JetBrains.

the class GpuSampler method sample.

@Override
protected void sample(boolean forced) throws InterruptedException {
    Client client = getClient();
    assert client != null;
    IDevice device = client.getDevice();
    if (device != null) {
        try {
            ClientData data = client.getClientData();
            ThreeState newGpuProfilingState = myCurrentGfxinfoHandler.getIsEnabledOnDevice(device);
            if (newGpuProfilingState != ThreeState.UNSURE) {
                boolean newGpuBooleanState = newGpuProfilingState.toBoolean();
                setGpuProfileSetting(newGpuBooleanState);
            }
            if (myGpuProfileSetting) {
                myCurrentGfxinfoHandler.sample(device, data, getTimelineData());
            }
        } catch (RuntimeException e) {
            throw new InterruptedException("Sample error, interrupting.");
        } catch (Exception ignored) {
        }
    }
}
Also used : ThreeState(com.intellij.util.ThreeState) ClientData(com.android.ddmlib.ClientData) IDevice(com.android.ddmlib.IDevice) Client(com.android.ddmlib.Client)

Example 27 with IDevice

use of com.android.ddmlib.IDevice in project android by JetBrains.

the class DeviceRendererTest method deviceNameRendering2.

@Test
public void deviceNameRendering2() throws Exception {
    String serial = "123";
    IDevice d = createDevice(true, "Avdname", "google", "nexus 4", "4.2", "17", serial, IDevice.DeviceState.BOOTLOADER);
    SimpleColoredText target = new SimpleColoredText();
    DeviceRenderer.renderDeviceName(d, target);
    String name = target.toString();
    assertFalse(StringUtil.containsIgnoreCase(name, "Nexus 4"));
    assertTrue(StringUtil.containsIgnoreCase(name, "Avdname"));
    assertTrue(StringUtil.containsIgnoreCase(name, IDevice.DeviceState.BOOTLOADER.toString()));
    assertTrue(StringUtil.containsIgnoreCase(name, serial));
}
Also used : SimpleColoredText(com.intellij.ui.SimpleColoredText) IDevice(com.android.ddmlib.IDevice) Test(org.junit.Test)

Example 28 with IDevice

use of com.android.ddmlib.IDevice in project android by JetBrains.

the class DeviceRendererTest method deviceNameRendering1.

@Test
public void deviceNameRendering1() throws Exception {
    String serial = "123";
    IDevice d = createDevice(false, null, "google", "nexus 4", "4.2", "17", serial, IDevice.DeviceState.ONLINE);
    SimpleColoredText target = new SimpleColoredText();
    DeviceRenderer.renderDeviceName(d, target);
    String name = target.toString();
    assertEquals("Google Nexus 4 Android 4.2, API 17", name);
    // status should be shown only if !online
    assertFalse(StringUtil.containsIgnoreCase(name, IDevice.DeviceState.ONLINE.toString()));
    // serial should be shown only if !online
    assertFalse(StringUtil.containsIgnoreCase(name, serial));
}
Also used : SimpleColoredText(com.intellij.ui.SimpleColoredText) IDevice(com.android.ddmlib.IDevice) Test(org.junit.Test)

Example 29 with IDevice

use of com.android.ddmlib.IDevice in project android by JetBrains.

the class AndroidLogcatReceiverTest method createMockDevice.

/**
   * Helper method that creates a mock device.
   */
static IDevice createMockDevice() {
    IDevice d = EasyMock.createMock(IDevice.class);
    EasyMock.expect(d.getClientName(1493)).andStubReturn("dummy.client.name");
    EasyMock.expect(d.getClientName(11698)).andStubReturn("com.android.chattylogger");
    EasyMock.expect(d.getClientName(EasyMock.anyInt())).andStubReturn("?");
    EasyMock.replay(d);
    return d;
}
Also used : IDevice(com.android.ddmlib.IDevice)

Example 30 with IDevice

use of com.android.ddmlib.IDevice in project android by JetBrains.

the class DevicePanel method initializeDeviceCombo.

private void initializeDeviceCombo() {
    AccessibleContextUtil.setName(myDeviceCombo, "Devices");
    myDeviceCombo.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent actionEvent) {
            if (myIgnoreActionEvents)
                return;
            updateClientCombo();
            Object sel = myDeviceCombo.getSelectedItem();
            IDevice device = (sel instanceof IDevice) ? (IDevice) sel : null;
            myDeviceContext.fireDeviceSelected(device);
        }
    });
    myDeviceCombo.setRenderer(new DeviceRenderer.DeviceComboBoxRenderer("No Connected Devices"));
    Dimension size = myDeviceCombo.getMinimumSize();
    myDeviceCombo.setMinimumSize(new Dimension(200, size.height));
}
Also used : ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent) IDevice(com.android.ddmlib.IDevice)

Aggregations

IDevice (com.android.ddmlib.IDevice)76 Test (org.junit.Test)17 AndroidDebugBridge (com.android.ddmlib.AndroidDebugBridge)11 AdbOptions (com.facebook.buck.step.AdbOptions)11 TargetDeviceOptions (com.facebook.buck.step.TargetDeviceOptions)11 NotNull (org.jetbrains.annotations.NotNull)10 Client (com.android.ddmlib.Client)6 File (java.io.File)6 AndroidVersion (com.android.sdklib.AndroidVersion)5 SuppressForbidden (com.facebook.buck.annotations.SuppressForbidden)5 TIntArrayList (gnu.trove.TIntArrayList)5 Nullable (org.jetbrains.annotations.Nullable)5 InstallException (com.android.ddmlib.InstallException)4 AvdInfo (com.android.sdklib.internal.avd.AvdInfo)4 ExecutionException (java.util.concurrent.ExecutionException)4 AdbCommandRejectedException (com.android.ddmlib.AdbCommandRejectedException)3 ShellCommandUnresponsiveException (com.android.ddmlib.ShellCommandUnresponsiveException)3 TimeoutException (com.android.ddmlib.TimeoutException)3 BuckEventBus (com.facebook.buck.event.BuckEventBus)3 TestConsole (com.facebook.buck.testutil.TestConsole)3