• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2021 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.temporarydisplay
18 
19 /**
20  * A superclass view state used with [TemporaryViewDisplayController].
21  */
22 abstract class TemporaryViewInfo {
23     /**
24      * The title to use for the window that displays the temporary view. Should be normally cased,
25      * like "Window Title".
26      */
27     abstract val windowTitle: String
28 
29     /**
30      * A string used for logging if we needed to wake the screen in order to display the temporary
31      * view. Should be screaming snake cased, like WAKE_REASON.
32      */
33     abstract val wakeReason: String
34 
35     /**
36      * The amount of time the given view state should display on the screen before it times out and
37      * disappears.
38      */
39     open val timeoutMs: Int = DEFAULT_TIMEOUT_MILLIS
40 
41     /**
42      * The id of the temporary view.
43      */
44     abstract val id: String
45 
46     /** The priority for this view. */
47     abstract val priority: ViewPriority
48 }
49 
50 const val DEFAULT_TIMEOUT_MILLIS = 10000
51 
52 /**
53  * The priority of the view being displayed.
54  *
55  * Must be ordered from lowest priority to highest priority. (CRITICAL is currently the highest
56  * priority.)
57  */
58 enum class ViewPriority {
59     NORMAL,
60     CRITICAL,
61 }
62