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

Commit 08490c5a authored by Siyuan Ren's avatar Siyuan Ren
Browse files

Clean up flag `register_new_wallet_card_in_background`

BUG: 409610756
FLAG: EXEMPT FLAG_REMOVAL

Change-Id: Ideb61b188f1c61d1185ae3decf213d1b0d15e59f
parent 49ed0e49
Loading
Loading
Loading
Loading
+0 −10
Original line number Original line 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 {
flag {
    name: "update_user_switcher_background"
    name: "update_user_switcher_background"
    namespace: "systemui"
    namespace: "systemui"
+14 −24
Original line number Original line Diff line number Diff line
@@ -7,14 +7,13 @@ import android.util.Log
import androidx.annotation.VisibleForTesting
import androidx.annotation.VisibleForTesting
import androidx.lifecycle.LifecycleService
import androidx.lifecycle.LifecycleService
import androidx.lifecycle.lifecycleScope
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.dagger.qualifiers.Background
import com.android.systemui.flags.FeatureFlags
import com.android.systemui.flags.FeatureFlags
import com.android.systemui.flags.Flags
import com.android.systemui.flags.Flags
import javax.inject.Inject
import javax.inject.Inject
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.CoroutineScope
import com.android.app.tracing.coroutines.launchTraced as launch


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

    override fun onBind(intent: Intent): IBinder {
    override fun onBind(intent: Intent): IBinder {
        super.onBind(intent)
        super.onBind(intent)
        if (registerNewWalletCardInBackground()) {
        scope.launch(context = backgroundDispatcher) {
        scope.launch(context = backgroundDispatcher) {
            controller.allWalletCards.collect { cards ->
            controller.allWalletCards.collect { cards ->
                val cardsSize = cards.size
                val cardsSize = cards.size
@@ -51,20 +50,10 @@ constructor(
                try {
                try {
                    listener?.registerNewWalletCards(cards)
                    listener?.registerNewWalletCards(cards)
                } catch (e: DeadObjectException) {
                } 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",
            }
                    )
        } 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")
                    }
                }
                }
            }
            }
        }
        }
@@ -105,6 +94,7 @@ constructor(
            override fun addWalletCardsUpdatedListener(listener: IWalletCardsUpdatedListener) {
            override fun addWalletCardsUpdatedListener(listener: IWalletCardsUpdatedListener) {
                addWalletCardsUpdatedListenerInternal(listener)
                addWalletCardsUpdatedListenerInternal(listener)
            }
            }

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