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

Commit 4a86409d authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Update smartspace layout flag" into main

parents 9bcf97c4 ccbcd8f8
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -130,7 +130,7 @@ class ClockSectionTest : SysuiTestCase() {
    }

    @Test
    @DisableFlags(com.android.systemui.shared.Flags.FLAG_CLOCK_REACTIVE_VARIANTS)
    @DisableFlags(com.android.systemui.shared.Flags.FLAG_CLOCK_REACTIVE_SMARTSPACE_LAYOUT)
    fun testApplyDefaultConstraints_LargeClock_SplitShade() =
        kosmos.testScope.runTest {
            with(kosmos) {
@@ -147,7 +147,7 @@ class ClockSectionTest : SysuiTestCase() {
        }

    @Test
    @EnableFlags(com.android.systemui.shared.Flags.FLAG_CLOCK_REACTIVE_VARIANTS)
    @EnableFlags(com.android.systemui.shared.Flags.FLAG_CLOCK_REACTIVE_SMARTSPACE_LAYOUT)
    fun testApplyDefaultConstraints_LargeClock_SplitShade_ReactiveVariantsOn() =
        kosmos.testScope.runTest {
            with(kosmos) {
@@ -165,7 +165,7 @@ class ClockSectionTest : SysuiTestCase() {
        }

    @Test
    @DisableFlags(com.android.systemui.shared.Flags.FLAG_CLOCK_REACTIVE_VARIANTS)
    @DisableFlags(com.android.systemui.shared.Flags.FLAG_CLOCK_REACTIVE_SMARTSPACE_LAYOUT)
    fun testApplyDefaultConstraints_LargeClock_NonSplitShade() =
        kosmos.testScope.runTest {
            with(kosmos) {
@@ -189,7 +189,7 @@ class ClockSectionTest : SysuiTestCase() {
        }

    @Test
    @EnableFlags(com.android.systemui.shared.Flags.FLAG_CLOCK_REACTIVE_VARIANTS)
    @EnableFlags(com.android.systemui.shared.Flags.FLAG_CLOCK_REACTIVE_SMARTSPACE_LAYOUT)
    fun testApplyDefaultConstraints_LargeClock_NonSplitShade_reactiveVariantsOn() =
        kosmos.testScope.runTest {
            with(kosmos) {
@@ -262,7 +262,7 @@ class ClockSectionTest : SysuiTestCase() {
        }

    @Test
    @DisableFlags(com.android.systemui.shared.Flags.FLAG_CLOCK_REACTIVE_VARIANTS)
    @DisableFlags(com.android.systemui.shared.Flags.FLAG_CLOCK_REACTIVE_SMARTSPACE_LAYOUT)
    fun testApplyDefaultConstraints_SmallClock_SplitShade() =
        kosmos.testScope.runTest {
            with(kosmos) {
@@ -286,7 +286,7 @@ class ClockSectionTest : SysuiTestCase() {
        }

    @Test
    @EnableFlags(com.android.systemui.shared.Flags.FLAG_CLOCK_REACTIVE_VARIANTS)
    @EnableFlags(com.android.systemui.shared.Flags.FLAG_CLOCK_REACTIVE_SMARTSPACE_LAYOUT)
    fun testApplyDefaultConstraints_SmallClock_SplitShade_ReactiveVariantsOn() =
        kosmos.testScope.runTest {
            with(kosmos) {
@@ -311,7 +311,7 @@ class ClockSectionTest : SysuiTestCase() {
        }

    @Test
    @DisableFlags(com.android.systemui.shared.Flags.FLAG_CLOCK_REACTIVE_VARIANTS)
    @DisableFlags(com.android.systemui.shared.Flags.FLAG_CLOCK_REACTIVE_SMARTSPACE_LAYOUT)
    fun testApplyDefaultConstraints_SmallClock_NonSplitShade() =
        kosmos.testScope.runTest {
            with(kosmos) {
@@ -334,7 +334,7 @@ class ClockSectionTest : SysuiTestCase() {
        }

    @Test
    @EnableFlags(com.android.systemui.shared.Flags.FLAG_CLOCK_REACTIVE_VARIANTS)
    @EnableFlags(com.android.systemui.shared.Flags.FLAG_CLOCK_REACTIVE_SMARTSPACE_LAYOUT)
    fun testApplyDefaultConstraints_SmallClock_NonSplitShade_ReactiveVariantsOn() =
        kosmos.testScope.runTest {
            with(kosmos) {
+9 −9
Original line number Diff line number Diff line
@@ -50,7 +50,7 @@ import org.mockito.MockitoAnnotations

@RunWith(AndroidJUnit4::class)
@SmallTest
@DisableFlags(com.android.systemui.shared.Flags.FLAG_CLOCK_REACTIVE_VARIANTS)
@DisableFlags(com.android.systemui.shared.Flags.FLAG_CLOCK_REACTIVE_SMARTSPACE_LAYOUT)
class SmartspaceSectionTest : SysuiTestCase() {
    private lateinit var underTest: SmartspaceSection
    @Mock private lateinit var keyguardClockViewModel: KeyguardClockViewModel
@@ -102,7 +102,7 @@ class SmartspaceSectionTest : SysuiTestCase() {
    }

    @Test
    @DisableFlags(com.android.systemui.shared.Flags.FLAG_CLOCK_REACTIVE_VARIANTS)
    @DisableFlags(com.android.systemui.shared.Flags.FLAG_CLOCK_REACTIVE_SMARTSPACE_LAYOUT)
    fun testAddViews_notSmartspaceEnabled() {
        whenever(keyguardSmartspaceViewModel.isSmartspaceEnabled).thenReturn(false)
        val constraintLayout = ConstraintLayout(mContext)
@@ -113,7 +113,7 @@ class SmartspaceSectionTest : SysuiTestCase() {
    }

    @Test
    @DisableFlags(com.android.systemui.shared.Flags.FLAG_CLOCK_REACTIVE_VARIANTS)
    @DisableFlags(com.android.systemui.shared.Flags.FLAG_CLOCK_REACTIVE_SMARTSPACE_LAYOUT)
    fun testAddViews_smartspaceEnabled_dateWeatherDecoupled() {
        whenever(keyguardSmartspaceViewModel.isDateWeatherDecoupled).thenReturn(true)
        underTest.addViews(constraintLayout)
@@ -132,7 +132,7 @@ class SmartspaceSectionTest : SysuiTestCase() {
    }

    @Test
    @DisableFlags(com.android.systemui.shared.Flags.FLAG_CLOCK_REACTIVE_VARIANTS)
    @DisableFlags(com.android.systemui.shared.Flags.FLAG_CLOCK_REACTIVE_SMARTSPACE_LAYOUT)
    fun testConstraintsWhenShadeLayoutIsNotWide() {
        underTest.addViews(constraintLayout)
        underTest.applyConstraints(constraintSet)
@@ -142,7 +142,7 @@ class SmartspaceSectionTest : SysuiTestCase() {
    }

    @Test
    @DisableFlags(com.android.systemui.shared.Flags.FLAG_CLOCK_REACTIVE_VARIANTS)
    @DisableFlags(com.android.systemui.shared.Flags.FLAG_CLOCK_REACTIVE_SMARTSPACE_LAYOUT)
    fun testConstraintsWhenShadeLayoutIsWide() {
        isShadeLayoutWide.value = true

@@ -154,7 +154,7 @@ class SmartspaceSectionTest : SysuiTestCase() {
    }

    @Test
    @DisableFlags(com.android.systemui.shared.Flags.FLAG_CLOCK_REACTIVE_VARIANTS)
    @DisableFlags(com.android.systemui.shared.Flags.FLAG_CLOCK_REACTIVE_SMARTSPACE_LAYOUT)
    fun testConstraintsWhenNotHasCustomWeatherDataDisplay() {
        whenever(keyguardSmartspaceViewModel.isDateWeatherDecoupled).thenReturn(true)
        underTest.addViews(constraintLayout)
@@ -169,7 +169,7 @@ class SmartspaceSectionTest : SysuiTestCase() {
    }

    @Test
    @DisableFlags(com.android.systemui.shared.Flags.FLAG_CLOCK_REACTIVE_VARIANTS)
    @DisableFlags(com.android.systemui.shared.Flags.FLAG_CLOCK_REACTIVE_SMARTSPACE_LAYOUT)
    fun testConstraintsWhenHasCustomWeatherDataDisplay() {
        hasCustomWeatherDataDisplay.value = true
        underTest.addViews(constraintLayout)
@@ -180,7 +180,7 @@ class SmartspaceSectionTest : SysuiTestCase() {
    }

    @Test
    @DisableFlags(com.android.systemui.shared.Flags.FLAG_CLOCK_REACTIVE_VARIANTS)
    @DisableFlags(com.android.systemui.shared.Flags.FLAG_CLOCK_REACTIVE_SMARTSPACE_LAYOUT)
    fun testNormalDateWeatherVisibility() {
        isWeatherVisibleFlow.value = true
        underTest.addViews(constraintLayout)
@@ -194,7 +194,7 @@ class SmartspaceSectionTest : SysuiTestCase() {
    }

    @Test
    @DisableFlags(com.android.systemui.shared.Flags.FLAG_CLOCK_REACTIVE_VARIANTS)
    @DisableFlags(com.android.systemui.shared.Flags.FLAG_CLOCK_REACTIVE_SMARTSPACE_LAYOUT)
    fun testCustomDateWeatherVisibility() {
        hasCustomWeatherDataDisplay.value = true
        underTest.addViews(constraintLayout)
+4 −3
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import androidx.constraintlayout.widget.ConstraintSet
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.repeatOnLifecycle
import com.android.app.tracing.coroutines.launchTraced as launch
import com.android.systemui.Flags
import com.android.systemui.customization.R as customR
import com.android.systemui.keyguard.shared.model.KeyguardBlueprint
import com.android.systemui.keyguard.ui.view.layout.blueprints.transitions.IntraBlueprintTransition
@@ -81,7 +82,7 @@ object KeyguardBlueprintViewBinder {

                            logger.logConstraintSet(cs, clockViewModel)
                            cs.applyTo(constraintLayout)
                            if (com.android.systemui.shared.Flags.clockReactiveVariants()) {
                            if (com.android.systemui.shared.Flags.clockReactiveSmartspaceLayout()) {
                                manuallySetDateWeatherConstraintsOnConstraintLayout(
                                    cs,
                                    constraintLayout,
@@ -110,7 +111,7 @@ object KeyguardBlueprintViewBinder {
                                }
                            logger.logConstraintSet(cs, clockViewModel)
                            cs.applyTo(constraintLayout)
                            if (com.android.systemui.shared.Flags.clockReactiveVariants()) {
                            if (com.android.systemui.shared.Flags.clockReactiveSmartspaceLayout()) {
                                manuallySetDateWeatherConstraintsOnConstraintLayout(
                                    cs,
                                    constraintLayout,
@@ -168,7 +169,7 @@ object KeyguardBlueprintViewBinder {
            str1 = "${cs.getConstraint(smartspaceDateId).propertySet.alpha}"
        }

        if (com.android.systemui.shared.Flags.clockReactiveVariants()) {
        if (com.android.systemui.shared.Flags.clockReactiveSmartspaceLayout()) {
            this.i({ "applyCsToSmartspaceWeather: vis=${getVisText(int1)}; alpha=$str1" }) {
                val smartspaceDateId = sharedR.id.weather_smartspace_view
                int1 = cs.getVisibility(smartspaceDateId)
+1 −1
Original line number Diff line number Diff line
@@ -189,7 +189,7 @@ object KeyguardRootViewBinder {
                        viewModel.translationY.collect { y ->
                            childViews[burnInLayerId]?.translationY = y
                            childViews[largeClockId]?.translationY = y
                            if (com.android.systemui.shared.Flags.clockReactiveVariants()) {
                            if (com.android.systemui.shared.Flags.clockReactiveSmartspaceLayout()) {
                                childViews[largeClockDateId]?.translationY = y
                                childViews[largeClockWeatherId]?.translationY = y
                            }
+3 −3
Original line number Diff line number Diff line
@@ -80,7 +80,7 @@ object KeyguardSmartspaceViewBinder {
                    }
                }

                if (com.android.systemui.shared.Flags.clockReactiveVariants()) {
                if (com.android.systemui.shared.Flags.clockReactiveSmartspaceLayout()) {
                    launch("$TAG#smartspaceViewModel.burnInLayerVisibility") {
                        keyguardRootViewModel.burnInLayerVisibility.collect { visibility ->
                            if (clockViewModel.isLargeClockVisible.value) {
@@ -147,7 +147,7 @@ object KeyguardSmartspaceViewBinder {
                val dateView =
                    constraintLayout.requireViewById<View>(sharedR.id.date_smartspace_view)
                addView(dateView)
                if (com.android.systemui.shared.Flags.clockReactiveVariants()) {
                if (com.android.systemui.shared.Flags.clockReactiveSmartspaceLayout()) {
                    val weatherView =
                        constraintLayout.requireViewById<View>(sharedR.id.weather_smartspace_view)
                    addView(weatherView)
@@ -169,7 +169,7 @@ object KeyguardSmartspaceViewBinder {
                val dateView =
                    constraintLayout.requireViewById<View>(sharedR.id.date_smartspace_view)
                removeView(dateView)
                if (com.android.systemui.shared.Flags.clockReactiveVariants()) {
                if (com.android.systemui.shared.Flags.clockReactiveSmartspaceLayout()) {
                    val weatherView =
                        constraintLayout.requireViewById<View>(sharedR.id.weather_smartspace_view)
                    removeView(weatherView)
Loading