1 /* 2 * Copyright (C) 2020 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.collection 18 19 import com.android.systemui.statusbar.notification.collection.listbuilder.NotifSection 20 21 /** 22 * Stores the suppressed state that [ShadeListBuilder] assigned to this [ListEntry] before the 23 * VisualStabilityManager suppressed group and section changes. 24 */ 25 data class SuppressedAttachState private constructor( 26 /** 27 * The suppressed section assignment for this ListEntry. 28 * Null if no section change was suppressed. 29 */ 30 var section: NotifSection?, 31 32 /** 33 * The suppressed parent assignment for this ListEntry. 34 * - Null if no parent change was suppressed. 35 * - Root if suppressing group change to top-level 36 * - GroupEntry if suppressing group change to a different group 37 */ 38 var parent: GroupEntry?, 39 40 /** 41 * Whether the ListEntry would have been pruned had its group change not been suppressed. 42 */ 43 var wasPruneSuppressed: Boolean 44 ) { 45 46 /** Copies the state of another instance. */ 47 fun clone(other: SuppressedAttachState) { 48 parent = other.parent 49 section = other.section 50 wasPruneSuppressed = other.wasPruneSuppressed 51 } 52 53 /** Resets back to a "clean" state (the same as created by the factory method) */ 54 fun reset() { 55 parent = null 56 section = null 57 wasPruneSuppressed = false 58 } 59 60 companion object { 61 @JvmStatic 62 fun create(): SuppressedAttachState { 63 return SuppressedAttachState( 64 null, 65 null, 66 false) 67 } 68 } 69 } 70