Failed to reconnect between networks
- Lingua principale
- Kotlin
- Stelle
- 62.6k
- Fork
- 8.1k
- Merge medio
- 3g 7h
- PR unite (30g)
- 36
Descrizione
# VPN service fails to reconnect after switching network type (Wi-Fi ↔ mobile)
**Device:** Pixel 8 (stock), Android 17 CP2A.260805.005
**Build:** main branch, 2026-09-13 23:20 MSK
## Steps to reproduce
1. Start VPN service — works fine.
2. Switch network type (Wi-Fi ↔ mobile/rmnet), either direction.
## Expected behavior
Service automatically reconnects on the new network.
## Actual behavior
Service fails to reconnect and stays broken until manually stopped/started.
## Log evidence
The attached logcat shows an exception right at the moment of the auto-restart attempt after the network switch:
```
java.lang.RuntimeException: A WebView method was called on thread
'DefaultDispatcher-worker-3'. All WebView methods must be called on the
same thread.
StartCore-Manager: Failed to reload core: ...
```
The stack trace points to this call chain:
```
NetworkMonitor.scheduleHandover
-> CoreServiceManager.reloadCore
-> CoreServiceManager.launchCore
-> DialerWebviewService.stop
-> WebView.stopLoading
```
## Suspected cause
It looks like `DialerWebviewService.stop()` (`DialerWebviewService.kt`) calls a WebView method off the main thread, causing `reloadCore()` to throw and the core to never restart on the new network.
I'm not 100% sure — I only traced this from the log/stack trace, not the actual source. Would appreciate it if a maintainer could check that path (`DialerWebviewService.stop` / `CoreServiceManager.kt`) — it may need `runOnUiThread` / `Dispatchers.Main` instead of calling WebView directly from a coroutine.
## Attachments
- Full logcat
[v2ray.md](https://github.com/user-attachments/files/32170607/v2ray.md)
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Direzione di ricerca
Start with NetworkMonitor.scheduleHandover and trace the call chain through CoreServiceManager.kt and DialerWebviewService.kt. Reproduce a Wi-Fi/mobile network switch while inspecting logcat, then verify the service reconnects without the reported WebView thread exception or failed core reload.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- android, kotlin
- Ambito
- mobile, networking
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Attiva
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 72/100