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 enum class QSDndEvent(private val _id: Int) : UiEventLogger.UiEventEnum { 98 @UiEvent(doc = "TODO(beverlyt)") 99 QS_DND_CONDITION_SELECT(420), 100 101 @UiEvent(doc = "TODO(beverlyt)") 102 QS_DND_TIME_UP(422), 103 104 @UiEvent(doc = "TODO(beverlyt)") 105 QS_DND_TIME_DOWN(423); 106 getIdnull107 override fun getId() = _id 108 } 109 110 enum class QSUserSwitcherEvent(private val _id: Int) : UiEventLogger.UiEventEnum { 111 @UiEvent(doc = "The current user has been switched in the detail panel") 112 QS_USER_SWITCH(424), 113 114 @UiEvent(doc = "User switcher QS detail panel open") 115 QS_USER_DETAIL_OPEN(425), 116 117 @UiEvent(doc = "User switcher QS detail panel closed") 118 QS_USER_DETAIL_CLOSE(426), 119 120 @UiEvent(doc = "User switcher QS detail panel more settings pressed") 121 QS_USER_MORE_SETTINGS(427), 122 123 @UiEvent(doc = "The user has added a guest in the detail panel") 124 QS_USER_GUEST_ADD(754), 125 126 @UiEvent(doc = "The user selected 'Start over' after switching to the existing Guest user") 127 QS_USER_GUEST_WIPE(755), 128 129 @UiEvent(doc = "The user selected 'Yes, continue' after switching to the existing Guest user") 130 QS_USER_GUEST_CONTINUE(756), 131 132 @UiEvent(doc = "The user has pressed 'Remove guest' in the detail panel") 133 QS_USER_GUEST_REMOVE(757); 134 135 override fun getId() = _id 136 }