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.wm.shell.shared.bubbles
18 
19 import android.graphics.drawable.Icon
20 import android.os.Parcel
21 import android.os.Parcelable
22 
23 /** The contents of the flyout message to be passed to launcher for rendering in the bubble bar. */
24 class ParcelableFlyoutMessage(
25     val icon: Icon?,
26     val title: String?,
27     val message: String?,
28 ) : Parcelable {
29 
30     constructor(
31         parcel: Parcel
32     ) : this(
33         icon = parcel.readParcelable(Icon::class.java.classLoader),
34         title = parcel.readString(),
35         message = parcel.readString(),
36     )
37 
writeToParcelnull38     override fun writeToParcel(parcel: Parcel, flags: Int) {
39         parcel.writeParcelable(icon, flags)
40         parcel.writeString(title)
41         parcel.writeString(message)
42     }
43 
describeContentsnull44     override fun describeContents() = 0
45 
46     companion object {
47         @JvmField
48         val CREATOR =
49             object : Parcelable.Creator<ParcelableFlyoutMessage> {
50                 override fun createFromParcel(parcel: Parcel) = ParcelableFlyoutMessage(parcel)
51 
52                 override fun newArray(size: Int) = arrayOfNulls<ParcelableFlyoutMessage>(size)
53             }
54     }
55 }
56