Loading packages/SystemUI/src/com/android/systemui/flags/FlagDependencies.kt +1 −1 Original line number Diff line number Diff line Loading @@ -53,7 +53,7 @@ class FlagDependencies @Inject constructor(featureFlags: FeatureFlagsClassic, ha // SceneContainer dependencies SceneContainerFlag.getFlagDependencies().forEach { (alpha, beta) -> alpha dependsOn beta } SceneContainerFlag.getMainStaticFlag() dependsOn MIGRATE_KEYGUARD_STATUS_BAR_VIEW SceneContainerFlag.getMainAconfigFlag() dependsOn MIGRATE_KEYGUARD_STATUS_BAR_VIEW // ComposeLockscreen dependencies ComposeLockscreen.token dependsOn KeyguardBottomAreaRefactor.token Loading packages/SystemUI/src/com/android/systemui/flags/Flags.kt +0 −8 Original line number Diff line number Diff line Loading @@ -414,14 +414,6 @@ object Flags { val CLIPBOARD_SHARED_TRANSITIONS = unreleasedFlag("clipboard_shared_transitions", teamfood = true) /** * Whether the scene container (Flexiglass) is enabled. Note that SceneContainerFlags#isEnabled * should be checked and toggled together with [SCENE_CONTAINER_ENABLED] so that ProGuard can * remove unused code from our APK at compile time. */ // TODO(b/283300105): Tracking Bug @JvmField val SCENE_CONTAINER_ENABLED = false /** * Whether the compose bouncer is enabled. This ensures ProGuard can * remove unused code from our APK at compile time. Loading packages/SystemUI/src/com/android/systemui/scene/shared/flag/SceneContainerFlags.kt +3 −19 Original line number Diff line number Diff line Loading @@ -22,7 +22,6 @@ import com.android.systemui.Flags.FLAG_SCENE_CONTAINER import com.android.systemui.Flags.sceneContainer import com.android.systemui.dagger.SysUISingleton import com.android.systemui.flags.FlagToken import com.android.systemui.flags.Flags.SCENE_CONTAINER_ENABLED import com.android.systemui.flags.RefactorFlagUtils import com.android.systemui.keyguard.KeyguardBottomAreaRefactor import com.android.systemui.keyguard.KeyguardWmStateRefactor Loading @@ -40,7 +39,6 @@ object SceneContainerFlag { @JvmStatic inline val isEnabled get() = SCENE_CONTAINER_ENABLED && // mainStaticFlag sceneContainer() && // mainAconfigFlag KeyguardBottomAreaRefactor.isEnabled && MigrateClocksToBlueprint.isEnabled && Loading @@ -49,14 +47,6 @@ object SceneContainerFlag { KeyguardWmStateRefactor.isEnabled // NOTE: Changes should also be made in getSecondaryFlags and @EnableSceneContainer /** * The main static flag, SCENE_CONTAINER_ENABLED. This is an explicit static flag check that * helps with downstream optimizations (like unused code stripping) in builds where aconfig * flags are still writable. Do not remove! */ inline fun getMainStaticFlag() = FlagToken("Flags.SCENE_CONTAINER_ENABLED", SCENE_CONTAINER_ENABLED) /** The main aconfig flag. */ inline fun getMainAconfigFlag() = FlagToken(FLAG_SCENE_CONTAINER, sceneContainer()) Loading @@ -73,19 +63,13 @@ object SceneContainerFlag { /** The full set of requirements for SceneContainer */ inline fun getAllRequirements(): Sequence<FlagToken> { return sequenceOf(getMainStaticFlag(), getMainAconfigFlag()) + getSecondaryFlags() return sequenceOf(getMainAconfigFlag()) + getSecondaryFlags() } /** Return all dependencies of this flag in pairs where [Pair.first] depends on [Pair.second] */ inline fun getFlagDependencies(): Sequence<Pair<FlagToken, FlagToken>> { val mainStaticFlag = getMainStaticFlag() val mainAconfigFlag = getMainAconfigFlag() return sequence { // The static and aconfig flags should be equal; make them co-dependent yield(mainAconfigFlag to mainStaticFlag) yield(mainStaticFlag to mainAconfigFlag) // all other flags depend on the static flag for brevity } + getSecondaryFlags().map { mainStaticFlag to it } return getSecondaryFlags().map { mainAconfigFlag to it } } /** Loading packages/SystemUI/tests/utils/src/com/android/systemui/flags/SceneContainerRule.kt +2 −34 Original line number Diff line number Diff line Loading @@ -16,16 +16,14 @@ package com.android.systemui.flags import android.util.Log import com.android.systemui.scene.shared.flag.SceneContainerFlag import org.junit.Assert import org.junit.Assume import org.junit.rules.TestRule import org.junit.runner.Description import org.junit.runners.model.Statement /** * Should always be used with [SetFlagsRule] and should be ordered after it. * Should always be used with `SetFlagsRule` and should be ordered after it. * * Used to ensure tests annotated with [EnableSceneContainer] can actually get `true` from * [SceneContainerFlag.isEnabled]. Loading @@ -35,15 +33,10 @@ class SceneContainerRule : TestRule { return object : Statement() { @Throws(Throwable::class) override fun evaluate() { val initialEnabledValue = Flags.SCENE_CONTAINER_ENABLED val hasAnnotation = description?.testClass?.getAnnotation(EnableSceneContainer::class.java) != null || description?.getAnnotation(EnableSceneContainer::class.java) != null if (hasAnnotation) { Assume.assumeTrue( "Couldn't set Flags.SCENE_CONTAINER_ENABLED for @EnableSceneContainer test", trySetSceneContainerEnabled(true) ) Assert.assertTrue( "SceneContainerFlag.isEnabled is false:" + "\n * Did you forget to add a new aconfig flag dependency in" + Loading @@ -52,32 +45,7 @@ class SceneContainerRule : TestRule { SceneContainerFlag.isEnabled ) } try { base?.evaluate() } finally { if (hasAnnotation) { trySetSceneContainerEnabled(initialEnabledValue) } } } } } companion object { fun trySetSceneContainerEnabled(enabled: Boolean): Boolean { if (Flags.SCENE_CONTAINER_ENABLED == enabled) { return true } return try { // TODO(b/283300105): remove this reflection setting once the hard-coded // Flags.SCENE_CONTAINER_ENABLED is no longer needed. val field = Flags::class.java.getField("SCENE_CONTAINER_ENABLED") field.isAccessible = true field.set(null, enabled) // note: this does not work with multivalent tests true } catch (t: Throwable) { Log.e("SceneContainerRule", "Unable to set SCENE_CONTAINER_ENABLED=$enabled", t) false } } } Loading Loading
packages/SystemUI/src/com/android/systemui/flags/FlagDependencies.kt +1 −1 Original line number Diff line number Diff line Loading @@ -53,7 +53,7 @@ class FlagDependencies @Inject constructor(featureFlags: FeatureFlagsClassic, ha // SceneContainer dependencies SceneContainerFlag.getFlagDependencies().forEach { (alpha, beta) -> alpha dependsOn beta } SceneContainerFlag.getMainStaticFlag() dependsOn MIGRATE_KEYGUARD_STATUS_BAR_VIEW SceneContainerFlag.getMainAconfigFlag() dependsOn MIGRATE_KEYGUARD_STATUS_BAR_VIEW // ComposeLockscreen dependencies ComposeLockscreen.token dependsOn KeyguardBottomAreaRefactor.token Loading
packages/SystemUI/src/com/android/systemui/flags/Flags.kt +0 −8 Original line number Diff line number Diff line Loading @@ -414,14 +414,6 @@ object Flags { val CLIPBOARD_SHARED_TRANSITIONS = unreleasedFlag("clipboard_shared_transitions", teamfood = true) /** * Whether the scene container (Flexiglass) is enabled. Note that SceneContainerFlags#isEnabled * should be checked and toggled together with [SCENE_CONTAINER_ENABLED] so that ProGuard can * remove unused code from our APK at compile time. */ // TODO(b/283300105): Tracking Bug @JvmField val SCENE_CONTAINER_ENABLED = false /** * Whether the compose bouncer is enabled. This ensures ProGuard can * remove unused code from our APK at compile time. Loading
packages/SystemUI/src/com/android/systemui/scene/shared/flag/SceneContainerFlags.kt +3 −19 Original line number Diff line number Diff line Loading @@ -22,7 +22,6 @@ import com.android.systemui.Flags.FLAG_SCENE_CONTAINER import com.android.systemui.Flags.sceneContainer import com.android.systemui.dagger.SysUISingleton import com.android.systemui.flags.FlagToken import com.android.systemui.flags.Flags.SCENE_CONTAINER_ENABLED import com.android.systemui.flags.RefactorFlagUtils import com.android.systemui.keyguard.KeyguardBottomAreaRefactor import com.android.systemui.keyguard.KeyguardWmStateRefactor Loading @@ -40,7 +39,6 @@ object SceneContainerFlag { @JvmStatic inline val isEnabled get() = SCENE_CONTAINER_ENABLED && // mainStaticFlag sceneContainer() && // mainAconfigFlag KeyguardBottomAreaRefactor.isEnabled && MigrateClocksToBlueprint.isEnabled && Loading @@ -49,14 +47,6 @@ object SceneContainerFlag { KeyguardWmStateRefactor.isEnabled // NOTE: Changes should also be made in getSecondaryFlags and @EnableSceneContainer /** * The main static flag, SCENE_CONTAINER_ENABLED. This is an explicit static flag check that * helps with downstream optimizations (like unused code stripping) in builds where aconfig * flags are still writable. Do not remove! */ inline fun getMainStaticFlag() = FlagToken("Flags.SCENE_CONTAINER_ENABLED", SCENE_CONTAINER_ENABLED) /** The main aconfig flag. */ inline fun getMainAconfigFlag() = FlagToken(FLAG_SCENE_CONTAINER, sceneContainer()) Loading @@ -73,19 +63,13 @@ object SceneContainerFlag { /** The full set of requirements for SceneContainer */ inline fun getAllRequirements(): Sequence<FlagToken> { return sequenceOf(getMainStaticFlag(), getMainAconfigFlag()) + getSecondaryFlags() return sequenceOf(getMainAconfigFlag()) + getSecondaryFlags() } /** Return all dependencies of this flag in pairs where [Pair.first] depends on [Pair.second] */ inline fun getFlagDependencies(): Sequence<Pair<FlagToken, FlagToken>> { val mainStaticFlag = getMainStaticFlag() val mainAconfigFlag = getMainAconfigFlag() return sequence { // The static and aconfig flags should be equal; make them co-dependent yield(mainAconfigFlag to mainStaticFlag) yield(mainStaticFlag to mainAconfigFlag) // all other flags depend on the static flag for brevity } + getSecondaryFlags().map { mainStaticFlag to it } return getSecondaryFlags().map { mainAconfigFlag to it } } /** Loading
packages/SystemUI/tests/utils/src/com/android/systemui/flags/SceneContainerRule.kt +2 −34 Original line number Diff line number Diff line Loading @@ -16,16 +16,14 @@ package com.android.systemui.flags import android.util.Log import com.android.systemui.scene.shared.flag.SceneContainerFlag import org.junit.Assert import org.junit.Assume import org.junit.rules.TestRule import org.junit.runner.Description import org.junit.runners.model.Statement /** * Should always be used with [SetFlagsRule] and should be ordered after it. * Should always be used with `SetFlagsRule` and should be ordered after it. * * Used to ensure tests annotated with [EnableSceneContainer] can actually get `true` from * [SceneContainerFlag.isEnabled]. Loading @@ -35,15 +33,10 @@ class SceneContainerRule : TestRule { return object : Statement() { @Throws(Throwable::class) override fun evaluate() { val initialEnabledValue = Flags.SCENE_CONTAINER_ENABLED val hasAnnotation = description?.testClass?.getAnnotation(EnableSceneContainer::class.java) != null || description?.getAnnotation(EnableSceneContainer::class.java) != null if (hasAnnotation) { Assume.assumeTrue( "Couldn't set Flags.SCENE_CONTAINER_ENABLED for @EnableSceneContainer test", trySetSceneContainerEnabled(true) ) Assert.assertTrue( "SceneContainerFlag.isEnabled is false:" + "\n * Did you forget to add a new aconfig flag dependency in" + Loading @@ -52,32 +45,7 @@ class SceneContainerRule : TestRule { SceneContainerFlag.isEnabled ) } try { base?.evaluate() } finally { if (hasAnnotation) { trySetSceneContainerEnabled(initialEnabledValue) } } } } } companion object { fun trySetSceneContainerEnabled(enabled: Boolean): Boolean { if (Flags.SCENE_CONTAINER_ENABLED == enabled) { return true } return try { // TODO(b/283300105): remove this reflection setting once the hard-coded // Flags.SCENE_CONTAINER_ENABLED is no longer needed. val field = Flags::class.java.getField("SCENE_CONTAINER_ENABLED") field.isAccessible = true field.set(null, enabled) // note: this does not work with multivalent tests true } catch (t: Throwable) { Log.e("SceneContainerRule", "Unable to set SCENE_CONTAINER_ENABLED=$enabled", t) false } } } Loading