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

Commit d13d4354 authored by Justin Weir's avatar Justin Weir
Browse files

Add partial TAPL support for Scene Container

This is the first in a series of CLs that will make Platform Scenario
Tests pass with the scene container flag enabled. The approach is to
add test tags to composables and update TAPL lookups to use those IDs
when the scene container flag is enabled.

Bug: 338267587
Test: made NotificationRemoteInput.remoteInputUpdate pass locally
Flag: ACONFIG com.android.systemui.scene_container DEVELOPMENT
Change-Id: I0e9360f16932730375374cea6505ca192dd2dea2
parent daad29b0
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ import com.android.compose.animation.scene.UserAction
import com.android.compose.animation.scene.UserActionResult
import com.android.systemui.bouncer.ui.BouncerDialogFactory
import com.android.systemui.bouncer.ui.viewmodel.BouncerViewModel
import com.android.systemui.compose.modifiers.sysuiResTag
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.scene.shared.model.Scenes
import com.android.systemui.scene.ui.composable.ComposableScene
@@ -39,6 +40,10 @@ object Bouncer {
        val Background = ElementKey("BouncerBackground")
        val Content = ElementKey("BouncerContent")
    }

    object TestTags {
        const val Root = "bouncer_root"
    }
}

/** The bouncer scene displays authentication challenges like PIN, password, or pattern. */
@@ -78,7 +83,9 @@ private fun SceneScope.BouncerScene(
        BouncerContent(
            viewModel,
            dialogFactory,
            Modifier.element(Bouncer.Elements.Content).fillMaxSize()
            Modifier.sysuiResTag(Bouncer.TestTags.Root)
                .element(Bouncer.Elements.Content)
                .fillMaxSize()
        )
    }
}
+2 −0
Original line number Diff line number Diff line
@@ -52,6 +52,7 @@ import com.android.compose.modifiers.thenIf
import com.android.internal.R
import com.android.systemui.bouncer.ui.viewmodel.PatternBouncerViewModel
import com.android.systemui.bouncer.ui.viewmodel.PatternDotViewModel
import com.android.systemui.compose.modifiers.sysuiResTag
import kotlin.math.min
import kotlin.math.pow
import kotlin.math.sqrt
@@ -234,6 +235,7 @@ internal fun PatternBouncer(

    Canvas(
        modifier
            .sysuiResTag("bouncer_pattern_root")
            // Because the width also includes spacing to the left and right of the leftmost and
            // rightmost dots in the grid and because UX mocks specify the width without that
            // spacing, the actual width needs to be defined slightly bigger than the UX mock width.
+2 −1
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ import androidx.compose.ui.unit.IntOffset
import com.android.compose.animation.scene.SceneScope
import com.android.compose.animation.scene.SceneTransitionLayout
import com.android.compose.modifiers.thenIf
import com.android.systemui.compose.modifiers.sysuiResTag
import com.android.systemui.keyguard.domain.interactor.KeyguardClockInteractor
import com.android.systemui.keyguard.ui.composable.blueprint.ClockScenes.largeClockScene
import com.android.systemui.keyguard.ui.composable.blueprint.ClockScenes.smallClockScene
@@ -79,7 +80,7 @@ constructor(
            }

        SceneTransitionLayout(
            modifier = modifier,
            modifier = modifier.sysuiResTag("keyguard_clock_container"),
            currentScene = currentScene,
            onChangeScene = {},
            transitions = ClockTransition.defaultClockTransitions,
+7 −2
Original line number Diff line number Diff line
@@ -63,6 +63,7 @@ import com.android.systemui.battery.BatteryMeterView
import com.android.systemui.battery.BatteryMeterViewController
import com.android.systemui.common.ui.compose.windowinsets.CutoutLocation
import com.android.systemui.common.ui.compose.windowinsets.LocalDisplayCutout
import com.android.systemui.compose.modifiers.sysuiResTag
import com.android.systemui.privacy.OngoingPrivacyChip
import com.android.systemui.res.R
import com.android.systemui.scene.shared.model.Scenes
@@ -100,6 +101,10 @@ object ShadeHeader {
        val ColorScheme.shadeHeaderText: Color
            get() = Color.White
    }

    object TestTags {
        const val Root = "shade_header_root"
    }
}

@Composable
@@ -131,7 +136,7 @@ fun SceneScope.CollapsedShadeHeader(
    // This layout assumes it is globally positioned at (0, 0) and is the
    // same size as the screen.
    Layout(
        modifier = modifier,
        modifier = modifier.sysuiResTag(ShadeHeader.TestTags.Root),
        contents =
            listOf(
                {
@@ -261,7 +266,7 @@ fun SceneScope.ExpandedShadeHeader(

    val isPrivacyChipVisible by viewModel.isPrivacyChipVisible.collectAsState()

    Box(modifier = modifier) {
    Box(modifier = modifier.sysuiResTag(ShadeHeader.TestTags.Root)) {
        if (isPrivacyChipVisible) {
            Box(modifier = Modifier.height(CollapsedHeight).fillMaxWidth()) {
                PrivacyChip(