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

Commit e03c410b authored by Ale Nijamkin's avatar Ale Nijamkin
Browse files

[flexiglass] Introduces forced disablement of Flexi by variants

This will be used by AAOS to turn things off.

Bug: 428975753
Test: built and ran System UI with Flexiglass on, on phone, from
sysui-studio without an issue; temporarily set
SceneContainerFlag.isEnabledOnVariant to false in SystemUIApplication's
constructor and proved that it cannot be turned on by turning on the aconfig flag.
Flag: com.android.systemui.scene_container

Change-Id: I24a714d300c26b9faa5c27bc1b867f4478dd30dd
parent 7db2acc3
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -198,6 +198,7 @@ constructor(
            printSection("SceneContainerFlag") {
                printSection("Framework availability") {
                    println("isEnabled", SceneContainerFlag.isEnabled)
                    println("isEnabledOnVariant", SceneContainerFlag.isEnabledOnVariant)
                }

                if (!SceneContainerFlag.isEnabled) {
+12 −1
Original line number Diff line number Diff line
@@ -26,10 +26,21 @@ object SceneContainerFlag {
    /** The flag description -- not an aconfig flag name */
    const val DESCRIPTION = "SceneContainerFlag"

    /**
     * Whether the flag is enabled on the current variant. If this is set to `false`, then it the
     * value of the actual aconfig flag doesn't matter and [isEnabled] will always return `false`.
     *
     * Some variants of System UI, for example Automotive OS, do not support the scene container
     * framework. In order for that variant to be able to force it off, this property must be set to
     * `false` as early as possible in the runtime of the app (ideally, in the constructor the
     * Application class).
     */
    @JvmField var isEnabledOnVariant: Boolean = true

    @JvmStatic
    inline val isEnabled
        // NOTE: Changes should also be made in @EnableSceneContainer
        get() = sceneContainer()
        get() = sceneContainer() && isEnabledOnVariant

    /**
     * Called to ensure code is only run when the flag is enabled. This protects users from the