/** * @return the descriptive name with online/offline/unknown status string appended. */ public static String getDescriptiveNameWithStatus( IDevice device ) { String status; if ( device.isOnline() ) { status = "Online"; } else { if ( device.isOffline() ) { status = "Offline"; } else { status = "Unknown"; } } return getDescriptiveName( device ) + " " + status; } }
devOnline = ( myEmulator != null ) && ( myEmulator.isOnline() ); if ( devOnline )
/** * Returns if the device is ready. * * @return <code>true</code> if {@link #getState()} returns {@link DeviceState#ONLINE}. */ @Override public boolean isOnline() { return device.isOnline(); }
@Override public boolean isOnline() { return delegate.isOnline(); }
@Override public boolean isOnline() { return delegate.isOnline(); }
@Override public boolean isOnline() { return delegate.isOnline(); }
@Override public void deviceChanged(IDevice device, int changeMask) { if (discoveredDevice.equals(device) && (changeMask & IDevice.CHANGE_STATE) == 1) { if (device.isOnline()) { this.online = true; } } }
@Override public void deviceChanged(IDevice device, int changeMask) { if (discoveredDevice.equals(device) && (changeMask & IDevice.CHANGE_STATE) == 1) { if (device.isOnline()) { this.online = true; } } }
@Override public void run() { // wait while device comes online while (!mDevice.isOnline()) { try { Thread.sleep(DEVICE_POLL_INTERVAL_MSEC); } catch (InterruptedException e) { return; } } try { mDevice.executeShellCommand(LOGCAT_COMMAND, mReceiver, 0); } catch (TimeoutException e) { notifyListeners(Collections.singletonList(sConnectionTimeoutMsg)); } catch (AdbCommandRejectedException ignored) { // will not be thrown as long as the shell supports logcat } catch (ShellCommandUnresponsiveException ignored) { // this will not be thrown since the last argument is 0 } catch (IOException e) { notifyListeners(Collections.singletonList(sConnectionErrorMsg)); } notifyListeners(Collections.singletonList(sDeviceDisconnectedMsg)); }
/** * Make a possibly asynchronous request for a system property value. * * @param name the property name to retrieve * @return a {@link Future} that can be used to retrieve the prop value */ @NonNull public synchronized Future<String> getProperty(@NonNull String name) { SettableFuture<String> result; if (mCacheState.equals(CacheState.FETCHING)) { result = addPendingRequest(name); } else if (mDevice.isOnline() && mCacheState.equals(CacheState.UNPOPULATED) || !isRoProp(name)) { // cache is empty, or this is a volatile prop that requires a query result = addPendingRequest(name); mCacheState = CacheState.FETCHING; initiatePropertiesQuery(); } else { result = SettableFuture.create(); // cache is populated and this is a ro prop result.set(mProperties.get(name)); } return result; }
mDevices.add((Device) device); AndroidDebugBridge.deviceConnected(device); if (device.isOnline()) { newlyOnline.add((Device) device);