mirror of
https://github.com/fork-maintainers/iceraven-browser
synced 2024-11-17 15:26:23 +00:00
For #25658 - Track the site permissions prompt and user actions
Track when the prompt is shown and when the permissions are allowed/denied.
This commit is contained in:
parent
f13a982d64
commit
fd28889d71
@ -6162,6 +6162,71 @@ autoplay:
|
||||
metadata:
|
||||
tags:
|
||||
- SitePermissions
|
||||
|
||||
site_permissions:
|
||||
prompt_shown:
|
||||
type: event
|
||||
description: |
|
||||
A prompt for the user to approve site permissions is shown.
|
||||
extra_keys:
|
||||
permissions:
|
||||
description: |
|
||||
Comma delimited list of permissions to approve.
|
||||
type: string
|
||||
bugs:
|
||||
- https://github.com/mozilla-mobile/fenix/issues/25658
|
||||
data_reviews:
|
||||
- ??????????????
|
||||
data_sensitivity:
|
||||
- interaction
|
||||
notification_emails:
|
||||
- android-probes@mozilla.com
|
||||
expires: 115
|
||||
metadata:
|
||||
tags:
|
||||
- SitePermissions
|
||||
permissions_allowed:
|
||||
type: event
|
||||
description: |
|
||||
User approved site permissions.
|
||||
extra_keys:
|
||||
permissions:
|
||||
description: |
|
||||
Comma delimited list of approved permissions.
|
||||
type: string
|
||||
bugs:
|
||||
- https://github.com/mozilla-mobile/fenix/issues/25658
|
||||
data_reviews:
|
||||
- ??????????????
|
||||
data_sensitivity:
|
||||
- interaction
|
||||
notification_emails:
|
||||
- android-probes@mozilla.com
|
||||
expires: 115
|
||||
metadata:
|
||||
tags:
|
||||
- SitePermissions
|
||||
permissions_denied:
|
||||
type: event
|
||||
description: |
|
||||
User denied site permissions.
|
||||
extra_keys:
|
||||
permissions:
|
||||
description: |
|
||||
Comma delimited list of approved permissions.
|
||||
type: string
|
||||
bugs:
|
||||
- https://github.com/mozilla-mobile/fenix/issues/25658
|
||||
data_reviews:
|
||||
- ??????????????
|
||||
data_sensitivity:
|
||||
- interaction
|
||||
notification_emails:
|
||||
- android-probes@mozilla.com
|
||||
expires: 115
|
||||
metadata:
|
||||
tags:
|
||||
- SitePermissions
|
||||
storage.stats:
|
||||
query_stats_duration:
|
||||
send_in_pings:
|
||||
|
@ -21,6 +21,7 @@ import mozilla.components.feature.prompts.facts.CreditCardAutofillDialogFacts
|
||||
import mozilla.components.feature.pwa.ProgressiveWebAppFacts
|
||||
import mozilla.components.feature.search.telemetry.ads.AdsTelemetry
|
||||
import mozilla.components.feature.search.telemetry.incontent.InContentTelemetry
|
||||
import mozilla.components.feature.sitepermissions.SitePermissionsFacts
|
||||
import mozilla.components.feature.syncedtabs.facts.SyncedTabsFacts
|
||||
import mozilla.components.feature.top.sites.facts.TopSitesFacts
|
||||
import mozilla.components.support.base.Component
|
||||
@ -44,6 +45,7 @@ import org.mozilla.fenix.GleanMetrics.MediaNotification
|
||||
import org.mozilla.fenix.GleanMetrics.MediaState
|
||||
import org.mozilla.fenix.GleanMetrics.PerfAwesomebar
|
||||
import org.mozilla.fenix.GleanMetrics.ProgressiveWebApp
|
||||
import org.mozilla.fenix.GleanMetrics.SitePermissions
|
||||
import org.mozilla.fenix.GleanMetrics.SyncedTabs
|
||||
import org.mozilla.fenix.search.awesomebar.ShortcutsSuggestionProvider
|
||||
import org.mozilla.fenix.utils.Settings
|
||||
@ -293,6 +295,18 @@ internal class ReleaseMetricController(
|
||||
}
|
||||
Unit
|
||||
}
|
||||
Component.FEATURE_SITEPERMISSIONS to SitePermissionsFacts.Items.PERMISSIONS -> {
|
||||
when (action) {
|
||||
Action.DISPLAY -> SitePermissions.promptShown.record(SitePermissions.PromptShownExtra(value))
|
||||
Action.CONFIRM ->
|
||||
SitePermissions.permissionsAllowed.record(SitePermissions.PermissionsAllowedExtra(value))
|
||||
Action.CANCEL ->
|
||||
SitePermissions.permissionsDenied.record(SitePermissions.PermissionsDeniedExtra(value))
|
||||
else -> {
|
||||
// no-op
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else -> {
|
||||
// no-op
|
||||
|
@ -24,6 +24,7 @@ import mozilla.components.feature.prompts.facts.CreditCardAutofillDialogFacts
|
||||
import mozilla.components.feature.pwa.ProgressiveWebAppFacts
|
||||
import mozilla.components.feature.search.telemetry.ads.AdsTelemetry
|
||||
import mozilla.components.feature.search.telemetry.incontent.InContentTelemetry
|
||||
import mozilla.components.feature.sitepermissions.SitePermissionsFacts
|
||||
import mozilla.components.feature.syncedtabs.facts.SyncedTabsFacts
|
||||
import mozilla.components.feature.top.sites.facts.TopSitesFacts
|
||||
import mozilla.components.support.base.Component
|
||||
@ -49,6 +50,7 @@ import org.mozilla.fenix.GleanMetrics.LoginDialog
|
||||
import org.mozilla.fenix.GleanMetrics.MediaNotification
|
||||
import org.mozilla.fenix.GleanMetrics.PerfAwesomebar
|
||||
import org.mozilla.fenix.GleanMetrics.ProgressiveWebApp
|
||||
import org.mozilla.fenix.GleanMetrics.SitePermissions
|
||||
import org.mozilla.fenix.GleanMetrics.SyncedTabs
|
||||
import org.mozilla.fenix.components.metrics.ReleaseMetricController.Companion
|
||||
import org.mozilla.fenix.helpers.FenixRobolectricTestRunner
|
||||
@ -755,4 +757,61 @@ class MetricControllerTest {
|
||||
|
||||
assertEquals(2, BrowserSearch.inContent["provider"].testGetValue())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `GIVEN a site permissions prompt is shown WHEN processing the fact THEN the right metric is recorded`() {
|
||||
val controller = ReleaseMetricController(emptyList(), { true }, { true }, mockk())
|
||||
val fact = Fact(
|
||||
component = Component.FEATURE_SITEPERMISSIONS,
|
||||
action = Action.DISPLAY,
|
||||
item = SitePermissionsFacts.Items.PERMISSIONS,
|
||||
value = "test"
|
||||
)
|
||||
assertNull(SitePermissions.promptShown.testGetValue())
|
||||
|
||||
controller.run {
|
||||
fact.process()
|
||||
}
|
||||
|
||||
assertEquals(1, SitePermissions.promptShown.testGetValue()!!.size)
|
||||
assertEquals("test", SitePermissions.promptShown.testGetValue()!!.single().extra!!["permissions"])
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `GIVEN site permissions are allowed WHEN processing the fact THEN the right metric is recorded`() {
|
||||
val controller = ReleaseMetricController(emptyList(), { true }, { true }, mockk())
|
||||
val fact = Fact(
|
||||
component = Component.FEATURE_SITEPERMISSIONS,
|
||||
action = Action.CONFIRM,
|
||||
item = SitePermissionsFacts.Items.PERMISSIONS,
|
||||
value = "allow"
|
||||
)
|
||||
assertNull(SitePermissions.promptShown.testGetValue())
|
||||
|
||||
controller.run {
|
||||
fact.process()
|
||||
}
|
||||
|
||||
assertEquals(1, SitePermissions.permissionsAllowed.testGetValue()!!.size)
|
||||
assertEquals("allow", SitePermissions.permissionsAllowed.testGetValue()!!.single().extra!!["permissions"])
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `GIVEN site permissions are denied WHEN processing the fact THEN the right metric is recorded`() {
|
||||
val controller = ReleaseMetricController(emptyList(), { true }, { true }, mockk())
|
||||
val fact = Fact(
|
||||
component = Component.FEATURE_SITEPERMISSIONS,
|
||||
action = Action.CANCEL,
|
||||
item = SitePermissionsFacts.Items.PERMISSIONS,
|
||||
value = "deny"
|
||||
)
|
||||
assertNull(SitePermissions.promptShown.testGetValue())
|
||||
|
||||
controller.run {
|
||||
fact.process()
|
||||
}
|
||||
|
||||
assertEquals(1, SitePermissions.permissionsDenied.testGetValue()!!.size)
|
||||
assertEquals("deny", SitePermissions.permissionsDenied.testGetValue()!!.single().extra!!["permissions"])
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user