本文整理汇总了Java中com.android.ddmlib.IDevice.getProperty方法的典型用法代码示例。如果您正苦于以下问题:Java IDevice.getProperty方法的具体用法?Java IDevice.getProperty怎么用?Java IDevice.getProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.android.ddmlib.IDevice
的用法示例。
在下文中一共展示了IDevice.getProperty方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: add
import com.android.ddmlib.IDevice; //导入方法依赖的package包/类
/**
* Add a new device to the data model, or replace any existing.
*/
private void add(IDevice device) {
String serial = device.getSerialNumber();
do {
// for emulators use their virtual device name as label
String deviceAvdName = device.getAvdName();
if (deviceAvdName != null) {
deviceLabels.put(serial, deviceAvdName + " [" + serial + "]");
break;
}
// for real devices use their model name (something like '<vendor> <device>')
String deviceModelName = device.getProperty("ro.product.model");
if (deviceModelName != null) {
deviceLabels.put(serial, deviceModelName + " [" + serial + "]");
break;
}
} while (false);
// finally, add the serial.
add(serial);
}
示例2: supportsUiAutomator
import com.android.ddmlib.IDevice; //导入方法依赖的package包/类
private static boolean supportsUiAutomator(IDevice device) {
String apiLevelString = device.getProperty(IDevice.PROP_BUILD_API_LEVEL);
int apiLevel;
try {
apiLevel = Integer.parseInt(apiLevelString);
} catch (NumberFormatException e) {
apiLevel = UIAUTOMATOR_MIN_API_LEVEL;
}
return apiLevel >= UIAUTOMATOR_MIN_API_LEVEL;
}
示例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();
}
});
}