cold start stability#1042
Conversation
kar
left a comment
There was a problem hiding this comment.
Tried to run on Android, will compile but will never settle into loaded state (stuck on "please wait" on start). Log attached
Seems to me that similar changes for privatedns service done for ios, are missing for android side in this PR, maybe that's the problem?
Overall missing the "why" comments for new components. In a month we won't know why something was added. But it's a taste thing, if AI can figure it out I'm fine with not having them in this project.
There was a problem hiding this comment.
Probably analogous changes ar needed for _android version of this file
|
I'll get the android env set up to see what's going on. regarding comments, perhaps you can suggest a agents.md update with guidelines on what to comment on and when? |
|
@codex can you try answering the missing "Why" from the PR questions? brief and to the point please |
|
Codex couldn't complete this request. Try again later. |
I have added to main now |
ea764f2 to
8cce4c6
Compare
ensure splash continues showing until flutter is ready to draw something.
- cancel the fallback timer after a successful foreground promotion - add regression coverage for in-flight and post-success background launches
The cloudPermCheckSettled gate introduced for iOS deferred DNS retries could leave Android permanently stuck in initializing state. Two fixes: 1. ConnectivityService.rescan() now queries initial DNS state synchronously so privateDns is populated before first callback fires, matching the iOS behavior of reading DNS state from system settings. 2. PlatformPermActor wraps _recheckDnsPerm in try-catch to ensure cloudPermCheckSettled is always restored to true on error, preventing the app from getting permanently stuck if a channel call fails. https://claude.ai/code/session_01Gc63y37qftNhTYNzZQ4d3J
The Android private DNS string format is "alias-tag.cloud.blokada.org" not the iOS format "https://cloud.blokada.org/tag/alias". https://claude.ai/code/session_01Gc63y37qftNhTYNzZQ4d3J
ConnectivityService: check NET_CAPABILITY_NOT_VPN before reading DNS from activeNetwork, preventing incorrect reads when VPN is active during later rescan() calls (e.g. doze state changes). PlatformPermActor: log the error before settling cloudPermCheckSettled on DNS check failure for easier debugging. https://claude.ai/code/session_01Gc63y37qftNhTYNzZQ4d3J
- modules.dart: start foreground modules before stage.setForeground so routeChanged listeners (DeviceStore.fetch) no longer race the account creation and hang the cold start on a fresh install - StartupContextService: implement firstFrameRendered channel and a listener API mirroring the iOS StartupContext signal - MainActivity + activity_main.xml: add a splash overlay reusing the existing @drawable/splash and fade it out when Flutter reports its first frame, eliminating the white-screen gap before the home view
- Refactor _recheckDnsPerm with try/finally to guarantee cloudPermCheckSettled - Add lifecycleSeen gate to prevent duplicate foreground promotion - Fix BottomManagerSheet: dedup sheets, capture navigator for safe dismiss - Auto-dismiss DNS onboarding when cloudPermEnabled flips true - Remove duplicate self-dismiss listener in iOS DNS sheet - Cancel splash fallback on activity destroy
8cce4c6 to
778f2cf
Compare
|
ok ready for another review |
|
Ok I went through the code as well as built and ran this on android. Did basic onboarding and no-network cold start test. Behavior seems proper, nice you addressed the modal-dismiss-detection workaround, it was causing some bugs in the past but I couldn't figure out the proper solution before the ai era. I was concerned about the new code not working well but I couldn't bug it out in testing. I like the new comments. Code changes look reasonable and positive overall. I didn't experience any problems with splash screen / white screen or foreground trigger. Also built the family flavor, went through onboarding, messed with the lock screen feature and modals (this flavor has more of them), bg/fg switching. All behavior nominal. lgtm |
|
also tested ios fcm event to also confirm it still worked |
After the startup refactor that separated background bootstrap from foreground startup and exposed bootstrap identity earlier, a few timing issues became visible:
This PR resolves those issues by: