Bug 1899330 Comment 7 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

Honestly most of this code was lifted from WebIDE, we only did cleanups when working on about:debugging. 

I found some doc about the states at https://android.googlesource.com/platform/packages/modules/adb/+/HEAD/adb.h#108 
```
    kCsConnecting = 0,  // Haven't received a response from the device yet.
    kCsAuthorizing,     // Authorizing with keys from ADB_VENDOR_KEYS.
    kCsUnauthorized,    // ADB_VENDOR_KEYS exhausted, fell back to user prompt.
    kCsNoPerm,          // Insufficient permissions to communicate with the device.
    kCsDetached,        // USB device that's detached from the adb server.
    kCsOffline,
    // After CNXN packet, the ConnectionState describes not a state but the type of service
    // on the other end of the transport.
    kCsBootloader,  // Device running fastboot OS (fastboot) or userspace fastboot (fastbootd).
    kCsDevice,      // Device running Android OS (adbd).
    kCsHost,        // What a device sees from its end of a Transport (adb host).
    kCsRecovery,    // Device with bootloader loaded but no ROM OS loaded (adbd).
    kCsSideload,    // Device running Android OS Sideload mode (minadbd sideload mode).
    kCsRescue,      // Device running Android OS Rescue mode (minadbd rescue mode).
```

Based on this, I think all the states corresponding to a device which is ready for communication are kCsBootloader, kCsDevice, kCsRecovery, kCsSideload and kCsRescue. I imagine that "device" is the main one here, but it would be nice to just include the others. Other than this I think your proposal makes sense, it's hard to know why this would have regressed though.
Honestly most of this code was lifted from WebIDE, we only did cleanups when working on about:debugging. 

I found some doc about the states at https://android.googlesource.com/platform/packages/modules/adb/+/HEAD/adb.h#108 
```
    kCsConnecting = 0,  // Haven't received a response from the device yet.
    kCsAuthorizing,     // Authorizing with keys from ADB_VENDOR_KEYS.
    kCsUnauthorized,    // ADB_VENDOR_KEYS exhausted, fell back to user prompt.
    kCsNoPerm,          // Insufficient permissions to communicate with the device.
    kCsDetached,        // USB device that's detached from the adb server.
    kCsOffline,
    // After CNXN packet, the ConnectionState describes not a state but the type of service
    // on the other end of the transport.
    kCsBootloader,  // Device running fastboot OS (fastboot) or userspace fastboot (fastbootd).
    kCsDevice,      // Device running Android OS (adbd).
    kCsHost,        // What a device sees from its end of a Transport (adb host).
    kCsRecovery,    // Device with bootloader loaded but no ROM OS loaded (adbd).
    kCsSideload,    // Device running Android OS Sideload mode (minadbd sideload mode).
    kCsRescue,      // Device running Android OS Rescue mode (minadbd rescue mode).
```

Based on this, I think all the states corresponding to a device which is ready for communication are kCsBootloader, kCsDevice, kCsRecovery, kCsSideload and kCsRescue. I imagine that "device" is the main one here, but it would be nice to just include the others. Other than this I think your proposal makes sense, it's hard to know why this would have regressed though.

Edit: ah well there is even a `ConnectionStateIsOnline` https://android.googlesource.com/platform/packages/modules/adb/+/HEAD/adb.h#127 which matches what I listed above + "host" (but I don't think we care about this one)

Back to Bug 1899330 Comment 7