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

Commit c9ab234b authored by Hawkwood's avatar Hawkwood
Browse files

Use correct lockscreen smartspace controller mock

Bug: 411475182
Flag: TEST_ONLY
Test: atest DefaultClockScreenshotTest
Change-Id: I496f443c79b88965805ca357111f69e79f55c3bf
parent f0349244
Loading
Loading
Loading
Loading
+3 −6
Original line number Diff line number Diff line
@@ -175,8 +175,7 @@ object KeyguardSmartspaceViewBinder {
        clockViewModel: KeyguardClockViewModel,
    ) {
        // Visibility is controlled by updateTargetVisibility in CardPagerAdapter
        val burnInLayer = keyguardRootView.requireViewById<Layer>(R.id.burn_in_layer)
        burnInLayer.apply {
        keyguardRootView.findViewById<Layer>(R.id.burn_in_layer)?.apply {
            val smartspaceView =
                keyguardRootView.requireViewById<View>(sharedR.id.bc_smartspace_view)
            if (smartspaceView.visibility == View.VISIBLE) {
@@ -205,8 +204,7 @@ object KeyguardSmartspaceViewBinder {
        constraintLayout: ConstraintLayout,
        smartspaceViewModel: KeyguardSmartspaceViewModel,
    ) {
        val burnInLayer = constraintLayout.requireViewById<Layer>(R.id.burn_in_layer)
        burnInLayer.apply {
        constraintLayout.findViewById<Layer>(R.id.burn_in_layer)?.apply {
            if (
                smartspaceViewModel.isSmartspaceEnabled &&
                    smartspaceViewModel.isDateWeatherDecoupled
@@ -222,8 +220,7 @@ object KeyguardSmartspaceViewBinder {
        constraintLayout: ConstraintLayout,
        smartspaceViewModel: KeyguardSmartspaceViewModel,
    ) {
        val burnInLayer = constraintLayout.requireViewById<Layer>(R.id.burn_in_layer)
        burnInLayer.apply {
        constraintLayout.findViewById<Layer>(R.id.burn_in_layer)?.apply {
            if (
                smartspaceViewModel.isSmartspaceEnabled &&
                    smartspaceViewModel.isDateWeatherDecoupled
+3 −1
Original line number Diff line number Diff line
@@ -207,7 +207,9 @@ constructor(
                    configurationInteractor.configurationValues,
                ) { hasCustomWeatherDataDisplay, isShadeLayoutWide, configurationValues ->
                    var fallBelow = false
                    if (hasCustomWeatherDataDisplay) return@combine true
                    if (hasCustomWeatherDataDisplay) {
                        return@combine true
                    }

                    val screenWidthDp = configurationValues.screenWidthDp

+2 −2
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow

class FakeKeyguardClockRepository() : KeyguardClockRepository {

    private val _clockSize = MutableStateFlow(ClockSize.LARGE)
    override val clockSize: StateFlow<ClockSize> = _clockSize

@@ -42,8 +43,7 @@ class FakeKeyguardClockRepository() : KeyguardClockRepository {
    private val _currentClock: MutableStateFlow<ClockController?> = MutableStateFlow(null)
    override val currentClock = _currentClock

    override val clockEventController: ClockEventController
        get() = mock()
    override val clockEventController: ClockEventController = mock()

    override val shouldForceSmallClock: Boolean
        get() = _shouldForceSmallClock
+15 −1
Original line number Diff line number Diff line
@@ -18,8 +18,10 @@ package com.android.systemui.keyguard.data.repository

import android.content.applicationContext
import android.os.fakeExecutorHandler
import com.android.keyguard.keyguardUnlockAnimationController
import com.android.systemui.keyguard.domain.interactor.keyguardBlueprintInteractor
import com.android.systemui.keyguard.domain.interactor.keyguardClockInteractor
import com.android.systemui.keyguard.domain.interactor.keyguardSmartspaceInteractor
import com.android.systemui.keyguard.ui.view.layout.blueprints.DefaultKeyguardBlueprint
import com.android.systemui.keyguard.ui.view.layout.blueprints.SplitShadeKeyguardBlueprint
import com.android.systemui.keyguard.ui.view.layout.sections.ClockSection
@@ -31,6 +33,7 @@ import com.android.systemui.keyguard.ui.viewmodel.keyguardSmartspaceViewModel
import com.android.systemui.kosmos.Kosmos
import com.android.systemui.log.logcatLogBuffer
import com.android.systemui.shade.LargeScreenHeaderHelper
import com.android.systemui.statusbar.lockscreen.lockscreenSmartspaceController
import java.util.Optional
import org.mockito.Mockito.spy
import org.mockito.kotlin.mock
@@ -50,7 +53,18 @@ val Kosmos.keyguardClockSection: ClockSection by
    }

val Kosmos.keyguardSmartspaceSection: SmartspaceSection by
    Kosmos.Fixture { mock<SmartspaceSection>() }
    Kosmos.Fixture {
        SmartspaceSection(
            context = applicationContext,
            keyguardClockViewModel = keyguardClockViewModel,
            keyguardSmartspaceViewModel = keyguardSmartspaceViewModel,
            keyguardSmartspaceInteractor = keyguardSmartspaceInteractor,
            smartspaceController = lockscreenSmartspaceController,
            keyguardUnlockAnimationController = keyguardUnlockAnimationController,
            blueprintInteractor = { keyguardBlueprintInteractor },
            keyguardRootViewModel = keyguardRootViewModel,
        )
    }

val Kosmos.defaultKeyguardBlueprint by
    Kosmos.Fixture {
+2 −0
Original line number Diff line number Diff line
@@ -21,3 +21,5 @@ import com.android.systemui.kosmos.Kosmos
val Kosmos.keyguardClockRepository: KeyguardClockRepository by
    Kosmos.Fixture { fakeKeyguardClockRepository }
val Kosmos.fakeKeyguardClockRepository by Kosmos.Fixture { FakeKeyguardClockRepository() }
val Kosmos.clockEventController by
    Kosmos.Fixture { fakeKeyguardClockRepository.clockEventController }
Loading