本文整理汇总了Java中com.android.ddmlib.IDevice.isEmulator方法的典型用法代码示例。如果您正苦于以下问题:Java IDevice.isEmulator方法的具体用法?Java IDevice.isEmulator怎么用?Java IDevice.isEmulator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.android.ddmlib.IDevice
的用法示例。
在下文中一共展示了IDevice.isEmulator方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getDevice
import com.android.ddmlib.IDevice; //导入方法依赖的package包/类
private IDevice getDevice(String devicePort) {
for (IDevice iDev : adb.getDevices()) {
if (iDev.isEmulator() && iDev.getSerialNumber().contains(devicePort)) {
LoggerHelper.logEvent(MyLevel.RUNTIME, "Successfully connected to emulator: "
+ iDev.getAvdName());
return iDev;
}
}
return null;
}
示例2: renderDeviceName
import com.android.ddmlib.IDevice; //导入方法依赖的package包/类
static void renderDeviceName(@NotNull IDevice d, @NotNull ColoredTextContainer component) {
component.setIcon(d.isEmulator() ? AndroidIcons.Ddms.Emulator2 : AndroidIcons.Ddms.RealDevice);
String name;
if (d.isEmulator()) {
String avdName = d.getAvdName();
if (avdName == null) {
avdName = "unknown";
}
name = String.format(" %1$s %2$s ", "Emulator", avdName);
} else {
name = String.format(" %1$s ", DevicePropertyUtil.getModel(d, ""));
}
component.append(d.getSerialNumber(), SimpleTextAttributes.GRAYED_BOLD_ATTRIBUTES);
component.append(name, SimpleTextAttributes.REGULAR_ATTRIBUTES);
IDevice.DeviceState deviceState = d.getState();
if (deviceState != IDevice.DeviceState.ONLINE) {
String state = String.format("[%1$s] ", d.getState());
component.append(state, SimpleTextAttributes.GRAYED_BOLD_ATTRIBUTES);
}
if (deviceState != IDevice.DeviceState.DISCONNECTED && deviceState != IDevice.DeviceState.OFFLINE) {
component.append(DevicePropertyUtil.getBuild(d), SimpleTextAttributes.GRAY_ATTRIBUTES);
}
}
示例3: setupDevicesTable
import com.android.ddmlib.IDevice; //导入方法依赖的package包/类
private void setupDevicesTable() {
DefaultTableModel tableModel = (DefaultTableModel) devicesTable.getModel();
tableModel.setRowCount(0);
for (IDevice device : devices) {
String name;
String target;
if (device.isEmulator()) {
name = device.getAvdName();
AvdInfo info = avdManager.getAvd(device.getAvdName(), true /*validAvdOnly*/);
target = info == null ? "?" : device.getAvdName();
} else {
name = "N/A";
String deviceBuild = device.getProperty(IDevice.PROP_BUILD_VERSION);
target = deviceBuild == null ? "unknown" : deviceBuild;
}
String state;
if (DeviceState.BOOTLOADER.equals(device.getState())) {
state = "bootloader";
} else if (DeviceState.OFFLINE.equals(device.getState())) {
state = "offline";
} else if (DeviceState.ONLINE.equals(device.getState())) {
state = "online";
} else {
state = "unknown";
}
tableModel.addRow(new Object[]{
// TODO nulls?
device.getSerialNumber(), name, target,
Boolean.valueOf("1".equals(device.getProperty(IDevice.PROP_DEBUGGABLE))),
state
});
}
devicesTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
@Override
public void valueChanged(ListSelectionEvent e) {
DeviceUiChooser.this.updateState();
}
});
}