Conversation
… on SecurityException PodMonitor's retryWhen always returned true, causing infinite 3-second retry loops when BLUETOOTH_SCAN permission was missing (e.g. on emulators). Now the scan flow checks missingPermissions before starting, and SecurityException aborts retries since it requires user action.
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.
What changed
Fixed the app getting stuck in an endless scanning loop on devices without Bluetooth (e.g. emulators). The scanner would retry every 3 seconds forever when Bluetooth permissions couldn't be granted, flooding the log and wasting resources.
Technical Context
PodMonitor.devicescombinedmissingPermissionsandisBluetoothEnabledbut only usedisBluetoothEnabledto gate scanning — permissions were logged but ignoredBleScanner.startScan()threwSecurityException(missingBLUETOOTH_SCAN), theretryWhenoperator always returnedtrue, causing infinite retries with 3-second delaymissingPermissions.isEmpty() && isBluetoothEnabled— when permissions are later granted, the combine re-emits and scanning starts naturallyretryWhennow returnsfalseforSecurityExceptionsince it requires user action to resolve (unlike transient errors which can legitimately recover)BluetoothManager2already had proper retry limits (max 3 with backoff) —PodMonitorwas the only unbounded retry