Skip to content

Don't show location permission message in SERP#7879

Open
malmstein wants to merge 3 commits intodevelopfrom
feature/david/03-05-don_t_show_location_permission_message_in_serp
Open

Don't show location permission message in SERP#7879
malmstein wants to merge 3 commits intodevelopfrom
feature/david/03-05-don_t_show_location_permission_message_in_serp

Conversation

@malmstein
Copy link
Contributor

@malmstein malmstein commented Mar 5, 2026

Task/Issue URL: https://app.asana.com/1/137249556945/project/414730916066338/task/1213541802817811

Description

Don't show location permission message in SERP

Steps to test this PR

Location enabled - SERP

  • Fresh install, open SERP “Restaurants near me"
  • Enable location permission
  • Close the app
  • Open the app again
  • Verify no message appears

Location enabled - Other sites

  • Fresh install, open a site with location permissions (walmart)
  • Enable location permission
  • Close the app
  • Open the app again
  • Verify permission message appears

Note

Medium Risk
Behavior changes around permission messaging and tab closing are user-visible and touch browser navigation state. Additionally, the applicationId/debug packaging changes in app/build.gradle could affect installability and CI expectations if not intentional.

Overview
Prevents the “domain has location permission” message from showing on DuckDuckGo-owned pages by updating BrowserTabViewModel.shouldShowLocationPermissionMessage to skip DuckDuckGo and DuckChat URLs, with new unit tests covering those cases.

Extends browser UI command handling to support contextual DuckAI updates and adds an external-app prompt option to close the current tab after launching.

Updates debug build packaging/icons in app/build.gradle (switches applicationId to com.duckduckgo.dev.android, removes .debug suffix, and changes debug launcher icons), which may be unintended for a production PR.

Written by Cursor Bugbot for commit 28dfbef. This will update automatically on new commits. Configure here.

Copy link
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@malmstein malmstein marked this pull request as ready for review March 5, 2026 16:15
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 3 potential issues.

Bugbot Autofix prepared fixes for all 3 issues found in the latest run.

  • ✅ Fixed: Dev application ID accidentally committed in build config
    • Reverted applicationId to com.duckduckgo.mobile.android, restored debug applicationIdSuffix, and changed icons back from gold to blue.
  • ✅ Fixed: SERP test mocks wrong dependency, tests wrong path
    • Changed the SERP test to mock mockDuckDuckGoUrlDetector.isDuckDuckGoUrl() instead of mockDuckChat.isDuckChatUrl(), and used a SERP URL with query parameter to differentiate from the plain DDG URL test.
  • ✅ Fixed: Accidentally committed test with generic name
    • Removed the leftover test() function from DuckDuckGoUrlDetectorTest as it duplicated existing coverage and had a non-descriptive name.

Create PR

Or push these changes by commenting:

