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.logging;
18 
19 import com.android.systemui.shared.system.SysUiStatsLog;
20 import com.android.systemui.statusbar.notification.collection.NotificationEntry;
21 import com.android.systemui.statusbar.notification.logging.nano.Notifications;
22 
23 import com.google.protobuf.nano.MessageNano;
24 
25 import java.util.List;
26 
27 /**
28  * Normal implementation of NotificationPanelLogger.
29  */
30 public class NotificationPanelLoggerImpl implements NotificationPanelLogger {
31     @Override
logPanelShown(boolean isLockscreen, List<NotificationEntry> visibleNotifications)32     public void logPanelShown(boolean isLockscreen,
33             List<NotificationEntry> visibleNotifications) {
34         final Notifications.NotificationList proto = NotificationPanelLogger.toNotificationProto(
35                 visibleNotifications);
36         SysUiStatsLog.write(SysUiStatsLog.NOTIFICATION_PANEL_REPORTED,
37                 /* int event_id */ NotificationPanelEvent.fromLockscreen(isLockscreen).getId(),
38                 /* int num_notifications*/ proto.notifications.length,
39                 /* byte[] notifications*/ MessageNano.toByteArray(proto));
40     }
41 }
42