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

Commit f8eb75d5 authored by Nicolo' Mazzucato's avatar Nicolo' Mazzucato
Browse files

Make ShadeDialogContextInteractorImpl inject ShadeDisplayReposiory with a Provider

This avoids for the class to be instantiated when the flag is off.

Bug: 362719719
Bug: 399074879
Test: No error log up startup with flag off
Flag: com.android.systemui.shade_window_goes_around
Change-Id: If729cd3fe3064db0ab076da46a012dfa707d4939
parent badfb594
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -47,14 +47,16 @@ class ShadeDialogContextInteractorImpl
constructor(
    @Main private val defaultContext: Context,
    private val displayWindowPropertyRepository: Provider<DisplayWindowPropertiesRepository>,
    private val shadeDisplaysRepository: ShadeDisplaysRepository,
    private val shadeDisplaysRepository: Provider<ShadeDisplaysRepository>,
    @Background private val bgScope: CoroutineScope,
) : CoreStartable, ShadeDialogContextInteractor {

    override fun start() {
        if (ShadeWindowGoesAround.isUnexpectedlyInLegacyMode()) return
        bgScope.launchTraced(TAG) {
            shadeDisplaysRepository.displayId
            shadeDisplaysRepository
                .get()
                .displayId
                // No need for default display pre-warming.
                .filter { it != Display.DEFAULT_DISPLAY }
                .collectLatest { displayId ->
@@ -70,7 +72,7 @@ constructor(
            if (!ShadeWindowGoesAround.isEnabled) {
                return defaultContext
            }
            val displayId = shadeDisplaysRepository.displayId.value
            val displayId = shadeDisplaysRepository.get().displayId.value
            return getContextOrDefault(displayId)
        }