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

Commit f113c153 authored by Tracy Zhou's avatar Tracy Zhou
Browse files

Update split shade signal reference

This is probably a regression since wallpaper zoom out isn't happening either on the outer screen of foldables. We should have updated the isSplitShade signal to the new *Interactor architecture.

Fixes: 401283527
Test: manual
Flag: EXEMPT bugfix
Change-Id: I7bb617822db65502e3b83c313f484b8c69c34cd8
parent 31d71959
Loading
Loading
Loading
Loading
+7 −16
Original line number Diff line number Diff line
@@ -32,14 +32,12 @@ import com.android.systemui.dump.DumpManager
import com.android.systemui.keyguard.domain.interactor.KeyguardInteractor
import com.android.systemui.kosmos.testScope
import com.android.systemui.plugins.statusbar.StatusBarStateController
import com.android.systemui.res.R
import com.android.systemui.shade.ShadeExpansionChangeEvent
import com.android.systemui.shade.domain.interactor.ShadeModeInteractor
import com.android.systemui.statusbar.phone.BiometricUnlockController
import com.android.systemui.statusbar.phone.DozeParameters
import com.android.systemui.statusbar.phone.ScrimController
import com.android.systemui.statusbar.policy.FakeConfigurationController
import com.android.systemui.statusbar.policy.KeyguardStateController
import com.android.systemui.statusbar.policy.ResourcesSplitShadeStateController
import com.android.systemui.testKosmos
import com.android.systemui.util.WallpaperController
import com.android.systemui.util.mockito.eq
@@ -77,7 +75,6 @@ class NotificationShadeDepthControllerTest : SysuiTestCase() {
    private val kosmos = testKosmos()

    private val applicationScope = kosmos.testScope.backgroundScope
    @Mock private lateinit var windowRootViewBlurInteractor: WindowRootViewBlurInteractor
    @Mock private lateinit var statusBarStateController: StatusBarStateController
    @Mock private lateinit var blurUtils: BlurUtils
    @Mock private lateinit var biometricUnlockController: BiometricUnlockController
@@ -87,6 +84,8 @@ class NotificationShadeDepthControllerTest : SysuiTestCase() {
    @Mock private lateinit var wallpaperController: WallpaperController
    @Mock private lateinit var wallpaperInteractor: WallpaperInteractor
    @Mock private lateinit var notificationShadeWindowController: NotificationShadeWindowController
    @Mock private lateinit var windowRootViewBlurInteractor: WindowRootViewBlurInteractor
    @Mock private lateinit var shadeModeInteractor: ShadeModeInteractor
    @Mock private lateinit var dumpManager: DumpManager
    @Mock private lateinit var appZoomOutOptional: Optional<AppZoomOut>
    @Mock private lateinit var root: View
@@ -103,7 +102,6 @@ class NotificationShadeDepthControllerTest : SysuiTestCase() {
    private var statusBarState = StatusBarState.SHADE
    private val maxBlur = 150
    private lateinit var notificationShadeDepthController: NotificationShadeDepthController
    private val configurationController = FakeConfigurationController()

    @Before
    fun setup() {
@@ -133,13 +131,11 @@ class NotificationShadeDepthControllerTest : SysuiTestCase() {
                wallpaperInteractor,
                notificationShadeWindowController,
                dozeParameters,
                context,
                ResourcesSplitShadeStateController(),
                shadeModeInteractor,
                windowRootViewBlurInteractor,
                appZoomOutOptional,
                applicationScope,
                dumpManager,
                configurationController,
                dumpManager
            )
        notificationShadeDepthController.shadeAnimation = shadeAnimation
        notificationShadeDepthController.brightnessMirrorSpring = brightnessSpring
@@ -492,15 +488,10 @@ class NotificationShadeDepthControllerTest : SysuiTestCase() {
    }

    private fun enableSplitShade() {
        setSplitShadeEnabled(true)
        `when` (shadeModeInteractor.isSplitShade).thenReturn(true)
    }

    private fun disableSplitShade() {
        setSplitShadeEnabled(false)
    }

    private fun setSplitShadeEnabled(enabled: Boolean) {
        overrideResource(R.bool.config_use_split_notification_shade, enabled)
        configurationController.notifyConfigurationChanged()
        `when` (shadeModeInteractor.isSplitShade).thenReturn(false)
    }
}
+3 −23
Original line number Diff line number Diff line
@@ -19,8 +19,6 @@ package com.android.systemui.statusbar
import android.animation.Animator
import android.animation.AnimatorListenerAdapter
import android.animation.ValueAnimator
import android.content.Context
import android.content.res.Configuration
import android.os.SystemClock
import android.util.IndentingPrintWriter
import android.util.Log
@@ -42,16 +40,14 @@ import com.android.systemui.dagger.qualifiers.Application
import com.android.systemui.dump.DumpManager
import com.android.systemui.keyguard.domain.interactor.KeyguardInteractor
import com.android.systemui.plugins.statusbar.StatusBarStateController
import com.android.systemui.shade.ShadeDisplayAware
import com.android.systemui.shade.ShadeExpansionChangeEvent
import com.android.systemui.shade.ShadeExpansionListener
import com.android.systemui.shade.domain.interactor.ShadeModeInteractor
import com.android.systemui.statusbar.phone.BiometricUnlockController
import com.android.systemui.statusbar.phone.BiometricUnlockController.MODE_WAKE_AND_UNLOCK
import com.android.systemui.statusbar.phone.DozeParameters
import com.android.systemui.statusbar.phone.ScrimController
import com.android.systemui.statusbar.policy.ConfigurationController
import com.android.systemui.statusbar.policy.KeyguardStateController
import com.android.systemui.statusbar.policy.SplitShadeStateController
import com.android.systemui.util.WallpaperController
import com.android.systemui.wallpapers.domain.interactor.WallpaperInteractor
import com.android.systemui.window.domain.interactor.WindowRootViewBlurInteractor
@@ -82,13 +78,11 @@ constructor(
    private val wallpaperInteractor: WallpaperInteractor,
    private val notificationShadeWindowController: NotificationShadeWindowController,
    private val dozeParameters: DozeParameters,
    @ShadeDisplayAware private val context: Context,
    private val splitShadeStateController: SplitShadeStateController,
    private val shadeModeInteractor: ShadeModeInteractor,
    private val windowRootViewBlurInteractor: WindowRootViewBlurInteractor,
    private val appZoomOutOptional: Optional<AppZoomOut>,
    @Application private val applicationScope: CoroutineScope,
    dumpManager: DumpManager,
    configurationController: ConfigurationController,
) : ShadeExpansionListener, Dumpable {
    companion object {
        private const val WAKE_UP_ANIMATION_ENABLED = true
@@ -110,7 +104,6 @@ constructor(
    private var isOpen: Boolean = false
    private var isBlurred: Boolean = false
    private var listeners = mutableListOf<DepthListener>()
    private var inSplitShade: Boolean = false

    private var prevTracking: Boolean = false
    private var prevTimestamp: Long = -1
@@ -294,7 +287,7 @@ constructor(

    private fun blurRadiusToZoomOut(blurRadius: Float): Float {
        var zoomOut = MathUtils.saturate(blurUtils.ratioOfBlurRadius(blurRadius))
        if (inSplitShade) {
        if (shadeModeInteractor.isSplitShade) {
            zoomOut = 0f
        }

@@ -432,14 +425,6 @@ constructor(
        }
        shadeAnimation.setStiffness(SpringForce.STIFFNESS_LOW)
        shadeAnimation.setDampingRatio(SpringForce.DAMPING_RATIO_NO_BOUNCY)
        updateResources()
        configurationController.addCallback(
            object : ConfigurationController.ConfigurationListener {
                override fun onConfigChanged(newConfig: Configuration?) {
                    updateResources()
                }
            }
        )
        applicationScope.launch {
            wallpaperInteractor.wallpaperSupportsAmbientMode.collect { supported ->
                wallpaperSupportsAmbientMode = supported
@@ -450,7 +435,6 @@ constructor(
                }
            }
        }
        initBlurListeners()
    }

    private fun initBlurListeners() {
@@ -469,10 +453,6 @@ constructor(
        }
    }

    private fun updateResources() {
        inSplitShade = splitShadeStateController.shouldUseSplitNotificationShade(context.resources)
    }

    fun addListener(listener: DepthListener) {
        listeners.add(listener)
    }