1 /*
2  * Copyright (C) 2024 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.systemui.statusbar.notification.shared
18 
19 import com.android.systemui.flags.FlagToken
20 
21 /** Helper for reading or using the heads-up cycling flag state. */
22 @Suppress("NOTHING_TO_INLINE")
23 object NotificationHeadsUpCycling {
24     /** The aconfig flag name */
25     const val FLAG_NAME = NotificationThrottleHun.FLAG_NAME
26 
27     /** A token used for dependency declaration */
28     val token: FlagToken
29         get() = NotificationThrottleHun.token
30 
31     /** Is the heads-up cycling animation enabled */
32     @JvmStatic
33     inline val isEnabled
34         get() = NotificationThrottleHun.isEnabled
35 
36     /** Whether to animate the bottom line when transiting from a tall HUN to a short HUN */
37     @JvmStatic
38     inline val animateTallToShort
39         get() = false
40 
41     /**
42      * Called to ensure code is only run when the flag is enabled. This protects users from the
43      * unintended behaviors caused by accidentally running new logic, while also crashing on an eng
44      * build to ensure that the refactor author catches issues in testing.
45      */
46     @JvmStatic
isUnexpectedlyInLegacyModenull47     inline fun isUnexpectedlyInLegacyMode() = NotificationThrottleHun.isUnexpectedlyInLegacyMode()
48 
49     /**
50      * Called to ensure code is only run when the flag is disabled. This will throw an exception if
51      * the flag is enabled to ensure that the refactor author catches issues in testing.
52      */
53     @JvmStatic
54     inline fun assertInLegacyMode() = NotificationThrottleHun.assertInLegacyMode()
55 }
56