[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [Git][tpo/applications/mullvad-browser][mullvad-browser-153.0esr-16.0-1] BB 45085: [android] Confine GooglePlayIntegrityClient to Components.kt



Title: GitLab

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:

Changes:

  • mobile/android/fenix/app/src/main/java/org/mozilla/fenix/FenixApplication.kt
    ... ... @@ -583,7 +583,7 @@ open class FenixApplication : Application(), Provider, ThemeProvider {
    583 583
             }
    
    584 584
             runOnVisualCompleteness(queue) {
    
    585 585
                 GlobalScope.launch(IO) {
    
    586
    -                components.integrityClient.warmUp()
    
    586
    +                components.warmUpIntegrityClient()
    
    587 587
                 }
    
    588 588
             }
    
    589 589
         }
    

  • mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/ClientUUID.kt
    ... ... @@ -7,7 +7,6 @@ package org.mozilla.fenix.components
    7 7
     import android.content.Context
    
    8 8
     import android.content.SharedPreferences
    
    9 9
     import androidx.core.content.edit
    
    10
    -import mozilla.components.lib.integrity.googleplay.RequestHashProvider
    
    11 10
     import mozilla.components.lib.llm.mlpa.UserIdProvider
    
    12 11
     import mozilla.components.lib.llm.mlpa.service.UserId
    
    13 12
     import mozilla.components.support.ktx.kotlin.toHexString
    
    ... ... @@ -39,9 +38,15 @@ fun interface Hasher {
    39 38
     
    
    40 39
     /**
    
    41 40
      * Generates and persists a stable per-install UUID, used to identify this client
    
    42
    - * consistently across [UserIdProvider] and [RequestHashProvider] consumers.
    
    41
    + * consistently across [UserIdProvider] consumers and other callers that need a
    
    42
    + * stable per-request hash derived from that UUID.
    
    43 43
      */
    
    44
    -interface ClientUUID : UserIdProvider, RequestHashProvider {
    
    44
    +interface ClientUUID : UserIdProvider {
    
    45
    +    /**
    
    46
    +     * Generates a hash derived from the client's stable UUID.
    
    47
    +     */
    
    48
    +    fun generateHash(): String
    
    49
    +
    
    45 50
         companion object {
    
    46 51
             /**
    
    47 52
              * 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
    19 19
     import kotlinx.coroutines.SupervisorJob
    
    20 20
     import mozilla.components.concept.ai.controls.AIFeatureBlock
    
    21 21
     import mozilla.components.concept.ai.controls.AIFeatureRegistry
    
    22
    +import mozilla.components.concept.integrity.IntegrityClient
    
    22 23
     import mozilla.components.feature.addons.AddonManager
    
    23 24
     import mozilla.components.feature.addons.amo.AMOAddonsProvider
    
    24 25
     import mozilla.components.feature.addons.migration.DefaultSupportedAddonsChecker
    
    ... ... @@ -32,6 +33,8 @@ import mozilla.components.lib.ai.controls.default
    32 33
     import mozilla.components.lib.crash.store.CrashAction
    
    33 34
     import mozilla.components.lib.crash.store.CrashMiddleware
    
    34 35
     import mozilla.components.lib.integrity.googleplay.GooglePlayIntegrityClient
    
    36
    +import mozilla.components.lib.integrity.googleplay.IntegrityConsumer
    
    37
    +import mozilla.components.lib.integrity.googleplay.RequestHashProvider
    
    35 38
     import mozilla.components.lib.llm.mlpa.MlpaTokenStorage
    
    36 39
     import mozilla.components.lib.publicsuffixlist.PublicSuffixList
    
    37 40
     import mozilla.components.service.fxrelay.eligibility.RelayEligibilityStore
    
    ... ... @@ -434,14 +437,25 @@ class Components(private val context: Context) {
    434 437
             )
    
    435 438
         }
    
    436 439
     
    
    437
    -    val integrityClient by lazyMonitored {
    
    440
    +    private val googlePlayIntegrityClient by lazyMonitored {
    
    438 441
             GooglePlayIntegrityClient.create(
    
    439 442
                 context = context,
    
    440 443
                 projectNumberToken = BuildConfig.GPS_INTEGRITY_TOKEN,
    
    441
    -            requestHashProvider = clientUUID,
    
    444
    +            requestHashProvider = RequestHashProvider { clientUUID.generateHash() },
    
    442 445
             )
    
    443 446
         }
    
    444 447
     
    
    448
    +    val integrityClient: IntegrityClient by lazyMonitored {
    
    449
    +        googlePlayIntegrityClient.forConsumer(IntegrityConsumer.Summarize)
    
    450
    +    }
    
    451
    +
    
    452
    +    /**
    
    453
    +     * Eagerly initializes the underlying Play Integrity token provider. This is exposed
    
    454
    +     * separately from [integrityClient] because warm-up is specific to the Google
    
    455
    +     * Play-backed implementation and isn't part of the [IntegrityClient] concept.
    
    456
    +     */
    
    457
    +    suspend fun warmUpIntegrityClient(): Boolean = googlePlayIntegrityClient.warmUp()
    
    458
    +
    
    445 459
         val termsOfUsePromptRepository by lazyMonitored {
    
    446 460
             DefaultTermsOfUsePromptRepository(settings)
    
    447 461
         }
    

  • mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/llm/Llm.kt
    ... ... @@ -5,8 +5,7 @@
    5 5
     package org.mozilla.fenix.components.llm
    
    6 6
     
    
    7 7
     import mozilla.components.concept.fetch.Client
    
    8
    -import mozilla.components.lib.integrity.googleplay.GooglePlayIntegrityClient
    
    9
    -import mozilla.components.lib.integrity.googleplay.IntegrityConsumer
    
    8
    +import mozilla.components.concept.integrity.IntegrityClient
    
    10 9
     import mozilla.components.lib.llm.mlpa.MlpaLlmProvider
    
    11 10
     import mozilla.components.lib.llm.mlpa.MlpaTokenProvider
    
    12 11
     import mozilla.components.lib.llm.mlpa.MlpaTokenStorage
    
    ... ... @@ -25,7 +24,7 @@ class Llm(
    25 24
         private val client: Client,
    
    26 25
         private val storage: MlpaTokenStorage,
    
    27 26
         private val fxaTokenProvider: FxaAccessTokenProvider,
    
    28
    -    private val integrityClient: GooglePlayIntegrityClient,
    
    27
    +    private val integrityClient: IntegrityClient,
    
    29 28
         private val userIdProvider: UserIdProvider,
    
    30 29
     ) {
    
    31 30
     
    
    ... ... @@ -36,7 +35,7 @@ class Llm(
    36 35
                 MlpaTokenProvider.choose(
    
    37 36
                     MlpaTokenProvider.fxaTokenProvider(fxaTokenProvider),
    
    38 37
                     MlpaTokenProvider.mlpaIntegrityHandshake(
    
    39
    -                    integrityClient = integrityClient.forConsumer(IntegrityConsumer.Summarize),
    
    38
    +                    integrityClient = integrityClient,
    
    40 39
                         authenticationService = fenixMlpaService,
    
    41 40
                         userIdProvider = userIdProvider,
    
    42 41
                         storage = storage,
    

  • _______________________________________________
    tor-commits mailing list -- tor-commits@xxxxxxxxxxxxxxxxxxxx
    To unsubscribe send an email to tor-commits-leave@xxxxxxxxxxxxxxxxxxxx