fix(usb): Surface permission denial as permanent disconnect#5943
Merged
jamesarich merged 1 commit intoJun 25, 2026
Merged
Conversation
Stop retrying the current Android USB connection attempt when the platform denies device permission, while reporting a structured transport disconnect reason instead of transport-owned UI text. Map that reason at the service boundary for the existing connectionError flow, preserve the quiet explicit-close guard before warning logs, and cover the permanent Disconnected state plus emitted error.
jamesarich
approved these changes
Jun 25, 2026
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.
Overview
This pull request fixes the Android USB permission-denial path so a denied permission request surfaces as a clear terminal disconnect instead of silently entering the reconnect path.
Before this change,
SerialRadioTransport.onMissingPermission(...)logged the missing permission callback but did not notify the service layer. That left the selected USB device in a retry-oriented state even though Android had denied access for the current connection attempt.This change reports USB permission denial as a structured transport disconnect reason, keeps user-facing copy out of the serial transport layer, and maps the reason through the existing
connectionErrorflow at the service boundary.Key Changes
TransportDisconnectReason.UsbPermissionDeniedas a machine-readable transport disconnect cause.RadioTransportCallback.onDisconnect(...)to carry an optional structured disconnect reason.TransportDisconnectReason.UsbPermissionDenied,UsbPermissionDeniedinSharedRadioInterfaceServiceto the existingconnectionErrorflow.ConnectionState.Disconnected.Testing
SharedRadioInterfaceServiceLivenessTestcoverage for USB permission denial.ConnectionState.Disconnected.Migration Notes