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

Commit 8cb71dff authored by Bharat Singh's avatar Bharat Singh
Browse files

[SysUI][Floaty] Provide no-op CoreStartable when feature disabled

Bug: 399263897
Test: Manually via logging, observed no-op CoreStartable was provide when
feature was disabled
Flag: com.android.systemui.shared.enable_lpp_assist_invocation_effect

Change-Id: I7f03c201cfb47d338f500c9dfec6dfe5935f2c6b
parent 6b81bf05
Loading
Loading
Loading
Loading
+20 −5
Original line number Diff line number Diff line
@@ -17,17 +17,32 @@
package com.android.systemui.topwindoweffects.dagger

import com.android.systemui.CoreStartable
import com.android.systemui.shared.Flags.enableLppAssistInvocationEffect
import com.android.systemui.topwindoweffects.TopLevelWindowEffects
import dagger.Binds
import dagger.Module
import dagger.Provides
import dagger.multibindings.ClassKey
import dagger.multibindings.IntoMap

@Module
interface TopLevelWindowEffectsModule {

    @Binds
    @Binds fun bindTopLevelWindowEffectsCoreStartable(impl: TopLevelWindowEffects): CoreStartable

    companion object {

        @Provides
        @IntoMap
        @ClassKey(TopLevelWindowEffects::class)
    fun bindTopLevelWindowEffectsCoreStartable(impl: TopLevelWindowEffects): CoreStartable
        fun provideTopLevelWindowEffectsCoreStartable(impl: TopLevelWindowEffects): CoreStartable {
            return if (enableLppAssistInvocationEffect()) {
                impl
            } else {
                CoreStartable {
                    // empty, no-op
                }
            }
        }
    }
}