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

Commit 6b9ac0f6 authored by Alejandro Nijamkin's avatar Alejandro Nijamkin
Browse files

[flexiglass] Removes media_in_scene_container flag dependency.

media_in_scene_container can be replaced with the scene container flag.

Bug: 283121968
Test: NA
Flag: NA
Change-Id: I932e705ed40b74b7f270b14161ca6e9ca4c8c3f1
parent 63f3c7b5
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -51,8 +51,7 @@ class MediaFlags @Inject constructor(private val featureFlags: FeatureFlagsClass
    fun isRemoteResumeAllowed() = featureFlags.isEnabled(Flags.MEDIA_REMOTE_RESUME)

    /** Check whether to use scene framework */
    fun isSceneContainerEnabled() =
        SceneContainerFlag.isEnabled && MediaInSceneContainerFlag.isEnabled
    fun isSceneContainerEnabled() = SceneContainerFlag.isEnabled

    /** Check whether to use media refactor code */
    fun isMediaControlsRefactorEnabled() = MediaControlsRefactorFlag.isEnabled
+0 −53
Original line number Diff line number Diff line
/*
 * Copyright (C) 2023 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.systemui.media.controls.util

import com.android.systemui.Flags
import com.android.systemui.flags.FlagToken
import com.android.systemui.flags.RefactorFlagUtils

/** Helper for reading or using the media_in_scene_container flag state. */
@Suppress("NOTHING_TO_INLINE")
object MediaInSceneContainerFlag {
    /** The aconfig flag name */
    const val FLAG_NAME = Flags.FLAG_MEDIA_IN_SCENE_CONTAINER

    /** A token used for dependency declaration */
    val token: FlagToken
        get() = FlagToken(FLAG_NAME, isEnabled)

    /** Is the flag enabled? */
    @JvmStatic
    inline val isEnabled
        get() = Flags.mediaInSceneContainer()

    /**
     * Called to ensure code is only run when the flag is enabled. This protects users from the
     * unintended behaviors caused by accidentally running new logic, while also crashing on an eng
     * build to ensure that the refactor author catches issues in testing.
     */
    @JvmStatic
    inline fun isUnexpectedlyInLegacyMode() =
        RefactorFlagUtils.isUnexpectedlyInLegacyMode(isEnabled, FLAG_NAME)

    /**
     * Called to ensure code is only run when the flag is disabled. This will throw an exception if
     * the flag is enabled to ensure that the refactor author catches issues in testing.
     */
    @JvmStatic
    inline fun assertInLegacyMode() = RefactorFlagUtils.assertInLegacyMode(isEnabled, FLAG_NAME)
}
+0 −3
Original line number Diff line number Diff line
@@ -27,7 +27,6 @@ import com.android.systemui.keyguard.KeyguardBottomAreaRefactor
import com.android.systemui.keyguard.KeyguardWmStateRefactor
import com.android.systemui.keyguard.MigrateClocksToBlueprint
import com.android.systemui.keyguard.shared.ComposeLockscreen
import com.android.systemui.media.controls.util.MediaInSceneContainerFlag
import com.android.systemui.statusbar.notification.shared.NotificationsHeadsUpRefactor
import com.android.systemui.statusbar.phone.PredictiveBackSysUiFlag

@@ -43,7 +42,6 @@ object SceneContainerFlag {
            ComposeLockscreen.isEnabled &&
                KeyguardBottomAreaRefactor.isEnabled &&
                KeyguardWmStateRefactor.isEnabled &&
                MediaInSceneContainerFlag.isEnabled &&
                MigrateClocksToBlueprint.isEnabled &&
                NotificationsHeadsUpRefactor.isEnabled &&
                PredictiveBackSysUiFlag.isEnabled &&
@@ -59,7 +57,6 @@ object SceneContainerFlag {
            ComposeLockscreen.token,
            KeyguardBottomAreaRefactor.token,
            KeyguardWmStateRefactor.token,
            MediaInSceneContainerFlag.token,
            MigrateClocksToBlueprint.token,
            NotificationsHeadsUpRefactor.token,
            PredictiveBackSysUiFlag.token,
+0 −2
Original line number Diff line number Diff line
@@ -21,7 +21,6 @@ import com.android.systemui.Flags.FLAG_COMPOSE_LOCKSCREEN
import com.android.systemui.Flags.FLAG_DEVICE_ENTRY_UDFPS_REFACTOR
import com.android.systemui.Flags.FLAG_KEYGUARD_BOTTOM_AREA_REFACTOR
import com.android.systemui.Flags.FLAG_KEYGUARD_WM_STATE_REFACTOR
import com.android.systemui.Flags.FLAG_MEDIA_IN_SCENE_CONTAINER
import com.android.systemui.Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT
import com.android.systemui.Flags.FLAG_NOTIFICATIONS_HEADS_UP_REFACTOR
import com.android.systemui.Flags.FLAG_PREDICTIVE_BACK_SYSUI
@@ -35,7 +34,6 @@ import com.android.systemui.Flags.FLAG_SCENE_CONTAINER
    FLAG_COMPOSE_LOCKSCREEN,
    FLAG_KEYGUARD_BOTTOM_AREA_REFACTOR,
    FLAG_KEYGUARD_WM_STATE_REFACTOR,
    FLAG_MEDIA_IN_SCENE_CONTAINER,
    FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT,
    FLAG_NOTIFICATIONS_HEADS_UP_REFACTOR,
    FLAG_PREDICTIVE_BACK_SYSUI,