feat: detect default browser change and deliver survey#8198
Conversation
318f497 to
9cbca39
Compare
9cbca39 to
30be785
Compare
When DDG loses default browser status, deliver a survey via: - Push notification (immediate, on detecting the change) - In-app prompt (fallback on next app open if notification ignored) - 12h periodic background worker (secondary trigger) Survey is suppressed after the in-app prompt is shown once. Gated behind defaultBrowserChangedSurvey remote feature flag (default INTERNAL). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
30be785 to
b0d84e3
Compare
…by moving survey checks into core browser components, replacing the pending-flag with a persistent wasEverDefaultBrowser state, and centralizing worker scheduling and URL generation.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 3665914. Configure here.
|
|
||
| logcat { "Default-browser-changed survey trigger condition met, sending notification" } | ||
| defaultBrowserChangedSurveyManager.markSurveyShown() | ||
| notificationSender.sendNotification(defaultBrowserChangedSurveyNotification) |
There was a problem hiding this comment.
Worker marks survey done before notification interaction
Medium Severity
The worker calls markSurveyShown() when sending the notification, setting defaultBrowserChangedSurveyDone = true before the user interacts with it. If the user ignores the notification and later opens the app, shouldTriggerSurvey() returns false (since defaultBrowserChangedSurveyDone is already true), preventing the in-app fallback from ever showing. This contradicts the stated Scenario 2 behavior where the in-app survey appears after an ignored notification.
Reviewed by Cursor Bugbot for commit 3665914. Configure here.


Task/Issue URL: https://app.asana.com/1/137249556945/project/72649045549333/task/1213798658770676?focus=true
Description
When DDG loses default browser status, deliver a survey via:
The survey is only shown once.
Steps to test this PR
Prerequisites
Internal build installed
Remote feature flag defaultBrowserChangedSurvey enabled (set to INTERNAL)
Device locale set to English
Fresh install or cleared app data (so defaultBrowserChangedSurveyDone is false)
Scenario 1: In-app survey shown when default browser changed away from DDG
Setup: Set DDG as default browser, then change default to another browser (e.g., Chrome via Settings > Apps > Default apps > Browser).
Open DDG app
Expected: Survey activity launches after a brief delay, loading the survey. Survey URL contains correct install age bucket and chanel, app version
Dismiss/complete the survey
Close and reopen the app
Expected: The survey does NOT appear again.
Scenario 2: Push notification delivered when app is in background
Setup: Set DDG as default, then change default away from DDG. Ensure notifications are enabled for DDG.
Don't open the app
Advance time on device by 1 day
Expected: A notification appears with title "We noticed a change" and body "DuckDuckGo is no longer your default browser. Mind telling us why?" Tapping it opens the survey. Survey URL contains correct install age bucket and chanel, app version
Dismiss/complete the survey
Close and reopen the app
Expected: The survey does NOT appear again.
Scenario 3: No survey if DDG was never the default browser
Setup: Fresh install. Do NOT set DDG as default at any point (skip the onboarding default browser prompt).
Use the app normally
Background/foreground the app multiple times
Expected: No survey appears in-app and no notification is sent
Scenario 4: No survey if DDG is still the default browser
Setup: Set DDG as default and keep it as default.
Open and close the app multiple times
Expected: No survey triggers.
Scenario 5: Notification skipped when notifications are disabled. Survey shown only in app
Scenario 6: Non-English locale suppresses the survey
Scenario 7: Feature flag disabled suppresses the survey