2019-09-04 18:26:26 +02:00
|
|
|
#include "pch.h"
|
|
|
|
|
#include "trace.h"
|
|
|
|
|
|
2020-02-12 13:03:40 +03:00
|
|
|
#include "general_settings.h"
|
|
|
|
|
|
2024-10-24 22:04:32 +02:00
|
|
|
#include <common/Telemetry/TraceBase.h>
|
|
|
|
|
|
2019-09-04 18:26:26 +02:00
|
|
|
TRACELOGGING_DEFINE_PROVIDER(
|
2019-12-26 17:26:11 +01:00
|
|
|
g_hProvider,
|
|
|
|
|
"Microsoft.PowerToys",
|
|
|
|
|
// {38e8889b-9731-53f5-e901-e8a7c1753074}
|
|
|
|
|
(0x38e8889b, 0x9731, 0x53f5, 0xe9, 0x01, 0xe8, 0xa7, 0xc1, 0x75, 0x30, 0x74),
|
|
|
|
|
TraceLoggingOptionProjectTelemetry());
|
2019-09-04 18:26:26 +02:00
|
|
|
|
2020-02-12 13:03:40 +03:00
|
|
|
void Trace::EventLaunch(const std::wstring& versionNumber, bool isProcessElevated)
|
2019-12-26 17:26:11 +01:00
|
|
|
{
|
2024-10-24 22:04:32 +02:00
|
|
|
TraceLoggingWriteWrapper(
|
2019-12-26 17:26:11 +01:00
|
|
|
g_hProvider,
|
|
|
|
|
"Runner_Launch",
|
|
|
|
|
TraceLoggingWideString(versionNumber.c_str(), "Version"),
|
2020-02-12 13:03:40 +03:00
|
|
|
TraceLoggingBoolean(isProcessElevated, "Elevated"),
|
|
|
|
|
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
|
|
|
|
TraceLoggingBoolean(TRUE, "UTCReplace_AppSessionGuid"),
|
|
|
|
|
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Trace::SettingsChanged(const GeneralSettings& settings)
|
|
|
|
|
{
|
|
|
|
|
std::wstring enabledModules;
|
|
|
|
|
for (const auto& [name, isEnabled] : settings.isModulesEnabledMap)
|
|
|
|
|
{
|
|
|
|
|
if (isEnabled)
|
|
|
|
|
{
|
|
|
|
|
if (!enabledModules.empty())
|
|
|
|
|
{
|
|
|
|
|
enabledModules += L", ";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
enabledModules += name;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-24 22:04:32 +02:00
|
|
|
TraceLoggingWriteWrapper(
|
2020-02-12 13:03:40 +03:00
|
|
|
g_hProvider,
|
|
|
|
|
"GeneralSettingsChanged",
|
|
|
|
|
TraceLoggingBoolean(settings.isStartupEnabled, "RunAtStartup"),
|
2024-01-03 20:22:54 +03:00
|
|
|
TraceLoggingBoolean(settings.enableWarningsElevatedApps, "EnableWarningsElevatedApps"),
|
2020-02-12 13:03:40 +03:00
|
|
|
TraceLoggingWideString(settings.startupDisabledReason.c_str(), "StartupDisabledReason"),
|
|
|
|
|
TraceLoggingWideString(enabledModules.c_str(), "ModulesEnabled"),
|
|
|
|
|
TraceLoggingBoolean(settings.isRunElevated, "AlwaysRunElevated"),
|
2020-04-21 10:30:12 +03:00
|
|
|
TraceLoggingBoolean(settings.downloadUpdatesAutomatically, "DownloadUpdatesAutomatically"),
|
2023-02-14 18:38:53 -08:00
|
|
|
TraceLoggingBoolean(settings.enableExperimentation, "EnableExperimentation"),
|
2020-02-12 13:03:40 +03:00
|
|
|
TraceLoggingWideString(settings.theme.c_str(), "Theme"),
|
2019-12-26 17:26:11 +01:00
|
|
|
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
|
|
|
|
TraceLoggingBoolean(TRUE, "UTCReplace_AppSessionGuid"),
|
|
|
|
|
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
|
2019-09-04 18:26:26 +02:00
|
|
|
}
|
2026-01-08 15:57:49 +08:00
|
|
|
|
|
|
|
|
void Trace::UpdateCheckCompleted(bool success, bool updateAvailable, const std::wstring& fromVersion, const std::wstring& toVersion)
|
|
|
|
|
{
|
|
|
|
|
TraceLoggingWriteWrapper(
|
|
|
|
|
g_hProvider,
|
|
|
|
|
"UpdateCheck_Completed",
|
|
|
|
|
TraceLoggingBoolean(success, "Success"),
|
|
|
|
|
TraceLoggingBoolean(updateAvailable, "UpdateAvailable"),
|
|
|
|
|
TraceLoggingWideString(fromVersion.c_str(), "FromVersion"),
|
|
|
|
|
TraceLoggingWideString(toVersion.c_str(), "ToVersion"),
|
|
|
|
|
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
|
|
|
|
TraceLoggingBoolean(TRUE, "UTCReplace_AppSessionGuid"),
|
|
|
|
|
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Trace::UpdateDownloadCompleted(bool success, const std::wstring& version)
|
|
|
|
|
{
|
|
|
|
|
TraceLoggingWriteWrapper(
|
|
|
|
|
g_hProvider,
|
|
|
|
|
"UpdateDownload_Completed",
|
|
|
|
|
TraceLoggingBoolean(success, "Success"),
|
|
|
|
|
TraceLoggingWideString(version.c_str(), "Version"),
|
|
|
|
|
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
|
|
|
|
TraceLoggingBoolean(TRUE, "UTCReplace_AppSessionGuid"),
|
|
|
|
|
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
|
|
|
|
|
}
|
Add telemetry for tray icon (#44985)
<!-- Enter a brief description/summary of your PR here. What does it
fix/what does it change/how was it tested (even manually, if necessary)?
-->
## Summary of the Pull Request
This pull request adds telemetry tracking for user interactions with the
application's tray icon. Specifically, it introduces new methods for
logging `left-click`, `right-click`, and `double-click` events, and
integrates these telemetry calls into the tray icon event handling
logic.
<!-- Please review the items on the PR checklist before submitting-->
## PR Checklist
- [ ] Closes: #xxx
<!-- - [ ] Closes: #yyy (add separate lines for additional resolved
issues) -->
- [x] **Communication:** I've discussed this with core contributors
already. If the work hasn't been agreed, this work might be rejected
- [x] **Tests:** Added/updated and all pass
- [ ] **Localization:** All end-user-facing strings can be localized
- [ ] **Dev docs:** Added/updated
- [ ] **New binaries:** Added on the required places
- [ ] [JSON for
signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json)
for new binaries
- [ ] [WXS for
installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs)
for new binaries and localization folder
- [ ] [YML for CI
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml)
for new test projects
- [ ] [YML for signed
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml)
- [ ] **Documentation updated:** If checked, please file a pull request
on [our docs
repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys)
and link it here: #xxx
<!-- Provide a more detailed description of the PR, other things fixed,
or any additional comments/features here -->
## Detailed Description of the Pull Request / Additional comments
<!-- Describe how you validated the behavior. Add automated tests
wherever possible, but list manual validation steps taken as well -->
## Validation Steps Performed
2026-01-26 09:44:10 +08:00
|
|
|
|
|
|
|
|
void Trace::TrayIconLeftClick(bool quickAccessEnabled)
|
|
|
|
|
{
|
|
|
|
|
TraceLoggingWriteWrapper(
|
|
|
|
|
g_hProvider,
|
|
|
|
|
"TrayIcon_LeftClick",
|
|
|
|
|
TraceLoggingBoolean(quickAccessEnabled, "QuickAccessEnabled"),
|
|
|
|
|
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
|
|
|
|
TraceLoggingBoolean(TRUE, "UTCReplace_AppSessionGuid"),
|
|
|
|
|
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Trace::TrayIconDoubleClick(bool quickAccessEnabled)
|
|
|
|
|
{
|
|
|
|
|
TraceLoggingWriteWrapper(
|
|
|
|
|
g_hProvider,
|
|
|
|
|
"TrayIcon_DoubleClick",
|
|
|
|
|
TraceLoggingBoolean(quickAccessEnabled, "QuickAccessEnabled"),
|
|
|
|
|
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
|
|
|
|
TraceLoggingBoolean(TRUE, "UTCReplace_AppSessionGuid"),
|
|
|
|
|
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Trace::TrayIconRightClick(bool quickAccessEnabled)
|
|
|
|
|
{
|
|
|
|
|
TraceLoggingWriteWrapper(
|
|
|
|
|
g_hProvider,
|
|
|
|
|
"TrayIcon_RightClick",
|
|
|
|
|
TraceLoggingBoolean(quickAccessEnabled, "QuickAccessEnabled"),
|
|
|
|
|
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
|
|
|
|
TraceLoggingBoolean(TRUE, "UTCReplace_AppSessionGuid"),
|
|
|
|
|
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
|
|
|
|
|
}
|