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

Commit 3ae978a0 authored by Nicolo' Mazzucato's avatar Nicolo' Mazzucato
Browse files

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
parent 7ed58e66
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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()
+1 −1
Original line number Diff line number Diff line
@@ -203,7 +203,7 @@ class NotificationShadeWindowViewTest : SysuiTestCase() {
                primaryBouncerInteractor,
                alternateBouncerInteractor,
                mock(),
                configurationForwarder,
                { configurationForwarder },
                brightnessMirrorShowingInteractor,
            )

+3 −2
Original line number Diff line number Diff line
@@ -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);
    }
+4 −8
Original line number Diff line number Diff line
@@ -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
    }
}