Loading mobile/android/fenix/app/src/main/java/org/mozilla/fenix/FenixApplication.kt +1 −1 Original line number Diff line number Diff line Loading @@ -595,7 +595,7 @@ open class FenixApplication : Application(), Provider, ThemeProvider { } runOnVisualCompleteness(queue) { GlobalScope.launch(IO) { components.integrityClient.warmUp() components.warmUpIntegrityClient() } } } Loading mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/ClientUUID.kt +8 −3 Original line number Diff line number Diff line Loading @@ -7,7 +7,6 @@ package org.mozilla.fenix.components import android.content.Context import android.content.SharedPreferences import androidx.core.content.edit import mozilla.components.lib.integrity.googleplay.RequestHashProvider import mozilla.components.lib.llm.mlpa.UserIdProvider import mozilla.components.lib.llm.mlpa.service.UserId import mozilla.components.support.ktx.kotlin.toHexString Loading Loading @@ -39,9 +38,15 @@ fun interface Hasher { /** * Generates and persists a stable per-install UUID, used to identify this client * consistently across [UserIdProvider] and [RequestHashProvider] consumers. * consistently across [UserIdProvider] consumers and other callers that need a * stable per-request hash derived from that UUID. */ interface ClientUUID : UserIdProvider, RequestHashProvider { interface ClientUUID : UserIdProvider { /** * Generates a hash derived from the client's stable UUID. */ fun generateHash(): String companion object { /** * Convenience initializer that creates a [SharedPreferences] to be used by [ClientUUID]. Loading mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/Components.kt +16 −2 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ import kotlinx.coroutines.MainScope import kotlinx.coroutines.SupervisorJob import mozilla.components.concept.ai.controls.AIFeatureBlock import mozilla.components.concept.ai.controls.AIFeatureRegistry import mozilla.components.concept.integrity.IntegrityClient import mozilla.components.feature.addons.AddonManager import mozilla.components.feature.addons.amo.AMOAddonsProvider import mozilla.components.feature.addons.migration.DefaultSupportedAddonsChecker Loading @@ -32,6 +33,8 @@ import mozilla.components.lib.ai.controls.default import mozilla.components.lib.crash.store.CrashAction import mozilla.components.lib.crash.store.CrashMiddleware import mozilla.components.lib.integrity.googleplay.GooglePlayIntegrityClient import mozilla.components.lib.integrity.googleplay.IntegrityConsumer import mozilla.components.lib.integrity.googleplay.RequestHashProvider import mozilla.components.lib.llm.mlpa.MlpaTokenStorage import mozilla.components.lib.publicsuffixlist.PublicSuffixList import mozilla.components.service.fxrelay.eligibility.RelayEligibilityStore Loading Loading @@ -432,14 +435,25 @@ class Components(private val context: Context) { ) } val integrityClient by lazyMonitored { private val googlePlayIntegrityClient by lazyMonitored { GooglePlayIntegrityClient.create( context = context, projectNumberToken = BuildConfig.GPS_INTEGRITY_TOKEN, requestHashProvider = clientUUID, requestHashProvider = RequestHashProvider { clientUUID.generateHash() }, ) } val integrityClient: IntegrityClient by lazyMonitored { googlePlayIntegrityClient.forConsumer(IntegrityConsumer.Summarize) } /** * Eagerly initializes the underlying Play Integrity token provider. This is exposed * separately from [integrityClient] because warm-up is specific to the Google * Play-backed implementation and isn't part of the [IntegrityClient] concept. */ suspend fun warmUpIntegrityClient(): Boolean = googlePlayIntegrityClient.warmUp() val termsOfUsePromptRepository by lazyMonitored { DefaultTermsOfUsePromptRepository(settings) } Loading mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/llm/Llm.kt +3 −4 Original line number Diff line number Diff line Loading @@ -5,8 +5,7 @@ package org.mozilla.fenix.components.llm import mozilla.components.concept.fetch.Client import mozilla.components.lib.integrity.googleplay.GooglePlayIntegrityClient import mozilla.components.lib.integrity.googleplay.IntegrityConsumer import mozilla.components.concept.integrity.IntegrityClient import mozilla.components.lib.llm.mlpa.MlpaLlmProvider import mozilla.components.lib.llm.mlpa.MlpaTokenProvider import mozilla.components.lib.llm.mlpa.MlpaTokenStorage Loading @@ -25,7 +24,7 @@ class Llm( private val client: Client, private val storage: MlpaTokenStorage, private val fxaTokenProvider: FxaAccessTokenProvider, private val integrityClient: GooglePlayIntegrityClient, private val integrityClient: IntegrityClient, private val userIdProvider: UserIdProvider, ) { Loading @@ -36,7 +35,7 @@ class Llm( MlpaTokenProvider.choose( MlpaTokenProvider.fxaTokenProvider(fxaTokenProvider), MlpaTokenProvider.mlpaIntegrityHandshake( integrityClient = integrityClient.forConsumer(IntegrityConsumer.Summarize), integrityClient = integrityClient, authenticationService = fenixMlpaService, userIdProvider = userIdProvider, storage = storage, Loading Loading
mobile/android/fenix/app/src/main/java/org/mozilla/fenix/FenixApplication.kt +1 −1 Original line number Diff line number Diff line Loading @@ -595,7 +595,7 @@ open class FenixApplication : Application(), Provider, ThemeProvider { } runOnVisualCompleteness(queue) { GlobalScope.launch(IO) { components.integrityClient.warmUp() components.warmUpIntegrityClient() } } } Loading
mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/ClientUUID.kt +8 −3 Original line number Diff line number Diff line Loading @@ -7,7 +7,6 @@ package org.mozilla.fenix.components import android.content.Context import android.content.SharedPreferences import androidx.core.content.edit import mozilla.components.lib.integrity.googleplay.RequestHashProvider import mozilla.components.lib.llm.mlpa.UserIdProvider import mozilla.components.lib.llm.mlpa.service.UserId import mozilla.components.support.ktx.kotlin.toHexString Loading Loading @@ -39,9 +38,15 @@ fun interface Hasher { /** * Generates and persists a stable per-install UUID, used to identify this client * consistently across [UserIdProvider] and [RequestHashProvider] consumers. * consistently across [UserIdProvider] consumers and other callers that need a * stable per-request hash derived from that UUID. */ interface ClientUUID : UserIdProvider, RequestHashProvider { interface ClientUUID : UserIdProvider { /** * Generates a hash derived from the client's stable UUID. */ fun generateHash(): String companion object { /** * Convenience initializer that creates a [SharedPreferences] to be used by [ClientUUID]. Loading
mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/Components.kt +16 −2 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ import kotlinx.coroutines.MainScope import kotlinx.coroutines.SupervisorJob import mozilla.components.concept.ai.controls.AIFeatureBlock import mozilla.components.concept.ai.controls.AIFeatureRegistry import mozilla.components.concept.integrity.IntegrityClient import mozilla.components.feature.addons.AddonManager import mozilla.components.feature.addons.amo.AMOAddonsProvider import mozilla.components.feature.addons.migration.DefaultSupportedAddonsChecker Loading @@ -32,6 +33,8 @@ import mozilla.components.lib.ai.controls.default import mozilla.components.lib.crash.store.CrashAction import mozilla.components.lib.crash.store.CrashMiddleware import mozilla.components.lib.integrity.googleplay.GooglePlayIntegrityClient import mozilla.components.lib.integrity.googleplay.IntegrityConsumer import mozilla.components.lib.integrity.googleplay.RequestHashProvider import mozilla.components.lib.llm.mlpa.MlpaTokenStorage import mozilla.components.lib.publicsuffixlist.PublicSuffixList import mozilla.components.service.fxrelay.eligibility.RelayEligibilityStore Loading Loading @@ -432,14 +435,25 @@ class Components(private val context: Context) { ) } val integrityClient by lazyMonitored { private val googlePlayIntegrityClient by lazyMonitored { GooglePlayIntegrityClient.create( context = context, projectNumberToken = BuildConfig.GPS_INTEGRITY_TOKEN, requestHashProvider = clientUUID, requestHashProvider = RequestHashProvider { clientUUID.generateHash() }, ) } val integrityClient: IntegrityClient by lazyMonitored { googlePlayIntegrityClient.forConsumer(IntegrityConsumer.Summarize) } /** * Eagerly initializes the underlying Play Integrity token provider. This is exposed * separately from [integrityClient] because warm-up is specific to the Google * Play-backed implementation and isn't part of the [IntegrityClient] concept. */ suspend fun warmUpIntegrityClient(): Boolean = googlePlayIntegrityClient.warmUp() val termsOfUsePromptRepository by lazyMonitored { DefaultTermsOfUsePromptRepository(settings) } Loading
mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/llm/Llm.kt +3 −4 Original line number Diff line number Diff line Loading @@ -5,8 +5,7 @@ package org.mozilla.fenix.components.llm import mozilla.components.concept.fetch.Client import mozilla.components.lib.integrity.googleplay.GooglePlayIntegrityClient import mozilla.components.lib.integrity.googleplay.IntegrityConsumer import mozilla.components.concept.integrity.IntegrityClient import mozilla.components.lib.llm.mlpa.MlpaLlmProvider import mozilla.components.lib.llm.mlpa.MlpaTokenProvider import mozilla.components.lib.llm.mlpa.MlpaTokenStorage Loading @@ -25,7 +24,7 @@ class Llm( private val client: Client, private val storage: MlpaTokenStorage, private val fxaTokenProvider: FxaAccessTokenProvider, private val integrityClient: GooglePlayIntegrityClient, private val integrityClient: IntegrityClient, private val userIdProvider: UserIdProvider, ) { Loading @@ -36,7 +35,7 @@ class Llm( MlpaTokenProvider.choose( MlpaTokenProvider.fxaTokenProvider(fxaTokenProvider), MlpaTokenProvider.mlpaIntegrityHandshake( integrityClient = integrityClient.forConsumer(IntegrityConsumer.Summarize), integrityClient = integrityClient, authenticationService = fenixMlpaService, userIdProvider = userIdProvider, storage = storage, Loading