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

Commit 2cd504b3 authored by Justin Weir's avatar Justin Weir
Browse files

Add support for isEnabledOnVariant

Bug: 430065190
Test: reproduced failure then verified fix
Flag: com.android.systemui.scene_container
Change-Id: I92affe93fc76a6e6341a74c0520c804261db6902
parent 8407fbe4
Loading
Loading
Loading
Loading
+14 −13
Original line number Diff line number Diff line
@@ -40,22 +40,23 @@ class SceneContainerRule : TestRule {
                            "\n * Did you forget to add a new aconfig flag dependency in" +
                            " @EnableSceneContainer?" +
                            "\n * Did you forget to use SetFlagsRule with an earlier order?",
                        SceneContainerFlag.isEnabled
                        SceneContainerFlag.isEnabled,
                    )
                }
                // Get the flag value, treating the unset error as false.
                val sceneContainerAconfigEnabled = try {
                val sceneContainerAconfigEnabled =
                    try {
                        com.android.systemui.Flags.sceneContainer()
                    } catch (e: Exception) {
                        false
                    }
                if (sceneContainerAconfigEnabled) {
                if (sceneContainerAconfigEnabled && SceneContainerFlag.isEnabledOnVariant) {
                    Assert.assertTrue(
                        "FLAG_SCENE_CONTAINER is enabled but SceneContainerFlag.isEnabled" +
                            " is false.  Use `.andSceneContainer()` from" +
                            " SceneContainerFlagParameterization.kt to parameterize this" +
                            " flag correctly.",
                            SceneContainerFlag.isEnabled
                        SceneContainerFlag.isEnabled,
                    )
                }
                if (
@@ -67,7 +68,7 @@ class SceneContainerRule : TestRule {
                            if (exception is AssumptionViolatedException) {
                                throw AssertionError(
                                    "This is marked @BrokenWithSceneContainer, but was skipped.",
                                    exception
                                    exception,
                                )
                            }
                            throw AssumptionViolatedException("Test is still broken", exception)