• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.chips.ui.model
18 
19 /** Models multiple active ongoing activity chips at once. */
20 data class MultipleOngoingActivityChipsModel(
21     /**
22      * The chips with a currently ongoing activity which are eligible to be shown, sorted by
23      * priority. These can be either shown or hidden, depending on other system states like which
24      * apps are open and ongoing transitions. If this list contains the maximum number of active and
25      * not-hidden chips allowed, any other lower priority active chip will be hidden and stored in
26      * [overflow].
27      */
28     val active: List<OngoingActivityChipModel.Active> = emptyList(),
29     /**
30      * The chips with a currently ongoing activity that have strictly lower priority than those in
31      * [active] and cannot be displayed, sorted by priority. These will *always* be hidden.
32      */
33     val overflow: List<OngoingActivityChipModel.Active> = emptyList(),
34     /**
35      * The chips with no currently ongoing activity, sorted by priority. These will *always* be
36      * hidden.
37      */
38     val inactive: List<OngoingActivityChipModel.Inactive> = emptyList(),
39 )
40 
41 /** Models multiple active ongoing activity chips at once. */
42 @Deprecated("Since StatusBarChipsModernization, use the new MultipleOngoingActivityChipsModel")
43 data class MultipleOngoingActivityChipsModelLegacy(
44     /** The primary chip to show. This will *always* be shown. */
45     val primary: OngoingActivityChipModel = OngoingActivityChipModel.Inactive(),
46     /**
47      * The secondary chip to show. If there's not enough room in the status bar, this chip will
48      * *not* be shown.
49      */
50     val secondary: OngoingActivityChipModel = OngoingActivityChipModel.Inactive(),
51 ) {
52     init {
53         if (
54             primary is OngoingActivityChipModel.Inactive &&
55                 secondary is OngoingActivityChipModel.Active
56         ) {
57             throw IllegalArgumentException("`secondary` cannot be Active if `primary` is Inactive")
58         }
59     }
60 }
61