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

Commit 3992320a authored by Fabián Kozynski's avatar Fabián Kozynski
Browse files

Create flag for QSFragmentCompose

And set its dependency on the general ui refactor flag.

Test: build
Fixes: 353254228
Flag: com.android.systemui.qs_ui_refactor_compose_fragment

Change-Id: I31bb32518dc7cc8d293c3d7ac30b1101b9ca1495
parent f8b905cd
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -869,6 +869,13 @@ flag {
    bug: "325099249"
}

flag {
    name: "qs_ui_refactor_compose_fragment"
    namespace: "systemui"
    description: "Uses a different QS fragment in NPVC that uses the new compose UI and recommended architecture. This flag depends on qs_ui_refactor flag."
    bug: "325099249"
}

flag {
  name: "remove_dream_overlay_hide_on_touch"
  namespace: "systemui"
+8 −0
Original line number Diff line number Diff line
@@ -28,6 +28,8 @@ import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.keyguard.KeyguardBottomAreaRefactor
import com.android.systemui.keyguard.MigrateClocksToBlueprint
import com.android.systemui.keyguard.shared.ComposeLockscreen
import com.android.systemui.qs.flags.NewQsUI
import com.android.systemui.qs.flags.QSComposeFragment
import com.android.systemui.scene.shared.flag.SceneContainerFlag
import com.android.systemui.shade.shared.flag.DualShade
import com.android.systemui.statusbar.notification.collection.SortBySectionTimeFlag
@@ -66,14 +68,20 @@ class FlagDependencies @Inject constructor(featureFlags: FeatureFlagsClassic, ha

        // DualShade dependencies
        DualShade.token dependsOn SceneContainerFlag.getMainAconfigFlag()

        // QS Fragment using Compose dependencies
        QSComposeFragment.token dependsOn NewQsUI.token
    }

    private inline val politeNotifications
        get() = FlagToken(FLAG_POLITE_NOTIFICATIONS, politeNotifications())

    private inline val crossAppPoliteNotifications
        get() = FlagToken(FLAG_CROSS_APP_POLITE_NOTIFICATIONS, crossAppPoliteNotifications())

    private inline val vibrateWhileUnlockedToken: FlagToken
        get() = FlagToken(FLAG_VIBRATE_WHILE_UNLOCKED, vibrateWhileUnlocked())

    private inline val communalHub
        get() = FlagToken(FLAG_COMMUNAL_HUB, communalHub())
}
+1 −1
Original line number Diff line number Diff line
@@ -20,7 +20,7 @@ import com.android.systemui.Flags
import com.android.systemui.flags.FlagToken
import com.android.systemui.flags.RefactorFlagUtils

/** Helper for reading or using the notification avalanche suppression flag state. */
/** Helper for reading or using the new QS UI flag state. */
@Suppress("NOTHING_TO_INLINE")
object NewQsUI {
    /** The aconfig flag name */
+53 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2024 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.qs.flags

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

/** Helper for reading or using the new QS UI in NPVC flag state. */
@Suppress("NOTHING_TO_INLINE")
object QSComposeFragment {
    /** The aconfig flag name */
    const val FLAG_NAME = Flags.FLAG_QS_UI_REFACTOR_COMPOSE_FRAGMENT

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

    /** Is the refactor enabled */
    @JvmStatic
    inline val isEnabled
        get() = Flags.qsUiRefactorComposeFragment() && NewQsUI.isEnabled

    /**
     * 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)
}