1 package com.android.systemui.statusbar.window 2 3 import com.android.systemui.dagger.SysUISingleton 4 import dagger.Binds 5 import dagger.Module 6 import javax.inject.Qualifier 7 8 /** Module providing dependencies related to the status bar window. */ 9 @Module 10 abstract class StatusBarWindowModule { 11 12 /** 13 * Binds a [StatusBarWindowViewInflater]. 14 * 15 * Only [StatusBarWindowControllerImpl] should inject it. 16 */ 17 @Binds 18 @SysUISingleton 19 @InternalWindowViewInflater providesStatusBarWindowViewInflaternull20 abstract fun providesStatusBarWindowViewInflater( 21 inflaterImpl: StatusBarWindowViewInflaterImpl 22 ): StatusBarWindowViewInflater 23 24 /** 25 * We want [StatusBarWindowViewInflater] to be provided to [StatusBarWindowControllerImpl]'s 26 * constructor via dagger so that we can provide a fake window view when testing the controller. 27 * However, we wan want *only* the controller to be able to inject the window view. 28 * 29 * This protected qualifier annotation achieves this. [StatusBarWindowViewInflater] can only be 30 * injected if it's annotated with [InternalWindowViewInflater], and only classes inside this 31 * [statusbar.window] package can access the annotation. 32 */ 33 @Retention(AnnotationRetention.BINARY) 34 @Qualifier 35 protected annotation class InternalWindowViewInflater 36 } 37