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.keyboard.stickykeys 18 19 import com.android.systemui.keyboard.stickykeys.shared.model.Locked 20 import com.android.systemui.keyboard.stickykeys.shared.model.ModifierKey 21 import com.android.systemui.log.LogBuffer 22 import com.android.systemui.log.core.LogLevel 23 import com.android.systemui.log.dagger.KeyboardLog 24 import javax.inject.Inject 25 26 private const val TAG = "stickyKeys" 27 28 class StickyKeysLogger @Inject constructor(@KeyboardLog private val buffer: LogBuffer) { logNewStickyKeysReceivednull29 fun logNewStickyKeysReceived(stickyKeys: Map<ModifierKey, Locked>) { 30 buffer.log( 31 TAG, 32 LogLevel.VERBOSE, 33 { str1 = stickyKeys.toString() }, 34 { "new sticky keys state received: $str1" } 35 ) 36 } 37 logNewUiStatenull38 fun logNewUiState(stickyKeys: Map<ModifierKey, Locked>) { 39 buffer.log( 40 TAG, 41 LogLevel.INFO, 42 { str1 = stickyKeys.toString() }, 43 { "new sticky keys state received: $str1" } 44 ) 45 } 46 logNewSettingValuenull47 fun logNewSettingValue(enabled: Boolean) { 48 buffer.log( 49 TAG, 50 LogLevel.INFO, 51 { bool1 = enabled }, 52 { "sticky key setting changed, new state: ${if (bool1) "enabled" else "disabled"}" } 53 ) 54 } 55 } 56