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

Commit 56c7337d authored by Fabián Kozynski's avatar Fabián Kozynski
Browse files

Remove qs refactor flag from FooterActions [2/N]

Test: atest FooterActionsViewModelTest
Flag: EXEMPT FLAG_REMOVAL
Bug: 444180543
Change-Id: I4328c2dc0b2dee13133c7867fc1352a16a6bc6ac
parent a988883b
Loading
Loading
Loading
Loading
+8 −20
Original line number Diff line number Diff line
@@ -93,8 +93,6 @@ import com.android.systemui.common.shared.model.Icon
import com.android.systemui.common.ui.compose.Icon
import com.android.systemui.common.ui.compose.load
import com.android.systemui.compose.modifiers.sysuiResTag
import com.android.systemui.qs.flags.QSComposeFragment
import com.android.systemui.qs.flags.QsInCompose
import com.android.systemui.qs.footer.ui.compose.FooterActionsDefaults.FOOTER_TEXT_FADE_DURATION_MILLIS
import com.android.systemui.qs.footer.ui.compose.FooterActionsDefaults.FOOTER_TEXT_MINIMUM_SCALE_Y
import com.android.systemui.qs.footer.ui.compose.FooterActionsDefaults.FooterButtonHeight
@@ -233,7 +231,7 @@ fun FooterActions(viewModel: FooterActionsViewModel, modifier: Modifier = Modifi
        verticalAlignment = Alignment.CenterVertically,
    ) {
        CompositionLocalProvider(LocalContentColor provides contentColor) {
            val useModifierBasedExpandable = remember { QSComposeFragment.isEnabled }
            val useModifierBasedExpandable = true

            // The viewModel to show, in order of priority:
            // 1. Text feedback
@@ -531,13 +529,8 @@ private fun TextButton(
            Text(
                text,
                Modifier.weight(1f),
                style =
                    if (QsInCompose.isEnabled) {
                        MaterialTheme.typography.labelLarge
                    } else {
                        MaterialTheme.typography.bodyMedium
                    },
                letterSpacing = if (QsInCompose.isEnabled) 0.em else 0.01.em,
                style = MaterialTheme.typography.labelLarge,
                letterSpacing = 0.em,
                color = colors.content,
                maxLines = 1,
                overflow = TextOverflow.Ellipsis,
@@ -578,13 +571,8 @@ private fun TextButtonContent(
        Text(
            text,
            Modifier.weight(1f),
            style =
                if (QsInCompose.isEnabled) {
                    MaterialTheme.typography.labelLarge
                } else {
                    MaterialTheme.typography.bodyMedium
                },
            letterSpacing = if (QsInCompose.isEnabled) 0.em else 0.01.em,
            style = MaterialTheme.typography.labelLarge,
            letterSpacing = 0.em,
            color = contentColor,
            maxLines = 1,
            overflow = TextOverflow.Ellipsis,
@@ -639,7 +627,7 @@ private fun Modifier.animatedScaledHeight(scale: () -> Float): Modifier {
@Composable
@ReadOnlyComposable
private fun textButtonColors(): TextButtonColors {
    return if (QsInCompose.isEnabled && notificationShadeBlur()) {
    return if (notificationShadeBlur()) {
        FooterActionsDefaults.blurTextButtonColors()
    } else {
        FooterActionsDefaults.textButtonColors()
@@ -649,7 +637,7 @@ private fun textButtonColors(): TextButtonColors {
@Composable
@ReadOnlyComposable
private fun numberButtonColors(): TextButtonColors {
    return if (QsInCompose.isEnabled && notificationShadeBlur()) {
    return if (notificationShadeBlur()) {
        FooterActionsDefaults.blurTextButtonColors()
    } else {
        FooterActionsDefaults.numberButtonColors()
@@ -659,7 +647,7 @@ private fun numberButtonColors(): TextButtonColors {
@Composable
@ReadOnlyComposable
private fun buttonColorsForModel(footerAction: FooterActionsButtonViewModel): ButtonColors {
    return if (QsInCompose.isEnabled && notificationShadeBlur()) {
    return if (notificationShadeBlur()) {
        when (footerAction) {
            is FooterActionsButtonViewModel.PowerActionViewModel ->
                FooterActionsDefaults.activeButtonColors()
+1 −30
Original line number Diff line number Diff line
@@ -38,12 +38,9 @@ import com.android.systemui.broadcast.BroadcastDispatcher
import com.android.systemui.common.shared.model.ContentDescription
import com.android.systemui.common.shared.model.Icon
import com.android.systemui.coroutines.collectLastValue
import com.android.systemui.flags.DisableSceneContainer
import com.android.systemui.flags.EnableSceneContainer
import com.android.systemui.qs.FakeFgsManagerController
import com.android.systemui.qs.QSSecurityFooterUtils
import com.android.systemui.qs.QsEventLoggerFake
import com.android.systemui.qs.flags.QSComposeFragment
import com.android.systemui.qs.footer.FooterActionsTestUtils
import com.android.systemui.qs.footer.domain.model.SecurityButtonConfig
import com.android.systemui.qs.panels.ui.viewmodel.TextFeedbackViewModel
@@ -502,33 +499,7 @@ class FooterActionsViewModelTest : SysuiTestCase() {
    }

    @Test
    @DisableFlags(QSComposeFragment.FLAG_NAME)
    @DisableSceneContainer
    fun textFeedback_neverFeedback() = runTest {
        val qsTileConfigProvider = createAndPopulateQsTileConfigProvider()
        val textFeedbackInteractor =
            utils.textFeedbackInteractor(qsTileConfigProvider = qsTileConfigProvider)
        val underTest =
            utils.footerActionsViewModel(textFeedbackInteractor = textFeedbackInteractor)

        val textFeedback by collectLastValue(underTest.textFeedback)

        assertThat(textFeedback).isEqualTo(TextFeedbackViewModel.NoFeedback)

        textFeedbackInteractor.requestShowFeedback(AIRPLANE_MODE_TILE_SPEC)

        assertThat(textFeedback).isEqualTo(TextFeedbackViewModel.NoFeedback)
    }

    @Test
    @EnableFlags(QSComposeFragment.FLAG_NAME)
    fun textFeedback_composeFragmentEnabled() = runTest { textFeedback_newComposeUI() }

    @Test
    @EnableSceneContainer
    fun textFeedback_sceneContainerEnabled() = runTest { textFeedback_newComposeUI() }

    private fun TestScope.textFeedback_newComposeUI() {
    fun textFeedback() = runTest {
        val qsTileConfigProvider = createAndPopulateQsTileConfigProvider()
        val textFeedbackInteractor =
            utils.textFeedbackInteractor(qsTileConfigProvider = qsTileConfigProvider)
+1 −8
Original line number Diff line number Diff line
@@ -33,7 +33,6 @@ import com.android.systemui.globalactions.GlobalActionsDialogLite
import com.android.systemui.plugins.ActivityStarter
import com.android.systemui.plugins.FalsingManager
import com.android.systemui.qs.dagger.QSFlagsModule.PM_LITE_ENABLED
import com.android.systemui.qs.flags.QsInCompose
import com.android.systemui.qs.footer.data.model.UserSwitcherStatusModel
import com.android.systemui.qs.footer.domain.interactor.FooterActionsInteractor
import com.android.systemui.qs.footer.domain.model.SecurityButtonConfig
@@ -61,7 +60,6 @@ import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.flow.combine
import kotlinx.coroutines.flow.distinctUntilChanged
import kotlinx.coroutines.flow.flowOf
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.isActive

@@ -312,12 +310,7 @@ fun createFooterActionsViewModel(
            null
        }

    val textFeedback =
        if (QsInCompose.isEnabled) {
            textFeedbackInteractor.textFeedback.map { it.load(qsThemedContext) }
        } else {
            flowOf(TextFeedbackViewModel.NoFeedback)
        }
    val textFeedback = textFeedbackInteractor.textFeedback.map { it.load(qsThemedContext) }

    return FooterActionsViewModel(
        security = security,