Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f3fddea5 authored by Siyuan Ren's avatar Siyuan Ren Committed by Android (Google) Code Review
Browse files

Merge "Clean up flag `register_new_wallet_card_in_background`" into main

parents 9e1e8a20 08490c5a
Loading
Loading
Loading
Loading
+0 −10
Original line number Diff line number Diff line
@@ -919,16 +919,6 @@ flag {
    }
}

flag {
   name: "register_new_wallet_card_in_background"
   namespace: "systemui"
   description: "Decide whether the call to registerNewWalletCards method should be issued on background thread."
   bug: "322506838"
   metadata {
        purpose: PURPOSE_BUGFIX
   }
}

flag {
    name: "update_user_switcher_background"
    namespace: "systemui"
+14 −24
Original line number Diff line number Diff line
@@ -7,14 +7,13 @@ import android.util.Log
import androidx.annotation.VisibleForTesting
import androidx.lifecycle.LifecycleService
import androidx.lifecycle.lifecycleScope
import com.android.systemui.Flags.registerNewWalletCardInBackground
import com.android.app.tracing.coroutines.launchTraced as launch
import com.android.systemui.dagger.qualifiers.Background
import com.android.systemui.flags.FeatureFlags
import com.android.systemui.flags.Flags
import javax.inject.Inject
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.CoroutineScope
import com.android.app.tracing.coroutines.launchTraced as launch

/**
 * Serves as an intermediary between QuickAccessWalletService and ContextualCardManager (in PCC).
@@ -41,9 +40,9 @@ constructor(
    ) : this(dispatcher, controller, featureFlags) {
        this.scope = scope
    }

    override fun onBind(intent: Intent): IBinder {
        super.onBind(intent)
        if (registerNewWalletCardInBackground()) {
        scope.launch(context = backgroundDispatcher) {
            controller.allWalletCards.collect { cards ->
                val cardsSize = cards.size
@@ -51,20 +50,10 @@ constructor(
                try {
                    listener?.registerNewWalletCards(cards)
                } catch (e: DeadObjectException) {
                        Log.e(TAG, "Failed to register wallet cards because IWalletCardsUpdatedListener is dead")
                    }
                }
            }
        } else {
            scope.launch {
                controller.allWalletCards.collect { cards ->
                    val cardsSize = cards.size
                    Log.i(TAG, "Number of cards registered $cardsSize")
                    try {
                        listener?.registerNewWalletCards(cards)
                    } catch (e: DeadObjectException) {
                        Log.e(TAG, "Failed to register wallet cards because IWalletCardsUpdatedListener is dead")
                    }
                    Log.e(
                        TAG,
                        "Failed to register wallet cards because IWalletCardsUpdatedListener is dead",
                    )
                }
            }
        }
@@ -105,6 +94,7 @@ constructor(
            override fun addWalletCardsUpdatedListener(listener: IWalletCardsUpdatedListener) {
                addWalletCardsUpdatedListenerInternal(listener)
            }

            override fun onWalletContextualLocationsStateUpdated(storeLocations: List<String>) {
                onWalletContextualLocationsStateUpdatedInternal(storeLocations)
            }