Loading packages/SystemUI/src/com/android/systemui/dagger/ReferenceSystemUIModule.java +0 −2 Original line number Diff line number Diff line Loading @@ -74,7 +74,6 @@ import com.android.systemui.statusbar.NotificationShadeWindowController; import com.android.systemui.statusbar.SysuiStatusBarStateController; import com.android.systemui.statusbar.dagger.CentralSurfacesModule; import com.android.systemui.statusbar.dagger.StartCentralSurfacesModule; import com.android.systemui.statusbar.notification.dagger.NotificationStackModule; import com.android.systemui.statusbar.notification.dagger.ReferenceNotificationsModule; import com.android.systemui.statusbar.notification.headsup.HeadsUpModule; import com.android.systemui.statusbar.phone.CentralSurfaces; Loading Loading @@ -170,7 +169,6 @@ import javax.inject.Named; WallpaperModule.class, ShortcutHelperModule.class, ContextualEducationModule.class, NotificationStackModule.class, }) public abstract class ReferenceSystemUIModule { Loading packages/SystemUI/src/com/android/systemui/shade/ShadeDisplayAwareModule.kt +20 −17 Original line number Diff line number Diff line Loading @@ -42,12 +42,12 @@ import com.android.systemui.shade.display.ShadeDisplayPolicyModule import com.android.systemui.shade.domain.interactor.ShadeDialogContextInteractor import com.android.systemui.shade.domain.interactor.ShadeDialogContextInteractorImpl import com.android.systemui.shade.domain.interactor.ShadeDisplaysInteractor import com.android.systemui.shade.domain.interactor.ShadeExpandedStateInteractor import com.android.systemui.shade.shared.flag.ShadeWindowGoesAround import com.android.systemui.statusbar.notification.stack.NotificationStackRebindingHider import com.android.systemui.statusbar.notification.stack.NotificationStackRebindingHiderImpl import com.android.systemui.statusbar.phone.ConfigurationControllerImpl import com.android.systemui.statusbar.phone.ConfigurationForwarder import com.android.systemui.statusbar.policy.ConfigurationController import dagger.BindsOptionalOf import dagger.Module import dagger.Provides import dagger.multibindings.ClassKey Loading @@ -67,7 +67,7 @@ import javax.inject.Qualifier * By using this dedicated module, we ensure the notification shade window always utilizes the * correct display context and resources, regardless of the display it's on. */ @Module(includes = [OptionalShadeDisplayAwareBindings::class, ShadeDisplayPolicyModule::class]) @Module(includes = [ShadeDisplayPolicyModule::class]) object ShadeDisplayAwareModule { /** Creates a new context for the shade window. */ Loading Loading @@ -242,17 +242,6 @@ object ShadeDisplayAwareModule { } } @Provides @IntoMap @ClassKey(ShadeDisplaysInteractor::class) fun provideShadeDisplaysInteractor(impl: Provider<ShadeDisplaysInteractor>): CoreStartable { return if (ShadeWindowGoesAround.isEnabled) { impl.get() } else { CoreStartable.NOP } } /** * Provided for making classes easier to test. In tests, a custom method to wait for the next * frame can be easily provided. Loading @@ -264,11 +253,25 @@ object ShadeDisplayAwareModule { fun provideShadeOnDefaultDisplayWhenLocked(): Boolean = true } /** Module that should be included only if the shade window [WindowRootView] is available. */ @Module internal interface OptionalShadeDisplayAwareBindings { @BindsOptionalOf fun bindOptionalOfWindowRootView(): WindowRootView object ShadeDisplayAwareWithShadeWindowModule { @Provides @IntoMap @ClassKey(ShadeDisplaysInteractor::class) fun provideShadeDisplaysInteractor(impl: Provider<ShadeDisplaysInteractor>): CoreStartable { return if (ShadeWindowGoesAround.isEnabled) { impl.get() } else { CoreStartable.NOP } } @BindsOptionalOf fun bindOptionalOShadeExpandedStateInteractor(): ShadeExpandedStateInteractor @Provides @SysUISingleton fun bindNotificationStackRebindingHider( impl: NotificationStackRebindingHiderImpl ): NotificationStackRebindingHider = impl } /** Loading packages/SystemUI/src/com/android/systemui/shade/ShadeDisplayChangeLatencyTracker.kt +1 −12 Original line number Diff line number Diff line Loading @@ -24,8 +24,6 @@ import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Background import com.android.systemui.scene.ui.view.WindowRootView import com.android.systemui.shade.data.repository.ShadeDisplaysRepository import com.android.systemui.util.kotlin.getOrNull import java.util.Optional import java.util.concurrent.CancellationException import javax.inject.Inject import kotlin.time.Duration.Companion.seconds Loading @@ -51,22 +49,13 @@ import kotlinx.coroutines.withTimeout class ShadeDisplayChangeLatencyTracker @Inject constructor( optionalShadeRootView: Optional<WindowRootView>, private val shadeRootView: WindowRootView, @ShadeDisplayAware private val configurationRepository: ConfigurationRepository, private val latencyTracker: LatencyTracker, @Background private val bgScope: CoroutineScope, private val choreographerUtils: ChoreographerUtils, ) { private val shadeRootView = optionalShadeRootView.getOrNull() ?: error( """ ShadeRootView must be provided for ShadeDisplayChangeLatencyTracker to work. If it is not, it means this is being instantiated in a SystemUI variant that shouldn't. """ .trimIndent() ) /** * We need to keep this always up to date eagerly to avoid delays receiving the new display ID. */ Loading packages/SystemUI/src/com/android/systemui/shade/ShadeModule.kt +6 −1 Original line number Diff line number Diff line Loading @@ -54,7 +54,12 @@ import javax.inject.Provider /** Module for classes related to the notification shade. */ @Module( includes = [StartShadeModule::class, ShadeViewProviderModule::class, WindowRootViewBlurModule::class] [ StartShadeModule::class, ShadeViewProviderModule::class, WindowRootViewBlurModule::class, ShadeDisplayAwareWithShadeWindowModule::class, ] ) abstract class ShadeModule { companion object { Loading packages/SystemUI/src/com/android/systemui/shade/domain/interactor/ShadeDisplaysInteractor.kt +2 −26 Original line number Diff line number Diff line Loading @@ -39,9 +39,7 @@ import com.android.systemui.statusbar.notification.domain.interactor.ActiveNotif import com.android.systemui.statusbar.notification.row.NotificationRebindingTracker import com.android.systemui.statusbar.notification.stack.NotificationStackRebindingHider import com.android.systemui.statusbar.phone.ConfigurationForwarder import com.android.systemui.util.kotlin.getOrNull import com.android.window.flags.Flags import java.util.Optional import javax.inject.Inject import kotlin.coroutines.CoroutineContext import kotlin.time.Duration.Companion.seconds Loading @@ -63,17 +61,14 @@ constructor( @Background private val bgScope: CoroutineScope, @Main private val mainThreadContext: CoroutineContext, private val shadeDisplayChangeLatencyTracker: ShadeDisplayChangeLatencyTracker, shadeExpandedInteractor: Optional<ShadeExpandedStateInteractor>, private val shadeExpandedInteractor: ShadeExpandedStateInteractor, private val shadeExpansionIntent: ShadeExpansionIntent, private val activeNotificationsInteractor: ActiveNotificationsInteractor, private val notificationRebindingTracker: NotificationRebindingTracker, notificationStackRebindingHider: Optional<NotificationStackRebindingHider>, private val notificationStackRebindingHider: NotificationStackRebindingHider, @ShadeDisplayAware private val configForwarder: ConfigurationForwarder, ) : CoreStartable { private val shadeExpandedInteractor = requireOptional(shadeExpandedInteractor) private val notificationStackRebindingHider = requireOptional(notificationStackRebindingHider) private val hasActiveNotifications: Boolean get() = activeNotificationsInteractor.areAnyNotificationsPresentValue Loading Loading @@ -224,24 +219,5 @@ constructor( const val TAG = "ShadeDisplaysInteractor" const val COLLAPSE_EXPAND_REASON = "Shade window move" val TIMEOUT = 1.seconds /** * [ShadeDisplaysInteractor] is bound in the SystemUI module for all variants, but needs * some specific dependencies to be bound from each variant (e.g. * [ShadeExpandedStateInteractor] or [NotificationStackRebindingHider]). When those are not * bound, this class is not expected to be instantiated, and trying to instantiate it would * crash. */ inline fun <reified T> requireOptional(optional: Optional<T>): T { return optional.getOrNull() ?: error( """ ${T::class.java.simpleName} must be provided for ShadeDisplaysInteractor to work. If it is not, it means this is being instantiated in a SystemUI variant that shouldn't. """ .trimIndent() ) } } } Loading
packages/SystemUI/src/com/android/systemui/dagger/ReferenceSystemUIModule.java +0 −2 Original line number Diff line number Diff line Loading @@ -74,7 +74,6 @@ import com.android.systemui.statusbar.NotificationShadeWindowController; import com.android.systemui.statusbar.SysuiStatusBarStateController; import com.android.systemui.statusbar.dagger.CentralSurfacesModule; import com.android.systemui.statusbar.dagger.StartCentralSurfacesModule; import com.android.systemui.statusbar.notification.dagger.NotificationStackModule; import com.android.systemui.statusbar.notification.dagger.ReferenceNotificationsModule; import com.android.systemui.statusbar.notification.headsup.HeadsUpModule; import com.android.systemui.statusbar.phone.CentralSurfaces; Loading Loading @@ -170,7 +169,6 @@ import javax.inject.Named; WallpaperModule.class, ShortcutHelperModule.class, ContextualEducationModule.class, NotificationStackModule.class, }) public abstract class ReferenceSystemUIModule { Loading
packages/SystemUI/src/com/android/systemui/shade/ShadeDisplayAwareModule.kt +20 −17 Original line number Diff line number Diff line Loading @@ -42,12 +42,12 @@ import com.android.systemui.shade.display.ShadeDisplayPolicyModule import com.android.systemui.shade.domain.interactor.ShadeDialogContextInteractor import com.android.systemui.shade.domain.interactor.ShadeDialogContextInteractorImpl import com.android.systemui.shade.domain.interactor.ShadeDisplaysInteractor import com.android.systemui.shade.domain.interactor.ShadeExpandedStateInteractor import com.android.systemui.shade.shared.flag.ShadeWindowGoesAround import com.android.systemui.statusbar.notification.stack.NotificationStackRebindingHider import com.android.systemui.statusbar.notification.stack.NotificationStackRebindingHiderImpl import com.android.systemui.statusbar.phone.ConfigurationControllerImpl import com.android.systemui.statusbar.phone.ConfigurationForwarder import com.android.systemui.statusbar.policy.ConfigurationController import dagger.BindsOptionalOf import dagger.Module import dagger.Provides import dagger.multibindings.ClassKey Loading @@ -67,7 +67,7 @@ import javax.inject.Qualifier * By using this dedicated module, we ensure the notification shade window always utilizes the * correct display context and resources, regardless of the display it's on. */ @Module(includes = [OptionalShadeDisplayAwareBindings::class, ShadeDisplayPolicyModule::class]) @Module(includes = [ShadeDisplayPolicyModule::class]) object ShadeDisplayAwareModule { /** Creates a new context for the shade window. */ Loading Loading @@ -242,17 +242,6 @@ object ShadeDisplayAwareModule { } } @Provides @IntoMap @ClassKey(ShadeDisplaysInteractor::class) fun provideShadeDisplaysInteractor(impl: Provider<ShadeDisplaysInteractor>): CoreStartable { return if (ShadeWindowGoesAround.isEnabled) { impl.get() } else { CoreStartable.NOP } } /** * Provided for making classes easier to test. In tests, a custom method to wait for the next * frame can be easily provided. Loading @@ -264,11 +253,25 @@ object ShadeDisplayAwareModule { fun provideShadeOnDefaultDisplayWhenLocked(): Boolean = true } /** Module that should be included only if the shade window [WindowRootView] is available. */ @Module internal interface OptionalShadeDisplayAwareBindings { @BindsOptionalOf fun bindOptionalOfWindowRootView(): WindowRootView object ShadeDisplayAwareWithShadeWindowModule { @Provides @IntoMap @ClassKey(ShadeDisplaysInteractor::class) fun provideShadeDisplaysInteractor(impl: Provider<ShadeDisplaysInteractor>): CoreStartable { return if (ShadeWindowGoesAround.isEnabled) { impl.get() } else { CoreStartable.NOP } } @BindsOptionalOf fun bindOptionalOShadeExpandedStateInteractor(): ShadeExpandedStateInteractor @Provides @SysUISingleton fun bindNotificationStackRebindingHider( impl: NotificationStackRebindingHiderImpl ): NotificationStackRebindingHider = impl } /** Loading
packages/SystemUI/src/com/android/systemui/shade/ShadeDisplayChangeLatencyTracker.kt +1 −12 Original line number Diff line number Diff line Loading @@ -24,8 +24,6 @@ import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Background import com.android.systemui.scene.ui.view.WindowRootView import com.android.systemui.shade.data.repository.ShadeDisplaysRepository import com.android.systemui.util.kotlin.getOrNull import java.util.Optional import java.util.concurrent.CancellationException import javax.inject.Inject import kotlin.time.Duration.Companion.seconds Loading @@ -51,22 +49,13 @@ import kotlinx.coroutines.withTimeout class ShadeDisplayChangeLatencyTracker @Inject constructor( optionalShadeRootView: Optional<WindowRootView>, private val shadeRootView: WindowRootView, @ShadeDisplayAware private val configurationRepository: ConfigurationRepository, private val latencyTracker: LatencyTracker, @Background private val bgScope: CoroutineScope, private val choreographerUtils: ChoreographerUtils, ) { private val shadeRootView = optionalShadeRootView.getOrNull() ?: error( """ ShadeRootView must be provided for ShadeDisplayChangeLatencyTracker to work. If it is not, it means this is being instantiated in a SystemUI variant that shouldn't. """ .trimIndent() ) /** * We need to keep this always up to date eagerly to avoid delays receiving the new display ID. */ Loading
packages/SystemUI/src/com/android/systemui/shade/ShadeModule.kt +6 −1 Original line number Diff line number Diff line Loading @@ -54,7 +54,12 @@ import javax.inject.Provider /** Module for classes related to the notification shade. */ @Module( includes = [StartShadeModule::class, ShadeViewProviderModule::class, WindowRootViewBlurModule::class] [ StartShadeModule::class, ShadeViewProviderModule::class, WindowRootViewBlurModule::class, ShadeDisplayAwareWithShadeWindowModule::class, ] ) abstract class ShadeModule { companion object { Loading
packages/SystemUI/src/com/android/systemui/shade/domain/interactor/ShadeDisplaysInteractor.kt +2 −26 Original line number Diff line number Diff line Loading @@ -39,9 +39,7 @@ import com.android.systemui.statusbar.notification.domain.interactor.ActiveNotif import com.android.systemui.statusbar.notification.row.NotificationRebindingTracker import com.android.systemui.statusbar.notification.stack.NotificationStackRebindingHider import com.android.systemui.statusbar.phone.ConfigurationForwarder import com.android.systemui.util.kotlin.getOrNull import com.android.window.flags.Flags import java.util.Optional import javax.inject.Inject import kotlin.coroutines.CoroutineContext import kotlin.time.Duration.Companion.seconds Loading @@ -63,17 +61,14 @@ constructor( @Background private val bgScope: CoroutineScope, @Main private val mainThreadContext: CoroutineContext, private val shadeDisplayChangeLatencyTracker: ShadeDisplayChangeLatencyTracker, shadeExpandedInteractor: Optional<ShadeExpandedStateInteractor>, private val shadeExpandedInteractor: ShadeExpandedStateInteractor, private val shadeExpansionIntent: ShadeExpansionIntent, private val activeNotificationsInteractor: ActiveNotificationsInteractor, private val notificationRebindingTracker: NotificationRebindingTracker, notificationStackRebindingHider: Optional<NotificationStackRebindingHider>, private val notificationStackRebindingHider: NotificationStackRebindingHider, @ShadeDisplayAware private val configForwarder: ConfigurationForwarder, ) : CoreStartable { private val shadeExpandedInteractor = requireOptional(shadeExpandedInteractor) private val notificationStackRebindingHider = requireOptional(notificationStackRebindingHider) private val hasActiveNotifications: Boolean get() = activeNotificationsInteractor.areAnyNotificationsPresentValue Loading Loading @@ -224,24 +219,5 @@ constructor( const val TAG = "ShadeDisplaysInteractor" const val COLLAPSE_EXPAND_REASON = "Shade window move" val TIMEOUT = 1.seconds /** * [ShadeDisplaysInteractor] is bound in the SystemUI module for all variants, but needs * some specific dependencies to be bound from each variant (e.g. * [ShadeExpandedStateInteractor] or [NotificationStackRebindingHider]). When those are not * bound, this class is not expected to be instantiated, and trying to instantiate it would * crash. */ inline fun <reified T> requireOptional(optional: Optional<T>): T { return optional.getOrNull() ?: error( """ ${T::class.java.simpleName} must be provided for ShadeDisplaysInteractor to work. If it is not, it means this is being instantiated in a SystemUI variant that shouldn't. """ .trimIndent() ) } } }