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 { qsUiEventsLogger = it } 31 } 32 resetLoggernull33 fun resetLogger() { 34 qsUiEventsLogger = UiEventLoggerImpl() 35 } 36 } 37 38 enum class QSEvent(private val _id: Int) : UiEventLogger.UiEventEnum { 39 @UiEvent(doc = "Tile clicked. It has an instance id and a spec (or packageName)") 40 QS_ACTION_CLICK(387), 41 @UiEvent( 42 doc = 43 "Tile secondary button clicked. " + "It has an instance id and a spec (or packageName)" 44 ) 45 QS_ACTION_SECONDARY_CLICK(388), 46 @UiEvent(doc = "Tile long clicked. It has an instance id and a spec (or packageName)") 47 QS_ACTION_LONG_PRESS(389), 48 @UiEvent(doc = "Quick Settings panel expanded") QS_PANEL_EXPANDED(390), 49 @UiEvent(doc = "Quick Settings panel collapsed") QS_PANEL_COLLAPSED(391), 50 @UiEvent( 51 doc = 52 "Tile visible in Quick Settings panel. The tile may be in a different page. " + 53 "It has an instance id and a spec (or packageName)" 54 ) 55 QS_TILE_VISIBLE(392), 56 @UiEvent(doc = "Quick Quick Settings panel expanded") QQS_PANEL_EXPANDED(393), 57 @UiEvent(doc = "Quick Quick Settings panel collapsed") QQS_PANEL_COLLAPSED(394), 58 @UiEvent( 59 doc = 60 "Tile visible in Quick Quick Settings panel. " + 61 "It has an instance id and a spec (or packageName)" 62 ) 63 QQS_TILE_VISIBLE(395); 64 getIdnull65 override fun getId() = _id 66 } 67 68 enum class QSEditEvent(private val _id: Int) : UiEventLogger.UiEventEnum { 69 70 @UiEvent(doc = "Tile removed from current tiles") QS_EDIT_REMOVE(210), 71 @UiEvent(doc = "Tile added to current tiles") QS_EDIT_ADD(211), 72 @UiEvent(doc = "Tile moved") QS_EDIT_MOVE(212), 73 @UiEvent(doc = "QS customizer open") QS_EDIT_OPEN(213), 74 @UiEvent(doc = "QS customizer closed") QS_EDIT_CLOSED(214), 75 @UiEvent(doc = "QS tiles reset") QS_EDIT_RESET(215), 76 @UiEvent(doc = "QS edit mode resize tile to large") QS_EDIT_RESIZE_LARGE(2122), 77 @UiEvent(doc = "QS edit mode resize tile to small") QS_EDIT_RESIZE_SMALL(2123); 78 79 override fun getId() = _id 80 } 81 82 /** 83 * Events from the QS DND tile dialog. {@see QSZenModeDialogMetricsLogger} Other names for DND (Do 84 * Not Disturb) include "Zen" and "Priority mode". 85 */ 86 enum class QSDndEvent(private val _id: Int) : UiEventLogger.UiEventEnum { 87 @UiEvent(doc = "User selected an option on the DND dialog") QS_DND_CONDITION_SELECT(420), 88 @UiEvent(doc = "User increased countdown duration of DND from the DND dialog") 89 QS_DND_TIME_UP(422), 90 @UiEvent(doc = "User decreased countdown duration of DND from the DND dialog") 91 QS_DND_TIME_DOWN(423), 92 @UiEvent(doc = "User enabled DND from the QS DND dialog to last until manually turned off") 93 QS_DND_DIALOG_ENABLE_FOREVER(946), 94 @UiEvent(doc = "User enabled DND from the QS DND dialog to last until the next alarm goes off") 95 QS_DND_DIALOG_ENABLE_UNTIL_ALARM(947), 96 @UiEvent(doc = "User enabled DND from the QS DND dialog to last until countdown is done") 97 QS_DND_DIALOG_ENABLE_UNTIL_COUNTDOWN(948); 98 getIdnull99 override fun getId() = _id 100 } 101 102 enum class QSUserSwitcherEvent(private val _id: Int) : UiEventLogger.UiEventEnum { 103 @UiEvent(doc = "The current user has been switched in the detail panel") QS_USER_SWITCH(424), 104 @UiEvent(doc = "User switcher QS dialog open") QS_USER_DETAIL_OPEN(425), 105 @UiEvent(doc = "User switcher QS dialog closed") QS_USER_DETAIL_CLOSE(426), 106 @UiEvent(doc = "User switcher QS dialog more settings pressed") QS_USER_MORE_SETTINGS(427), 107 @UiEvent(doc = "The user has added a guest in the detail panel") QS_USER_GUEST_ADD(754), 108 @UiEvent(doc = "The user selected 'Start over' after switching to the existing Guest user") 109 QS_USER_GUEST_WIPE(755), 110 @UiEvent(doc = "The user selected 'Yes, continue' after switching to the existing Guest user") 111 QS_USER_GUEST_CONTINUE(756), 112 @UiEvent(doc = "The user has pressed 'Remove guest' in the detail panel") 113 QS_USER_GUEST_REMOVE(757); 114 115 override fun getId() = _id 116 } 117