You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 25f6a44
Browse filesBrowse the repository at this point in the historyBrowse files
### Summary
- Removed `withTimeoutOrNull` timeout from the helper:
`display?.refreshRate` is a plain blocking call with no suspension
points, so coroutine cancellation is never checked while the IPC is in
flight; additionally, `runInterruptible` would not help either as the
native Binder layer ignores `Thread.interrupt()`
- Fixed `CancellationException` being silently swallowed by `catch (e:
Exception)`, which suppressed scope cancellation and logged a spurious
error
- Switched default dispatcher from `Dispatchers.Default` to
`Dispatchers.IO`, which has an elastic thread pool suited for blocking
I/O rather than a fixed CPU-bound pool
- Replaced `safeSystemCallWithCallback` with a simpler `safeSystemCall`
that returns `T` directly — the callback and `mainDispatcher` parameter
were unnecessary since after `withContext(Dispatchers.IO)` returns the
coroutine is already back on the caller's dispatcher
### Context
The `safeSystemCallWithCallback` helper was introduced to move
`display?.refreshRate` (a blocking Binder IPC) off the main thread. This
PR addresses correctness issues in that helper discovered during review
of MAPSAND-2266.
### Key Changes
- **`Utils.kt`**: Removed `safeSystemCallWithCallback`; replaced with
`safeSystemCall` returning `T` directly, with
`withContext(Dispatchers.IO)` and explicit rethrow of
`CancellationException`
- **`MapView.kt`, `MapSurface.kt`**: Updated call sites to use
`safeSystemCall`
- **`SafeSystemCallTest`**: Removed timeout tests; added
`CancellationException` rethrow coverage
### Validation
- [x] ktlint and lint pass
- [x] `SafeSystemCallTest`, `MapViewTest`, `MapSurfaceTest` pass
cc @mapbox/maps-android
---------
Co-authored-by: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
GitOrigin-RevId: 61119c3e820e31b9eb5b34908f0c9390cb9b8a2b
0 commit comments