Skip to content
Snippets Groups Projects
Select Git revision
  • a5b06b0ff8d7c99ce2678f61536cbf1430783dba
  • master default protected
  • android-7.1.2_r28_klist
  • oreo-mr1-iot-release
  • sdk-release
  • pie-cts-dev
  • pie-cts-release
  • pie-vts-release
  • nougat-iot-release
  • pie-gsi
  • pie-platform-release
  • pie-r2-release
  • pie-r2-s1-release
  • pie-release
  • pie-dev
  • oreo-m4-s4-release
  • o-mr1-iot-preview-8
  • oreo-m2-s2-release
  • oreo-m2-s1-release
  • oreo-m6-s2-release
  • oreo-m6-s3-release
  • android-o-mr1-iot-release-1.0.4
  • android-9.0.0_r8
  • android-9.0.0_r7
  • android-9.0.0_r6
  • android-9.0.0_r5
  • android-8.1.0_r46
  • android-8.1.0_r45
  • android-n-iot-release-smart-display-r2
  • android-vts-8.1_r5
  • android-cts-8.1_r8
  • android-cts-8.0_r12
  • android-cts-7.1_r20
  • android-cts-7.0_r24
  • android-cts-6.0_r31
  • android-o-mr1-iot-release-1.0.3
  • android-cts-9.0_r1
  • android-8.1.0_r43
  • android-8.1.0_r42
  • android-n-iot-release-smart-display
  • android-p-preview-5
41 results

AndroidSystemCore

  • Clone with SSH
  • Clone with HTTPS
  • user avatar
    Spencer Low authored
    After resuming Windows from sleep or hibernation, USB connections are not
    automatically disconnected. Writing to the USB connections does not return any
    errors, but read never returns. My theory is that the device saw the host
    sleep/hibernation as a disconnect, so the device is waiting for re-auth from the
    host as if the host was just connected.
    
    To solve this, detect resume from sleep/hibernation, disconnect all USB
    connections and let the device poll thread re-detect the USB devices in 1 sec.
    
    This is done by using a hidden window that receives power notifications. The
    hidden window code is based on Chromium's similar code (platform-tools already
    includes the Chromium Authors license).
    
    This depends on a change to AdbWinUsbApi.dll that makes AdbCloseHandle(endpoint)
    abort any pending IOs and wait for those IOs to be aborted.
    
    I expect that this should solve many adb and Android Studio related bugs
    regarding hangs or errors.
    
    Also in this change:
    
     - Add D() logging for any errors from AdbWinApi.dll API calls.
    
     - Stop setting errno to Win32 error values which the caller can't really do
       anything with. Stop calling SetLastError() because the callers don't check
       GetLastError() anyway.
    
     - Check the return value from writing zero length packets.
    
     - If the full amount of data isn't written, return an error.
    
     - Upon any usb_read/usb_write error, kick the connection instead of only
       kicking when ERROR_INVALID_HANDLE is encountered.
    
     - Restructure some code from nested-if-trees to goto-fail to make it easier
       to follow.
    
     - Delete usb_name() since it isn't thread-safe and it isn't used.
    
    Change-Id: Iffcf5315ad8593d0c7e93012afaabe6fae354ac1
    Signed-off-by: default avatarSpencer Low <CompareAndSwap@gmail.com>
    a5b06b0f
    History
    Name Last commit Last update