• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2022 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.settingslib.notification;
18 
19 import android.content.Context;
20 
21 import com.android.internal.logging.MetricsLogger;
22 import com.android.internal.logging.nano.MetricsProto;
23 
24 /**
25  * Logs ui events for {@link EnableZenModeDialog}.
26  */
27 public class ZenModeDialogMetricsLogger {
28     private final Context mContext;
29 
ZenModeDialogMetricsLogger(Context context)30     public ZenModeDialogMetricsLogger(Context context) {
31         mContext = context;
32     }
33 
34     /**
35      * User enabled DND from the QS DND dialog to last until manually turned off
36      */
logOnEnableZenModeForever()37     public void logOnEnableZenModeForever() {
38         MetricsLogger.action(
39                 mContext,
40                 MetricsProto.MetricsEvent.NOTIFICATION_ZEN_MODE_TOGGLE_ON_FOREVER);
41     }
42 
43     /**
44      * User enabled DND from the QS DND dialog to last until the next alarm goes off
45      */
logOnEnableZenModeUntilAlarm()46     public void logOnEnableZenModeUntilAlarm() {
47         MetricsLogger.action(
48                 mContext,
49                 MetricsProto.MetricsEvent.NOTIFICATION_ZEN_MODE_TOGGLE_ON_ALARM);
50     }
51 
52     /**
53      * User enabled DND from the QS DND dialog to last until countdown is done
54      */
logOnEnableZenModeUntilCountdown()55     public void logOnEnableZenModeUntilCountdown() {
56         MetricsLogger.action(
57                 mContext,
58                 MetricsProto.MetricsEvent.NOTIFICATION_ZEN_MODE_TOGGLE_ON_COUNTDOWN);
59     }
60 
61     /**
62      * User selected an option on the DND dialog
63      */
logOnConditionSelected()64     public void logOnConditionSelected() {
65         MetricsLogger.action(
66                 mContext,
67                 MetricsProto.MetricsEvent.QS_DND_CONDITION_SELECT);
68     }
69 
70     /**
71      * User increased or decreased countdown duration of DND from the DND dialog
72      */
logOnClickTimeButton(boolean up)73     public void logOnClickTimeButton(boolean up) {
74         MetricsLogger.action(mContext, MetricsProto.MetricsEvent.QS_DND_TIME, up);
75     }
76 }
77