diff options
author | 2023-11-22 18:03:24 +0000 | |
---|---|---|
committer | 2023-11-22 18:03:24 +0000 | |
commit | bf76cceb6a7d20f1294cb6ec4394d2ee28d2e7f8 (patch) | |
tree | 88e1f8b30023c0a8af9853097831f3d7a34cc65e | |
parent | 6490e4d55160b5ed1f815cd6358531b76cd5da7e (diff) | |
parent | 6da32489b1d99d6ff79347bfd5299236901ae8c8 (diff) |
Merge "Add debug logs to `NoteTaskInitializer`" into main
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/notetask/NoteTaskInitializer.kt | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/notetask/NoteTaskInitializer.kt b/packages/SystemUI/src/com/android/systemui/notetask/NoteTaskInitializer.kt index 338d3ed42f95..9698548dd30d 100644 --- a/packages/SystemUI/src/com/android/systemui/notetask/NoteTaskInitializer.kt +++ b/packages/SystemUI/src/com/android/systemui/notetask/NoteTaskInitializer.kt @@ -27,6 +27,7 @@ import android.view.ViewConfiguration import com.android.keyguard.KeyguardUpdateMonitor import com.android.keyguard.KeyguardUpdateMonitorCallback import com.android.systemui.dagger.qualifiers.Background +import com.android.systemui.log.DebugLogger.debugLog import com.android.systemui.notetask.NoteTaskEntryPoint.KEYBOARD_SHORTCUT import com.android.systemui.notetask.NoteTaskEntryPoint.TAIL_BUTTON import com.android.systemui.settings.UserTracker @@ -52,6 +53,8 @@ constructor( /** Initializes note task related features and glue it with other parts of the SystemUI. */ fun initialize() { + debugLog { "initialize: isEnabled=$isEnabled, hasBubbles=${optionalBubbles.isEmpty}" } + // Guard against feature not being enabled or mandatory dependencies aren't available. if (!isEnabled || optionalBubbles.isEmpty) return @@ -134,12 +137,15 @@ constructor( * Tracks a [KeyEvent], and determines if it should trigger an action to show the note task. * Returns a [NoteTaskEntryPoint] if an action should be taken, and null otherwise. */ - private fun KeyEvent.toNoteTaskEntryPointOrNull(): NoteTaskEntryPoint? = - when { + private fun KeyEvent.toNoteTaskEntryPointOrNull(): NoteTaskEntryPoint? { + val entryPoint = when { keyCode == KEYCODE_STYLUS_BUTTON_TAIL && isTailButtonNotesGesture() -> TAIL_BUTTON keyCode == KEYCODE_N && isMetaPressed && isCtrlPressed -> KEYBOARD_SHORTCUT else -> null } + debugLog { "toNoteTaskEntryPointOrNull: entryPoint=$entryPoint" } + return entryPoint + } private var lastStylusButtonTailUpEventTime: Long = -MULTI_PRESS_TIMEOUT @@ -155,8 +161,10 @@ constructor( val isMultiPress = (downTime - lastStylusButtonTailUpEventTime) < MULTI_PRESS_TIMEOUT val isLongPress = (eventTime - downTime) >= LONG_PRESS_TIMEOUT lastStylusButtonTailUpEventTime = eventTime + // For now, trigger action immediately on UP of a single press, without waiting for // the multi-press timeout to expire. + debugLog { "isTailButtonNotesGesture: isMultiPress=$isMultiPress, isLongPress=$isLongPress" } return !isMultiPress && !isLongPress } |