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.qs 18 19 import com.android.internal.logging.UiEvent 20 import com.android.internal.logging.UiEventLogger 21 import com.android.internal.logging.UiEventLoggerImpl 22 import com.android.internal.logging.testing.UiEventLoggerFake 23 24 object QSEvents { 25 26 var qsUiEventsLogger: UiEventLogger = UiEventLoggerImpl() 27 private set 28 setLoggerForTestingnull29 fun setLoggerForTesting(): UiEventLoggerFake { 30 return UiEventLoggerFake().also { 31 qsUiEventsLogger = it 32 } 33 } 34 resetLoggernull35 fun resetLogger() { 36 qsUiEventsLogger = UiEventLoggerImpl() 37 } 38 } 39 40 enum class QSEvent(private val _id: Int) : UiEventLogger.UiEventEnum { 41 @UiEvent(doc = "Tile clicked. It has an instance id and a spec (or packageName)") 42 QS_ACTION_CLICK(387), 43 44 @UiEvent(doc = "Tile secondary button clicked. " + 45 "It has an instance id and a spec (or packageName)") 46 QS_ACTION_SECONDARY_CLICK(388), 47 48 @UiEvent(doc = "Tile long clicked. It has an instance id and a spec (or packageName)") 49 QS_ACTION_LONG_PRESS(389), 50 51 @UiEvent(doc = "Quick Settings panel expanded") 52 QS_PANEL_EXPANDED(390), 53 54 @UiEvent(doc = "Quick Settings panel collapsed") 55 QS_PANEL_COLLAPSED(391), 56 57 @UiEvent(doc = "Tile visible in Quick Settings panel. The tile may be in a different page. " + 58 "It has an instance id and a spec (or packageName)") 59 QS_TILE_VISIBLE(392), 60 61 @UiEvent(doc = "Quick Quick Settings panel expanded") 62 QQS_PANEL_EXPANDED(393), 63 64 @UiEvent(doc = "Quick Quick Settings panel collapsed") 65 QQS_PANEL_COLLAPSED(394), 66 67 @UiEvent(doc = "Tile visible in Quick Quick Settings panel. " + 68 "It has an instance id and a spec (or packageName)") 69 QQS_TILE_VISIBLE(395); 70 getIdnull71 override fun getId() = _id 72 } 73 74 enum class QSEditEvent(private val _id: Int) : UiEventLogger.UiEventEnum { 75 76 @UiEvent(doc = "Tile removed from current tiles") 77 QS_EDIT_REMOVE(210), 78 79 @UiEvent(doc = "Tile added to current tiles") 80 QS_EDIT_ADD(211), 81 82 @UiEvent(doc = "Tile moved") 83 QS_EDIT_MOVE(212), 84 85 @UiEvent(doc = "QS customizer open") 86 QS_EDIT_OPEN(213), 87 88 @UiEvent(doc = "QS customizer closed") 89 QS_EDIT_CLOSED(214), 90 91 @UiEvent(doc = "QS tiles reset") 92 QS_EDIT_RESET(215); 93 94 override fun getId() = _id 95 } 96 97 /** 98 * Events from the QS DND tile dialog. {@see QSZenModeDialogMetricsLogger} 99 * Other names for DND (Do Not Disturb) include "Zen" and "Priority mode". 100 */ 101 enum class QSDndEvent(private val _id: Int) : UiEventLogger.UiEventEnum { 102 @UiEvent(doc = "User selected an option on the DND dialog") 103 QS_DND_CONDITION_SELECT(420), 104 105 @UiEvent(doc = "User increased countdown duration of DND from the DND dialog") 106 QS_DND_TIME_UP(422), 107 108 @UiEvent(doc = "User decreased countdown duration of DND from the DND dialog") 109 QS_DND_TIME_DOWN(423), 110 111 @UiEvent(doc = "User enabled DND from the QS DND dialog to last until manually turned off") 112 QS_DND_DIALOG_ENABLE_FOREVER(946), 113 114 @UiEvent(doc = "User enabled DND from the QS DND dialog to last until the next alarm goes off") 115 QS_DND_DIALOG_ENABLE_UNTIL_ALARM(947), 116 117 @UiEvent(doc = "User enabled DND from the QS DND dialog to last until countdown is done") 118 QS_DND_DIALOG_ENABLE_UNTIL_COUNTDOWN(948); 119 getIdnull120 override fun getId() = _id 121 } 122 123 enum class QSUserSwitcherEvent(private val _id: Int) : UiEventLogger.UiEventEnum { 124 @UiEvent(doc = "The current user has been switched in the detail panel") 125 QS_USER_SWITCH(424), 126 127 @UiEvent(doc = "User switcher QS dialog open") 128 QS_USER_DETAIL_OPEN(425), 129 130 @UiEvent(doc = "User switcher QS dialog closed") 131 QS_USER_DETAIL_CLOSE(426), 132 133 @UiEvent(doc = "User switcher QS dialog more settings pressed") 134 QS_USER_MORE_SETTINGS(427), 135 136 @UiEvent(doc = "The user has added a guest in the detail panel") 137 QS_USER_GUEST_ADD(754), 138 139 @UiEvent(doc = "The user selected 'Start over' after switching to the existing Guest user") 140 QS_USER_GUEST_WIPE(755), 141 142 @UiEvent(doc = "The user selected 'Yes, continue' after switching to the existing Guest user") 143 QS_USER_GUEST_CONTINUE(756), 144 145 @UiEvent(doc = "The user has pressed 'Remove guest' in the detail panel") 146 QS_USER_GUEST_REMOVE(757); 147 148 override fun getId() = _id 149 }