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