@cursor push 32dd8929eb
Preview (32dd8929eb)
diff --git a/app/build.gradle b/app/build.gradle
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -22,8 +22,7 @@
 
 android {
     defaultConfig {
-//        applicationId "com.duckduckgo.mobile.android"
-        applicationId "com.duckduckgo.dev.android"
+        applicationId "com.duckduckgo.mobile.android"
 
         minSdk min_sdk
         targetSdk target_sdk
@@ -140,11 +139,11 @@
     }
     buildTypes {
         debug {
-//            applicationIdSuffix ".debug"
+            applicationIdSuffix ".debug"
             pseudoLocalesEnabled false
             manifestPlaceholders = [
-                    appIcon     : "@mipmap/ic_launcher_gold",
-                    appIconRound: "@mipmap/ic_launcher_gold_round"
+                    appIcon     : "@mipmap/ic_launcher_blue",
+                    appIconRound: "@mipmap/ic_launcher_blue_round"
             ]
         }
         release {

diff --git a/app/src/test/java/com/duckduckgo/app/browser/BrowserTabViewModelTest.kt b/app/src/test/java/com/duckduckgo/app/browser/BrowserTabViewModelTest.kt
--- a/app/src/test/java/com/duckduckgo/app/browser/BrowserTabViewModelTest.kt
+++ b/app/src/test/java/com/duckduckgo/app/browser/BrowserTabViewModelTest.kt
@@ -3666,15 +3666,15 @@
     @Test
     fun whenUserVisitsSERPUrlWithPermanentLocationPermissionThenMessageIsNotShown() =
         runTest {
-            val domain = "https://duckduckgo.com/"
+            val domain = "https://duckduckgo.com/?q=test"
 
             whenever(mockSitePermissionsManager.hasSitePermanentPermission(domain, LocationPermissionRequest.RESOURCE_LOCATION_PERMISSION))
                 .thenReturn(true)
-            whenever(mockDuckChat.isDuckChatUrl(any())).thenReturn(true)
+            whenever(mockDuckDuckGoUrlDetector.isDuckDuckGoUrl(domain)).thenReturn(true)
 
             givenCurrentSite(domain)
 
-            loadUrl("https://duckduckgo.com/", isBrowserShowing = true)
+            loadUrl("https://duckduckgo.com/?q=test", isBrowserShowing = true)
 
             assertCommandNotIssued<Command.ShowDomainHasPermissionMessage>()
         }

diff --git a/app/src/test/java/com/duckduckgo/app/browser/DuckDuckGoUrlDetectorTest.kt b/app/src/test/java/com/duckduckgo/app/browser/DuckDuckGoUrlDetectorTest.kt
--- a/app/src/test/java/com/duckduckgo/app/browser/DuckDuckGoUrlDetectorTest.kt
+++ b/app/src/test/java/com/duckduckgo/app/browser/DuckDuckGoUrlDetectorTest.kt
@@ -162,9 +162,4 @@
         assertEquals("images", vertical)
     }
 
-    @Test
-    fun test() {
-        val isDDG = testee.isDuckDuckGoUrl("https://duckduckgo.com/")
-        assertTrue(isDDG)
-    }
 }

defaultConfig {
applicationId "com.duckduckgo.mobile.android"
// applicationId "com.duckduckgo.mobile.android"
applicationId "com.duckduckgo.dev.android"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dev application ID accidentally committed in build config

High Severity

The applicationId was changed from com.duckduckgo.mobile.android to com.duckduckgo.dev.android, the original is commented out, the debug applicationIdSuffix is commented out, and icons were changed from blue to gold. These look like local development configuration changes that were accidentally included in this PR. If merged, this would change the app's identity, preventing existing installations from receiving it as an update.

Additional Locations (1)

Fix in Cursor Fix in Web

loadUrl("https://duckduckgo.com/", isBrowserShowing = true)

assertCommandNotIssued<Command.ShowDomainHasPermissionMessage>()
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SERP test mocks wrong dependency, tests wrong path

Medium Severity

The test whenUserVisitsSERPUrlWithPermanentLocationPermissionThenMessageIsNotShown mocks mockDuckChat.isDuckChatUrl(any()) to return true, but the test is supposed to verify SERP (DuckDuckGo URL) detection. It passes because the isDuckChatUrl check short-circuits the condition !isDuckChatUrl && !isDuckDuckGoUrl, not because isDuckDuckGoUrl returns true. The mock for isDuckDuckGoUrl is missing, so this test doesn't actually validate the SERP-specific logic it claims to test.

Fix in Cursor Fix in Web

fun test() {
val isDDG = testee.isDuckDuckGoUrl("https://duckduckgo.com/")
assertTrue(isDDG)
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Accidentally committed test with generic name

Low Severity

A test function named simply test() was added to DuckDuckGoUrlDetectorTest. This appears to be a leftover debug/exploratory test — it has a non-descriptive name and duplicates coverage already provided by whenCheckingFullDDGUrlThenIdentifiedAsDDGUrl. It looks like it was accidentally included in the commit.

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant