diff options
| author | 2024-10-25 13:06:59 +0000 | |
|---|---|---|
| committer | 2024-11-03 17:22:13 +0000 | |
| commit | 3ae978a009ba8f8791b14f02fb0ce97c8296bfca (patch) | |
| tree | 32880e83df1b339d273c12153db6dac8bba13cb1 | |
| parent | 7ed58e66bfce8190eacfc532780be54519512311 (diff) | |
Crash if Shade window config forwarder is instantiated when the flag is off
This makes sure we never try to access the new @ShadeDisplayAware ConfigurationForwarder when the ShadeWindowGoesAround flag is off
Bug: 362719719
Bug: 374267505
Test: SysUI unit tests
Flag: com.android.systemui.shade_window_goes_around
Change-Id: I34a0d04255de26506ba07a7eb2bc14db93d2e141
4 files changed, 9 insertions, 12 deletions
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/NotificationShadeWindowViewControllerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/NotificationShadeWindowViewControllerTest.kt index 59d0d70f77d4..041d1a611b55 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/NotificationShadeWindowViewControllerTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/NotificationShadeWindowViewControllerTest.kt @@ -238,7 +238,7 @@ class NotificationShadeWindowViewControllerTest(flags: FlagsParameterization) : primaryBouncerInteractor, alternateBouncerInteractor, mock(BouncerViewBinder::class.java), - mock(ConfigurationForwarder::class.java), + { mock(ConfigurationForwarder::class.java) }, brightnessMirrorShowingInteractor, ) underTest.setupExpandedStatusBar() diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/NotificationShadeWindowViewTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/NotificationShadeWindowViewTest.kt index 9b91fc7b4558..5d1ce7c5ca05 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/NotificationShadeWindowViewTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/NotificationShadeWindowViewTest.kt @@ -203,7 +203,7 @@ class NotificationShadeWindowViewTest : SysuiTestCase() { primaryBouncerInteractor, alternateBouncerInteractor, mock(), - configurationForwarder, + { configurationForwarder }, brightnessMirrorShowingInteractor, ) diff --git a/packages/SystemUI/src/com/android/systemui/shade/NotificationShadeWindowViewController.java b/packages/SystemUI/src/com/android/systemui/shade/NotificationShadeWindowViewController.java index be2bf822e6b3..f2c39063c867 100644 --- a/packages/SystemUI/src/com/android/systemui/shade/NotificationShadeWindowViewController.java +++ b/packages/SystemUI/src/com/android/systemui/shade/NotificationShadeWindowViewController.java @@ -88,6 +88,7 @@ import java.util.Optional; import java.util.function.Consumer; import javax.inject.Inject; +import javax.inject.Provider; /** * Controller for {@link NotificationShadeWindowView}. @@ -193,7 +194,7 @@ public class NotificationShadeWindowViewController implements Dumpable { PrimaryBouncerInteractor primaryBouncerInteractor, AlternateBouncerInteractor alternateBouncerInteractor, BouncerViewBinder bouncerViewBinder, - @ShadeDisplayAware ConfigurationForwarder configurationForwarder, + @ShadeDisplayAware Provider<ConfigurationForwarder> configurationForwarder, BrightnessMirrorShowingInteractor brightnessMirrorShowingInteractor) { mLockscreenShadeTransitionController = transitionController; mFalsingCollector = falsingCollector; @@ -257,7 +258,7 @@ public class NotificationShadeWindowViewController implements Dumpable { } if (ShadeWindowGoesAround.isEnabled()) { - mView.setConfigurationForwarder(configurationForwarder); + mView.setConfigurationForwarder(configurationForwarder.get()); } dumpManager.registerDumpable(this); } diff --git a/packages/SystemUI/src/com/android/systemui/shade/ShadeDisplayAwareModule.kt b/packages/SystemUI/src/com/android/systemui/shade/ShadeDisplayAwareModule.kt index 51f1f81ab1f0..a8026cd61aaf 100644 --- a/packages/SystemUI/src/com/android/systemui/shade/ShadeDisplayAwareModule.kt +++ b/packages/SystemUI/src/com/android/systemui/shade/ShadeDisplayAwareModule.kt @@ -79,12 +79,12 @@ object ShadeDisplayAwareModule { fun provideShadeWindowConfigurationController( @ShadeDisplayAware shadeContext: Context, factory: ConfigurationControllerImpl.Factory, - @GlobalConfig globalConfigConfigController: ConfigurationController, + @GlobalConfig globalConfigController: ConfigurationController, ): ConfigurationController { return if (ShadeWindowGoesAround.isEnabled) { factory.create(shadeContext) } else { - globalConfigConfigController + globalConfigController } } @@ -93,12 +93,8 @@ object ShadeDisplayAwareModule { @SysUISingleton fun provideShadeWindowConfigurationForwarder( @ShadeDisplayAware shadeConfigurationController: ConfigurationController, - @GlobalConfig globalConfigController: ConfigurationController, ): ConfigurationForwarder { - return if (ShadeWindowGoesAround.isEnabled) { - shadeConfigurationController - } else { - globalConfigController - } + ShadeWindowGoesAround.isUnexpectedlyInLegacyMode() + return shadeConfigurationController } } |