From 6e6f474df7af73cc2561218515df0ac7dbd75a37 Mon Sep 17 00:00:00 2001 From: Jaime Bernardo Date: Mon, 16 May 2022 10:10:56 +0100 Subject: [PATCH] [KBM][Telemetry]Remove garrulous events (#18261) --- doc/devdocs/modules/keyboardmanager/keyboardmanager.md | 6 ------ .../KeyboardManagerEngineLibrary/KeyboardEventHandlers.cpp | 6 ------ .../keyboardmanager/KeyboardManagerEngineLibrary/trace.cpp | 4 ++-- .../keyboardmanager/KeyboardManagerEngineLibrary/trace.h | 4 ++-- 4 files changed, 4 insertions(+), 16 deletions(-) diff --git a/doc/devdocs/modules/keyboardmanager/keyboardmanager.md b/doc/devdocs/modules/keyboardmanager/keyboardmanager.md index 8d0b27ff99..e63213ea2a 100644 --- a/doc/devdocs/modules/keyboardmanager/keyboardmanager.md +++ b/doc/devdocs/modules/keyboardmanager/keyboardmanager.md @@ -190,10 +190,4 @@ Keyboard Manager emits the following telemetry events (implemented in [trace.h]( - **`KeyboardManager_KeyRemapCount`:** Logs the number of key to key and key to shortcut remaps (i.e. all the remaps on the Remap a key window). This gets logged on saving new settings in the Remap a key window (emitted [here](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/ui/LoadingAndSavingRemappingHelper.cpp#L159-L163)). - **`KeyboardManager_OSLevelShortcutRemapCount`:** Logs the number of global shortcut to shortcut and shortcut to key remaps. This gets logged on saving new settings in the Remap a shortcut window (emitted [here](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/ui/LoadingAndSavingRemappingHelper.cpp#L220)). - **`KeyboardManager_AppSpecificShortcutRemapCount`:** Logs the number of app-specific shortcut to shortcut and shortcut to key remaps. This gets logged on saving new settings in the Remap a shortcut window (emitted [here](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/ui/LoadingAndSavingRemappingHelper.cpp#L221)). -- **`KeyboardManager_KeyToKeyRemapInvoked`:** Logs an event when a key to key remap is invoked (emitted [here](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/dll/KeyboardEventHandlers.cpp#L101-L102)). -- **`KeyboardManager_KeyToShortcutRemapInvoked`:** Logs an event when a key to shortcut remap is invoked (emitted [here](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/dll/KeyboardEventHandlers.cpp#L101-L102)). -- **`KeyboardManager_OSLevelShortcutToShortcutRemapInvoked`:** Logs an event when a global shortcut to shortcut remap is invoked (emitted [here](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/dll/KeyboardEventHandlers.cpp#L320-L321)). -- **`KeyboardManager_OSLevelShortcutToKeyRemapInvoked`:** Logs an event when a global shortcut to key remap is invoked (emitted [here](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/dll/KeyboardEventHandlers.cpp#L320-L321)). -- **`KeyboardManager_AppSpecificShortcutToShortcutRemapInvoked`:** Logs an event when an app-specific shortcut to shortcut remap is invoked (emitted [here](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/dll/KeyboardEventHandlers.cpp#L320-L321)). -- **`KeyboardManager_AppSpecificShortcutToKeyRemapInvoked`:** Logs an event when an app-specific shortcut to key remap is invoked (emitted [here](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/dll/KeyboardEventHandlers.cpp#L320-L321)). - **`KeyboardManager_Error`:** Logs the occurrence of an error in KBM with the name of the method, error code and the corresponding error message. This is currently used only for logging `SetWindowsHookEx` failures (emitted [here](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/dll/dllmain.cpp#L364-L369)). diff --git a/src/modules/keyboardmanager/KeyboardManagerEngineLibrary/KeyboardEventHandlers.cpp b/src/modules/keyboardmanager/KeyboardManagerEngineLibrary/KeyboardEventHandlers.cpp index c88bfef0b4..e401b849f0 100644 --- a/src/modules/keyboardmanager/KeyboardManagerEngineLibrary/KeyboardEventHandlers.cpp +++ b/src/modules/keyboardmanager/KeyboardManagerEngineLibrary/KeyboardEventHandlers.cpp @@ -98,9 +98,6 @@ namespace KeyboardEventHandlers if (data->wParam == WM_KEYDOWN || data->wParam == WM_SYSKEYDOWN) { - // Log telemetry event when the key remap is invoked - Trace::KeyRemapInvoked(remapToKey); - // If Caps Lock is being remapped to Ctrl/Alt/Shift, then reset the modifier key state to fix issues in certain IME keyboards where the IME shortcut gets invoked since it detects that the modifier and Caps Lock is pressed even though it is suppressed by the hook - More information at the GitHub issue https://github.com/microsoft/PowerToys/issues/3397 if (remapToKey) { @@ -319,9 +316,6 @@ namespace KeyboardEventHandlers UINT res = ii.SendVirtualInput((UINT)key_count, keyEventList, sizeof(INPUT)); delete[] keyEventList; - // Log telemetry event when shortcut remap is invoked - Trace::ShortcutRemapInvoked(remapToShortcut, activatedApp.has_value()); - return 1; } } diff --git a/src/modules/keyboardmanager/KeyboardManagerEngineLibrary/trace.cpp b/src/modules/keyboardmanager/KeyboardManagerEngineLibrary/trace.cpp index 5ec18e7cd2..5197d0afe2 100644 --- a/src/modules/keyboardmanager/KeyboardManagerEngineLibrary/trace.cpp +++ b/src/modules/keyboardmanager/KeyboardManagerEngineLibrary/trace.cpp @@ -18,7 +18,7 @@ void Trace::UnregisterProvider() noexcept TraceLoggingUnregister(g_hProvider); } -// Log if a key remap has been invoked +// Log if a key remap has been invoked (not being used currently, due to being garrulous) void Trace::KeyRemapInvoked(bool isKeyToKey) noexcept { if (isKeyToKey) @@ -39,7 +39,7 @@ void Trace::KeyRemapInvoked(bool isKeyToKey) noexcept } } -// Log if a shortcut remap has been invoked +// Log if a shortcut remap has been invoked (not being used currently, due to being garrulous) void Trace::ShortcutRemapInvoked(bool isShortcutToShortcut, bool isAppSpecific) noexcept { if (isAppSpecific) diff --git a/src/modules/keyboardmanager/KeyboardManagerEngineLibrary/trace.h b/src/modules/keyboardmanager/KeyboardManagerEngineLibrary/trace.h index e8451c34ea..48f0789e26 100644 --- a/src/modules/keyboardmanager/KeyboardManagerEngineLibrary/trace.h +++ b/src/modules/keyboardmanager/KeyboardManagerEngineLibrary/trace.h @@ -6,10 +6,10 @@ public: static void RegisterProvider() noexcept; static void UnregisterProvider() noexcept; - // Log if a key remap has been invoked + // Log if a key remap has been invoked (not being used currently, due to being garrulous) static void KeyRemapInvoked(bool isKeyToKey) noexcept; - // Log if a shortcut remap has been invoked + // Log if a shortcut remap has been invoked (not being used currently, due to being garrulous) static void ShortcutRemapInvoked(bool isShortcutToShortcut, bool isAppSpecific) noexcept; // Log if an error occurs in KBM