1 /* 2 * Copyright (C) 2024 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.policy.ui.dialog 18 19 import com.android.internal.logging.UiEventLogger 20 import com.android.settingslib.notification.modes.ZenMode 21 import com.android.systemui.qs.QSModesEvent 22 import javax.inject.Inject 23 24 class ModesDialogEventLogger @Inject constructor(private val uiEventLogger: UiEventLogger) { 25 logModeOnnull26 fun logModeOn(mode: ZenMode) { 27 val id = 28 if (mode.isManualDnd) QSModesEvent.QS_MODES_DND_ON else QSModesEvent.QS_MODES_MODE_ON 29 uiEventLogger.log(id, /* uid= */ 0, mode.ownerPackage) 30 } 31 logModeOffnull32 fun logModeOff(mode: ZenMode) { 33 val id = 34 if (mode.isManualDnd) QSModesEvent.QS_MODES_DND_OFF else QSModesEvent.QS_MODES_MODE_OFF 35 uiEventLogger.log(id, /* uid= */ 0, mode.ownerPackage) 36 } 37 logModeSettingsnull38 fun logModeSettings(mode: ZenMode) { 39 val id = 40 if (mode.isManualDnd) QSModesEvent.QS_MODES_DND_SETTINGS 41 else QSModesEvent.QS_MODES_MODE_SETTINGS 42 uiEventLogger.log(id, /* uid= */ 0, mode.ownerPackage) 43 } 44 logOpenDurationDialognull45 fun logOpenDurationDialog(mode: ZenMode) { 46 // should only occur for manual Do Not Disturb. 47 if (!mode.isManualDnd) { 48 return 49 } 50 uiEventLogger.log(QSModesEvent.QS_MODES_DURATION_DIALOG) 51 } 52 logDialogSettingsnull53 fun logDialogSettings() { 54 uiEventLogger.log(QSModesEvent.QS_MODES_SETTINGS) 55 } 56 } 57