1 /*
2  *
3  * Copyright (C) 2022 The Android Open Source Project
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *      http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 package com.android.systemui.statusbar.notification.logging
19 
20 import android.app.Notification
21 
22 /** Describes usage of a notification. */
23 data class NotificationMemoryUsage(
24     val packageName: String,
25     val uid: Int,
26     val notificationKey: String,
27     val notification: Notification,
28     val objectUsage: NotificationObjectUsage,
29     val viewUsage: List<NotificationViewUsage>
30 )
31 
32 /**
33  * Describes current memory usage of a [android.app.Notification] object.
34  *
35  * The values are in bytes.
36  */
37 data class NotificationObjectUsage(
38     val smallIcon: Int,
39     val largeIcon: Int,
40     val extras: Int,
41     /** Style type, integer from [android.stats.sysui.NotificationEnums] */
42     val style: Int,
43     val styleIcon: Int,
44     val bigPicture: Int,
45     val extender: Int,
46     val hasCustomView: Boolean,
47 )
48 
49 enum class ViewType {
50     PUBLIC_VIEW,
51     PRIVATE_CONTRACTED_VIEW,
52     PRIVATE_EXPANDED_VIEW,
53     PRIVATE_HEADS_UP_VIEW,
54     TOTAL
55 }
56 
57 /**
58  * Describes current memory of a notification view hierarchy.
59  *
60  * The values are in bytes.
61  */
62 data class NotificationViewUsage(
63     val viewType: ViewType,
64     val smallIcon: Int,
65     val largeIcon: Int,
66     val systemIcons: Int,
67     val style: Int,
68     val customViews: Int,
69     val softwareBitmapsPenalty: Int,
70 )
71