Wrap Android connect permission failures
Summary
- translate
SecurityExceptionfrom AndroidconnectGatt()intoIllegalStateException - preserve the original exception as the cause and release threading resources before propagating the failure
- add Android host regression coverage for a missing
BLUETOOTH_CONNECTpermission
Closes #1166
Verification
./gradlew :kable-core:lintKotlinAndroidMain :kable-core:lintKotlinAndroidHostTest :kable-core:testAndroidHostTest./gradlew assemble -PsuppressWarnings=true./gradlew -PRELEASE_SIGNING_ENABLED=false publishToMavenLocal./gradlew checkprogressed through Rust, JVM, Android, JS, Wasm, iOS, and macOS verification; local execution stopped only because Xcode lacks the watchOS simulator SDK required bywatchosSimulatorArm64Test
[!NOTE] Medium Risk Touches core connect/cancellation paths on Android and in shared peripheral logic; behavior changes for callers that relied on broad IllegalStateException handling in awaitConnect.
Overview Android
connectGatt()SecurityExceptions (e.g. missingBLUETOOTH_CONNECT) are now turned intoIllegalStateExceptionwith the original exception as cause, and threading is released before the error propagates.
awaitConnectno longer treats everyIllegalStateExceptionas a cancelled peripheral. It catchesCancellationExceptionandInactiveScopeExceptionseparately so real connect failures (including the new permission wrapper) surface unchanged, while disconnect/cancel still map to "Cannot connect peripheral that has been cancelled".SharedRepeatableActionthrowsInactiveScopeExceptionwhen the parent scope is inactive instead of usingcheck().Regression tests cover Android connect permission failure and common
awaitConnectbehavior (preservedIllegalStateException, inactive scope, cancelled action).Reviewed by Cursor Bugbot for commit 783b21dd921fc925b210f391af9fefbf5bec53a5. Configure here.
@cursor review