Java Code Examples for com.android.ddmlib.IDevice#DeviceState

The following examples show how to use com.android.ddmlib.IDevice#DeviceState . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LogSourcePanel.java    From logviewer with Apache License 2.0 5 votes vote down vote up
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);
    }

}
 
Example 2
Source File: MobileDeviceNode.java    From NBANDROID-V2 with Apache License 2.0 4 votes vote down vote up
private void updateDescription() {
    final String serNum = this.device.getSerialNumber();
    final IDevice.DeviceState state = this.device.getMasterDevice().getState();
    this.setShortDescription(NbBundle.getMessage(MobileDeviceNode.class, "HINT_Device",
            serNum, state != null ? state.toString() : "(unknown state)"));
}
 
Example 3
Source File: EmulatorDeviceNode.java    From NBANDROID-V2 with Apache License 2.0 4 votes vote down vote up
private void updateDescription() {
    final String serNum = this.device.getSerialNumber();
    final IDevice.DeviceState state = this.device.getState();
    this.setShortDescription(NbBundle.getMessage(EmulatorDeviceNode.class, "HINT_Device",
            serNum, state != null ? state.toString() : "(unknown state)"));
}
 
Example 4
Source File: MyDeviceChooser.java    From ADB-Duang with MIT License 4 votes vote down vote up
@NotNull
private static String getDeviceState(@NotNull IDevice device) {
  IDevice.DeviceState state = device.getState();
  return state != null ? capitalize(state.name().toLowerCase()) : "";
}
 
Example 5
Source File: MyDeviceChooser.java    From ADBWIFI with Apache License 2.0 4 votes vote down vote up
@NotNull
private static String getDeviceState(@NotNull IDevice device) {
  IDevice.DeviceState state = device.getState();
  return state != null ? capitalize(state.name().toLowerCase()) : "";
}
 
Example 6
Source File: TestDevice.java    From buck with Apache License 2.0 4 votes vote down vote up
public void setState(IDevice.DeviceState state) {
  this.state = state;
}
 
Example 7
Source File: TestDevice.java    From buck with Apache License 2.0 4 votes vote down vote up
@Override
public IDevice.DeviceState getState() {
  return state;
}
 
Example 8
Source File: AdbHelperTest.java    From buck with Apache License 2.0 4 votes vote down vote up
private TestDevice createRealDevice(String serial, IDevice.DeviceState state) {
  TestDevice device = TestDevice.createRealDevice(serial);
  device.setState(state);
  return device;
}
 
Example 9
Source File: AdbHelperTest.java    From buck with Apache License 2.0 4 votes vote down vote up
private TestDevice createEmulator(String serial, IDevice.DeviceState state) {
  TestDevice device = TestDevice.createEmulator(serial);
  device.setState(state);
  return device;
}
 
Example 10
Source File: DeviceConnector.java    From javaide with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Returns the {@link com.android.ddmlib.IDevice.DeviceState} for the device, or null
 * if if cannot determined.
 * @return the device state.
 */
public abstract IDevice.DeviceState getState();