madb icon indicating copy to clipboard operation
madb copied to clipboard

Device monitor event incorrectly states device is online when it is not.

Open camalot opened this issue 8 years ago • 0 comments

Original Bug on CodePlex

the device monitor connection event always states the device is online even if the state of the device is not online.

current code has a line that switches the newdevice state to online even though adb is not reporting it online. A device coming this way via the event will be listed as online but will be offline if you find the same device via the AndroidDebugBridge Devices Propety which uses AdbHelper.Instance.GetDevices

// at this point we should still have some new devices in newList, so we
// process them.
foreach ( Device newDevice in list ) {
  // add them to the list
  Devices.Add ( newDevice );
  if ( Server != null ) {
    newDevice.State = DeviceState.Online;
    newDevice.OnStateChanged ( EventArgs.Empty );
    Server.OnDeviceConnected ( new DeviceEventArgs ( newDevice ) );
  }
  // start monitoring them.
  if ( AndroidDebugBridge.ClientSupport ) {
    if ( newDevice.IsOnline ) {
      StartMonitoringDevice ( newDevice );
    }
  }
  // look for their build info.
  if ( newDevice.IsOnline ) {
    QueryNewDeviceForInfo ( newDevice );
  }
}

camalot avatar May 19 '16 13:05 camalot