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
diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/bouncer/ui/composable/BouncerScene.kt b/packages/SystemUI/compose/features/src/com/android/systemui/bouncer/ui/composable/BouncerScene.kt
index d59f1f5..f73b6cd 100644
--- a/packages/SystemUI/compose/features/src/com/android/systemui/bouncer/ui/composable/BouncerScene.kt
+++ b/packages/SystemUI/compose/features/src/com/android/systemui/bouncer/ui/composable/BouncerScene.kt
@@ -28,6 +28,7 @@
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 @@
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 @@
BouncerContent(
viewModel,
dialogFactory,
- Modifier.element(Bouncer.Elements.Content).fillMaxSize()
+ Modifier.sysuiResTag(Bouncer.TestTags.Root)
+ .element(Bouncer.Elements.Content)
+ .fillMaxSize()
)
}
}
diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/bouncer/ui/composable/PatternBouncer.kt b/packages/SystemUI/compose/features/src/com/android/systemui/bouncer/ui/composable/PatternBouncer.kt
index 7af8408..d7e9c10 100644
--- a/packages/SystemUI/compose/features/src/com/android/systemui/bouncer/ui/composable/PatternBouncer.kt
+++ b/packages/SystemUI/compose/features/src/com/android/systemui/bouncer/ui/composable/PatternBouncer.kt
@@ -52,6 +52,7 @@
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 @@
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.
diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/section/TopAreaSection.kt b/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/section/TopAreaSection.kt
index 722032c..63c70c9 100644
--- a/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/section/TopAreaSection.kt
+++ b/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/section/TopAreaSection.kt
@@ -36,6 +36,7 @@
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 @@
}
SceneTransitionLayout(
- modifier = modifier,
+ modifier = modifier.sysuiResTag("keyguard_clock_container"),
currentScene = currentScene,
onChangeScene = {},
transitions = ClockTransition.defaultClockTransitions,
diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/shade/ui/composable/ShadeHeader.kt b/packages/SystemUI/compose/features/src/com/android/systemui/shade/ui/composable/ShadeHeader.kt
index d3b3d15..0bd38a1 100644
--- a/packages/SystemUI/compose/features/src/com/android/systemui/shade/ui/composable/ShadeHeader.kt
+++ b/packages/SystemUI/compose/features/src/com/android/systemui/shade/ui/composable/ShadeHeader.kt
@@ -63,6 +63,7 @@
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 @@
val ColorScheme.shadeHeaderText: Color
get() = Color.White
}
+
+ object TestTags {
+ const val Root = "shade_header_root"
+ }
}
@Composable
@@ -131,7 +136,7 @@
// 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 @@
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(