Fix Dadb.list() throwing on host with unauthorized/offline devices (#…#98
Open
aditya711-code wants to merge 1 commit into
Open
Conversation
…obile-dev-inc#55, mobile-dev-inc#62) When `host:devices` returns a mix of `device` and `unauthorized`/`offline` entries, `listDadbs` previously took every serial and called `createDadb` for each, which immediately tries to open `host:features` over a transport the unauthorized device cannot service. The throw aborts the whole `.map` block and `Dadb.list()` returns nothing — even healthy devices on the same host become invisible to dadb-based callers. Two changes: 1. `listDadbs` filters by state (`device` only) and wraps each `createDadb` call in `runCatching` so a single failing entry can't kill the whole returned list. 2. `AdbServerDadb.supportedFeatures` is made `by lazy` so simply constructing an instance no longer eagerly triggers `host:features`. This means a fresh `Dadb` for a healthy device can be constructed without being affected by the state of unrelated devices on the host. Verified end-to-end against Maestro CLI on a host with one `unauthorized` Android phone and one healthy emulator: stock dadb 1.2.9 fails with "Device <serial> was requested, but it is not connected" for the healthy emulator; with this patch the same flow runs to completion. Same hardware state, only the library version changed. Fixes mobile-dev-inc#55 Fixes mobile-dev-inc#62
Author
|
@Leland-Takamine Hey can you check this out |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…55, #62)
When
host:devicesreturns a mix ofdeviceandunauthorized/offlineentries,listDadbspreviously took every serial and calledcreateDadbfor each, which immediately tries to openhost:featuresover a transport the unauthorized device cannot service. The throw aborts the whole.mapblock andDadb.list()returns nothing — even healthy devices on the same host become invisible to dadb-based callers.Two changes:
listDadbsfilters by state (deviceonly) and wraps eachcreateDadbcall inrunCatchingso a single failing entry can't kill the whole returned list.AdbServerDadb.supportedFeaturesis madeby lazyso simply constructing an instance no longer eagerly triggershost:features. This means a freshDadbfor a healthy device can be constructed without being affected by the state of unrelated devices on the host.Verified end-to-end against Maestro CLI on a host with one
unauthorizedAndroid phone and one healthy emulator: stock dadb 1.2.9 fails with "Device was requested, but it is not connected" for the healthy emulator; with this patch the same flow runs to completion. Same hardware state, only the library version changed.Fixes #55
Fixes #62