brizental pushed to branch mullvad-browser-153.0esr-16.0-1 at The Tor Project / Applications / Mullvad Browser Commits: 7e4d093f by Beatriz Rizental at 2026-07-28T11:20:40-03:00 BB 45085: [android] Confine GooglePlayIntegrityClient to Components.kt Uplifting: https://phabricator.services.mozilla.com/D313912 - - - - - 4 changed files: - mobile/android/fenix/app/src/main/java/org/mozilla/fenix/FenixApplication.kt - mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/ClientUUID.kt - mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/Components.kt - mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/llm/Llm.kt Changes: ===================================== mobile/android/fenix/app/src/main/java/org/mozilla/fenix/FenixApplication.kt ===================================== @@ -583,7 +583,7 @@ open class FenixApplication : Application(), Provider, ThemeProvider { } runOnVisualCompleteness(queue) { GlobalScope.launch(IO) { - components.integrityClient.warmUp() + components.warmUpIntegrityClient() } } } ===================================== mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/ClientUUID.kt ===================================== @@ -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 @@ -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]. ===================================== mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/Components.kt ===================================== @@ -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 @@ -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 @@ -434,14 +437,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) } ===================================== mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/llm/Llm.kt ===================================== @@ -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 @@ -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, ) { @@ -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, View it on GitLab: https://gitlab.torproject.org/tpo/applications/mullvad-browser/-/commit/7e4d... -- View it on GitLab: https://gitlab.torproject.org/tpo/applications/mullvad-browser/-/commit/7e4d... You're receiving this email because of your account on gitlab.torproject.org. Manage all notifications: https://gitlab.torproject.org/-/profile/notifications | Help: https://gitlab.torproject.org/help
participants (1)
-
brizental (@brizental)