Repository navigation
fix: keep the host Activity alive when a backgrounded survey closes [ENG-3845] - #99
Merged
pandeymangg merged 2 commits intoNov 9, 2026
Conversation
…ENG-3845] Once the host has saved its state, dismiss() throws, so safeDismiss() finished the host Activity instead and the app restarted on return. Dismiss with state loss and never touch the host. The survey library load-error path runs through the same function.
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
ubuntu-latest now serves 26.04, where qemu-kvm has no install candidate, so the Setup KVM step fails before any analysis runs. 24.04 is the image the last green runs used.
|
mattinannt
approved these changes
Nov 9, 2026
1 task
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.



Fixes ENG-3845
Fixes #94
What & why
Was: A survey that closed itself while the app was in the background finished the host Activity. Coming back from Recents started the app fresh.
Now: Only the survey is dismissed. The SDK never finishes the host Activity, in the foreground or the background.
The survey-library load-error path runs through the same function, so it no longer ends the host either.
Where to look
safeDismiss:dismissAllowingStateLoss()replaces bothfinish()calls.sonarcloud.yml: the job is pinned toubuntu-24.04.ubuntu-latestbecame 26.04, where the "Setup KVM" step fails, so SonarCloud could not run at all. Not part of the fix.Breaking changes
None.
safeDismissis internal to the SDK.Migrations & env
How this was tested
Rerun:
./gradlew :android:connectedDebugAndroidTest -Pandroid.testInstrumentationRunnerArguments.class=com.formbricks.android.webview.FormbricksFragmentDismissInstrumentedTest(needs an emulator)Coverage
main, pass nowmainthe same way, passes nowmainand nowmain: new Activity, counter 0Screenshots and event log
main)Same scripted flow for both: tap the host counter five times, open the survey, finish it, press Home one second later, wait ten seconds, return from Recents. Lifecycle from
adb logcat -b events;onCloseis from the SDK log.main:This PR:
Open gaps
onSaveInstanceStateinstead of a real stop. Only the no-overlay path has a real stop and resume test.safeDismiss. The red-on-mainruns above are the proof.