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) {
}
}
}
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));
}
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));
}
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;
}
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));
}
Aggregations